Merge pull request #2089 from rathena/refactor/windows-build

* Dropped support for VS older than 2012
* Delete all solutions
* Added a new global VS2013 solution (2015+ also supported by this solution)
* Added x64 build support for Windows (Thanks to @Lemongrass3110)
This commit is contained in:
Jittapan Pluemsumran 2017-05-02 12:52:39 +07:00 committed by GitHub
commit cacd98ddeb
168 changed files with 21083 additions and 16624 deletions

14
.gitignore vendored
View File

@ -14,6 +14,8 @@ Thumbs.db
/*.exe
/*.exe.*
/*.ilk
/*.iobj
/*.ipdb
/*.log
/*.ncb
/*.opensdf
@ -148,3 +150,15 @@ Thumbs.db
/.idea/workspace.xml
/build/
# bat tools
/charserv.bat
/logserv.bat
/mapcache.bat
/mapserv.bat
/runserver.bat
/serv.bat
# dlls
/libmysql.dll
/pcre8.dll
/zlib.dll

171
3rdparty/libconfig/libconfig.vcxproj vendored Normal file
View File

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="grammar.h" />
<ClInclude Include="libconfig.h" />
<ClInclude Include="parsectx.h" />
<ClInclude Include="scanctx.h" />
<ClInclude Include="scanner.h" />
<ClInclude Include="strbuf.h" />
<ClInclude Include="wincompat.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="grammar.c" />
<ClCompile Include="libconfig.c" />
<ClCompile Include="scanctx.c" />
<ClCompile Include="scanner.c" />
<ClCompile Include="strbuf.c" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>libconfig</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir).vs\build\</OutDir>
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir).vs\build\</OutDir>
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir).vs\build\</OutDir>
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir).vs\build\</OutDir>
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>YY_USE_CONST;LIBCONFIG_STATIC;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>YY_USE_CONST;LIBCONFIG_STATIC;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>YY_USE_CONST;LIBCONFIG_STATIC;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>YY_USE_CONST;LIBCONFIG_STATIC;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="grammar.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="libconfig.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="parsectx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="scanctx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="scanner.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="strbuf.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="wincompat.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="grammar.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="libconfig.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="scanctx.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="scanner.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="strbuf.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

158
3rdparty/mt19937ar/mt19937ar.vcxproj vendored Normal file
View File

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="mt19937ar.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="mt19937ar.c" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7AE31676-6137-4FB3-AE9C-AD47D8A861CF}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>mt19937ar</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir).vs\build\</OutDir>
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir).vs\build\</OutDir>
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir).vs\build\</OutDir>
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir).vs\build\</OutDir>
<IntDir>$(SolutionDir).vs\build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>$(DefineConstants);WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>$(DefineConstants);WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>$(DefineConstants);WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>$(DefineConstants);WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="mt19937ar.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="mt19937ar.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

114
3rdparty/mysql/include/big_endian.h vendored Normal file
View File

@ -0,0 +1,114 @@
/* Copyright (c) 2012, 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 */
#include <string.h>
/*
Data in big-endian format.
*/
static inline void float4store(uchar *T, float A)
{ *(T)= ((uchar *) &A)[3];
*((T)+1)=(char) ((uchar *) &A)[2];
*((T)+2)=(char) ((uchar *) &A)[1];
*((T)+3)=(char) ((uchar *) &A)[0]; }
static inline void float4get (float *V, const uchar *M)
{ 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; }
static inline void float8store(uchar *T, double V)
{ *(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]; }
static inline void float8get (double *V, const uchar *M)
{ 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; }
static inline void ushortget(uint16 *V, const uchar *pM)
{ *V = (uint16) (((uint16) ((uchar) (pM)[1]))+
((uint16) ((uint16) (pM)[0]) << 8)); }
static inline void shortget (int16 *V, const uchar *pM)
{ *V = (short) (((short) ((uchar) (pM)[1]))+
((short) ((short) (pM)[0]) << 8)); }
static inline void longget (int32 *V, const uchar *pM)
{ int32 def_temp;
((uchar*) &def_temp)[0]=(pM)[0];
((uchar*) &def_temp)[1]=(pM)[1];
((uchar*) &def_temp)[2]=(pM)[2];
((uchar*) &def_temp)[3]=(pM)[3];
(*V)=def_temp; }
static inline void ulongget (uint32 *V, const uchar *pM)
{ uint32 def_temp;
((uchar*) &def_temp)[0]=(pM)[0];
((uchar*) &def_temp)[1]=(pM)[1];
((uchar*) &def_temp)[2]=(pM)[2];
((uchar*) &def_temp)[3]=(pM)[3];
(*V)=def_temp; }
static inline void shortstore(uchar *T, int16 A)
{ uint def_temp=(uint) (A) ;
*(((char*)T)+1)=(char)(def_temp);
*(((char*)T)+0)=(char)(def_temp >> 8); }
static inline void longstore (uchar *T, int32 A)
{ *(((char*)T)+3)=((A));
*(((char*)T)+2)=(((A) >> 8));
*(((char*)T)+1)=(((A) >> 16));
*(((char*)T)+0)=(((A) >> 24)); }
static inline void floatget(float *V, const uchar *M)
{
memcpy(V, (M), sizeof(float));
}
static inline void floatstore(uchar *T, float V)
{
memcpy((T), (&V), sizeof(float));
}
static inline void doubleget(double *V, const uchar *M)
{
memcpy(V, (M), sizeof(double));
}
static inline void doublestore(uchar *T, double V)
{
memcpy((T), &V, sizeof(double));
}
static inline void longlongget(longlong *V, const uchar *M)
{
memcpy(V, (M), sizeof(ulonglong));
}
static inline void longlongstore(uchar *T, longlong V)
{
memcpy((T), &V, sizeof(ulonglong));
}

View File

@ -0,0 +1,70 @@
/* Copyright (c) 2014, 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/**
@file binary_log_types.h
@brief This file contains the field type.
@note This file can be imported both from C and C++ code, so the
definitions have to be constructed to support this.
*/
#ifndef BINARY_LOG_TYPES_INCLUDED
#define BINARY_LOG_TYPES_INCLUDED
#ifdef __cplusplus
extern "C"
{
#endif
/*
* Constants exported from this package.
*/
typedef 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_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
} enum_field_types;
#define DATETIME_MAX_DECIMALS 6
#ifdef __cplusplus
}
#endif // __cplusplus
#endif /* BINARY_LOG_TYPES_INCLUDED */

View File

@ -0,0 +1,97 @@
/* Copyright (c) 2001, 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 */
/*
Endianness-independent definitions for architectures other
than the x86 architecture.
*/
static inline int16 sint2korr(const uchar *A)
{
return
(int16) (((int16) (A[0])) +
((int16) (A[1]) << 8))
;
}
static inline int32 sint4korr(const uchar *A)
{
return
(int32) (((int32) (A[0])) +
(((int32) (A[1]) << 8)) +
(((int32) (A[2]) << 16)) +
(((int32) (A[3]) << 24)))
;
}
static inline uint16 uint2korr(const uchar *A)
{
return
(uint16) (((uint16) (A[0])) +
((uint16) (A[1]) << 8))
;
}
static inline uint32 uint4korr(const uchar *A)
{
return
(uint32) (((uint32) (A[0])) +
(((uint32) (A[1])) << 8) +
(((uint32) (A[2])) << 16) +
(((uint32) (A[3])) << 24))
;
}
static inline ulonglong uint8korr(const uchar *A)
{
return
((ulonglong)(((uint32) (A[0])) +
(((uint32) (A[1])) << 8) +
(((uint32) (A[2])) << 16) +
(((uint32) (A[3])) << 24)) +
(((ulonglong) (((uint32) (A[4])) +
(((uint32) (A[5])) << 8) +
(((uint32) (A[6])) << 16) +
(((uint32) (A[7])) << 24))) <<
32))
;
}
static inline longlong sint8korr(const uchar *A)
{
return (longlong) uint8korr(A);
}
static inline void int2store(uchar *T, uint16 A)
{
uint def_temp= A ;
*(T)= (uchar)(def_temp);
*(T+1)= (uchar)(def_temp >> 8);
}
static inline void int4store(uchar *T, uint32 A)
{
*(T)= (uchar) (A);
*(T+1)=(uchar) (A >> 8);
*(T+2)=(uchar) (A >> 16);
*(T+3)=(uchar) (A >> 24);
}
static inline void int8store(uchar *T, ulonglong A)
{
uint def_temp= (uint) A,
def_temp2= (uint) (A >> 32);
int4store(T, def_temp);
int4store(T+4,def_temp2);
}

View File

@ -0,0 +1,56 @@
/* Copyright (c) 2001, 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
Optimized functions for the x86 architecture (_WIN32 included).
x86 handles misaligned reads and writes just fine, so suppress
UBSAN warnings for these functions.
*/
static inline int16 sint2korr(const uchar *A) SUPPRESS_UBSAN;
static inline int16 sint2korr(const uchar *A) { return *((int16*) A); }
static inline int32 sint4korr(const uchar *A) SUPPRESS_UBSAN;
static inline int32 sint4korr(const uchar *A) { return *((int32*) A); }
static inline uint16 uint2korr(const uchar *A) SUPPRESS_UBSAN;
static inline uint16 uint2korr(const uchar *A) { return *((uint16*) A); }
static inline uint32 uint4korr(const uchar *A) SUPPRESS_UBSAN;
static inline uint32 uint4korr(const uchar *A) { return *((uint32*) A); }
static inline ulonglong uint8korr(const uchar *A) SUPPRESS_UBSAN;
static inline ulonglong uint8korr(const uchar *A) { return *((ulonglong*) A);}
static inline longlong sint8korr(const uchar *A) SUPPRESS_UBSAN;
static inline longlong sint8korr(const uchar *A) { return *((longlong*) A); }
static inline void int2store(uchar *T, uint16 A) SUPPRESS_UBSAN;
static inline void int2store(uchar *T, uint16 A)
{
*((uint16*) T)= A;
}
static inline void int4store(uchar *T, uint32 A) SUPPRESS_UBSAN;
static inline void int4store(uchar *T, uint32 A)
{
*((uint32*) T)= A;
}
static inline void int8store(uchar *T, ulonglong A) SUPPRESS_UBSAN;
static inline void int8store(uchar *T, ulonglong A)
{
*((ulonglong*) T)= A;
}

View File

@ -1,470 +0,0 @@
/* Copyright (C) 2000 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; 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Defines for Win32 to make it compatible for MySQL */
#ifdef __WIN2000__
/* We have to do this define before including windows.h to get the AWE API
functions */
#define _WIN32_WINNT 0x0500
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1400
/* Avoid endless warnings about sprintf() etc. being unsafe. */
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
#include <sys/locking.h>
#include <windows.h>
#include <math.h> /* Because of rint() */
#include <fcntl.h>
#include <io.h>
#include <malloc.h>
#define HAVE_SMEM 1
#if defined(_WIN64) || defined(WIN64)
#define SYSTEM_TYPE "Win64"
#elif defined(_WIN32) || defined(WIN32)
#define SYSTEM_TYPE "Win32"
#else
#define SYSTEM_TYPE "Windows"
#endif
#if defined(_M_IA64)
#define MACHINE_TYPE "ia64"
#elif defined(_M_IX86)
#define MACHINE_TYPE "ia32"
#elif defined(_M_ALPHA)
#define MACHINE_TYPE "axp"
#else
#define MACHINE_TYPE "unknown" /* Define to machine type name */
#endif
#if !(defined(_WIN64) || defined(WIN64))
#ifndef _WIN32
#define _WIN32 /* Compatible with old source */
#endif
#ifndef __WIN32__
#define __WIN32__
#endif
#endif /* _WIN64 */
#ifndef __WIN__
#define __WIN__ /* To make it easier in VC++ */
#endif
#ifndef MAX_INDEXES
#define MAX_INDEXES 64
#endif
/* File and lock constants */
#define O_SHARE 0x1000 /* Open file in sharing mode */
#ifdef __BORLANDC__
#define F_RDLCK LK_NBLCK /* read lock */
#define F_WRLCK LK_NBRLCK /* write lock */
#define F_UNLCK LK_UNLCK /* remove lock(s) */
#else
#define F_RDLCK _LK_NBLCK /* read lock */
#define F_WRLCK _LK_NBRLCK /* write lock */
#define F_UNLCK _LK_UNLCK /* remove lock(s) */
#endif
#define F_EXCLUSIVE 1 /* We have only exclusive locking */
#define F_TO_EOF (INT_MAX32/2) /* size for lock of all file */
#define F_OK 0 /* parameter to access() */
#define W_OK 2
#define S_IROTH S_IREAD /* for my_lib */
#ifdef __BORLANDC__
#define FILE_BINARY O_BINARY /* my_fopen in binary mode */
#define O_TEMPORARY 0
#define O_SHORT_LIVED 0
#define SH_DENYNO _SH_DENYNO
#else
#define O_BINARY _O_BINARY /* compability with MSDOS */
#define FILE_BINARY _O_BINARY /* my_fopen in binary mode */
#define O_TEMPORARY _O_TEMPORARY
#define O_SHORT_LIVED _O_SHORT_LIVED
#define SH_DENYNO _SH_DENYNO
#endif
#define NO_OPEN_3 /* For my_create() */
#define SIGQUIT SIGTERM /* No SIGQUIT */
#undef _REENTRANT /* Crashes something for win32 */
#undef SAFE_MUTEX /* Can't be used on windows */
#if defined(_MSC_VER) && _MSC_VER >= 1310
#define LL(A) A##ll
#define ULL(A) A##ull
#else
#define LL(A) ((__int64) A)
#define ULL(A) ((unsigned __int64) A)
#endif
#define LONGLONG_MIN LL(0x8000000000000000)
#define LONGLONG_MAX LL(0x7FFFFFFFFFFFFFFF)
#define ULONGLONG_MAX ULL(0xFFFFFFFFFFFFFFFF)
/* Type information */
#if defined(__EMX__) || !defined(HAVE_UINT)
#undef HAVE_UINT
#define HAVE_UINT
typedef unsigned short ushort;
typedef unsigned int uint;
#endif /* defined(__EMX__) || !defined(HAVE_UINT) */
typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
typedef __int64 longlong;
#ifndef HAVE_SIGSET_T
typedef int sigset_t;
#endif
#define longlong_defined
/*
off_t should not be __int64 because of conflicts in header files;
Use my_off_t or os_off_t instead
*/
#ifndef HAVE_OFF_T
typedef long off_t;
#endif
typedef __int64 os_off_t;
#ifdef _WIN64
typedef UINT_PTR rf_SetTimer;
#else
#ifndef HAVE_SIZE_T
typedef unsigned int size_t;
#endif
typedef uint rf_SetTimer;
#endif
#define Socket_defined
#define my_socket SOCKET
#define bool BOOL
#define SIGPIPE SIGINT
#define RETQSORTTYPE void
#define QSORT_TYPE_IS_VOID
#define RETSIGTYPE void
#define SOCKET_SIZE_TYPE int
#define my_socket_defined
#define bool_defined
#define byte_defined
#define HUGE_PTR
#define STDCALL __stdcall /* Used by libmysql.dll */
#define isnan(X) _isnan(X)
#define finite(X) _finite(X)
#ifndef UNDEF_THREAD_HACK
#define THREAD
#endif
#define VOID_SIGHANDLER
#define SIZEOF_CHAR 1
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_OFF_T 8
#ifdef _WIN64
#define SIZEOF_CHARP 8
#else
#define SIZEOF_CHARP 4
#endif
#define HAVE_BROKEN_NETINET_INCLUDES
#ifdef __NT__
#define HAVE_NAMED_PIPE /* We can only create pipes on NT */
#endif
/* ERROR is defined in wingdi.h */
#undef ERROR
/* We need to close files to break connections on shutdown */
#ifndef SIGNAL_WITH_VIO_CLOSE
#define SIGNAL_WITH_VIO_CLOSE
#endif
/* Use all character sets in MySQL */
#define USE_MB 1
#define USE_MB_IDENT 1
#define USE_STRCOLL 1
/* All windows servers should support .sym files */
#undef USE_SYMDIR
#define USE_SYMDIR
/* If LOAD DATA LOCAL INFILE should be enabled by default */
#define ENABLED_LOCAL_INFILE 1
/* Convert some simple functions to Posix */
#define my_sigset(A,B) signal((A),(B))
#define finite(A) _finite(A)
#define sleep(A) Sleep((A)*1000)
#define popen(A,B) _popen((A),(B))
#define pclose(A) _pclose(A)
#ifndef __BORLANDC__
#define access(A,B) _access(A,B)
#endif
#if !defined(__cplusplus)
#define inline __inline
#endif /* __cplusplus */
inline double rint(double nr)
{
double f = floor(nr);
double c = ceil(nr);
return (((c-nr) >= (nr-f)) ? f :c);
}
#ifdef _WIN64
#define ulonglong2double(A) ((double) (ulonglong) (A))
#define my_off_t2double(A) ((double) (my_off_t) (A))
#else
inline double ulonglong2double(ulonglong value)
{
longlong nr=(longlong) value;
if (nr >= 0)
return (double) nr;
return (18446744073709551616.0 + (double) nr);
}
#define my_off_t2double(A) ulonglong2double(A)
#endif /* _WIN64 */
#if SIZEOF_OFF_T > 4
#define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C))
#define tell(A) _telli64(A)
#endif
#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time((time_t*)0) + (time_t) (SEC); (ABSTIME).tv_nsec=0; }
#define STACK_DIRECTION -1
/* Optimized store functions for Intel x86 */
#ifndef _WIN64
#define sint2korr(A) (*((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) (*((long *) (A)))
#define uint2korr(A) (*((uint16 *) (A)))
/*
ATTENTION !
Please, note, uint3korr reads 4 bytes (not 3) !
It means, that you have to provide enough allocated space !
*/
#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
#define uint4korr(A) (*((unsigned long *) (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 uint8korr(A) (*((ulonglong *) (A)))
#define sint8korr(A) (*((longlong *) (A)))
#define int2store(T,A) *((uint16*) (T))= (uint16) (A)
#define int3store(T,A) { *(T)= (uchar) ((A));\
*(T+1)=(uchar) (((uint) (A) >> 8));\
*(T+2)=(uchar) (((A) >> 16)); }
#define int4store(T,A) *((long *) (T))= (long) (A)
#define int5store(T,A) { *(T)= (uchar)((A));\
*((T)+1)=(uchar) (((A) >> 8));\
*((T)+2)=(uchar) (((A) >> 16));\
*((T)+3)=(uchar) (((A) >> 24)); \
*((T)+4)=(uchar) (((A) >> 32)); }
#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
#define doubleget(V,M) do { *((long *) &V) = *((long*) M); \
*(((long *) &V)+1) = *(((long*) M)+1); } while(0)
#define doublestore(T,V) do { *((long *) T) = *((long*) &V); \
*(((long *) T)+1) = *(((long*) &V)+1); } while(0)
#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
#define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V), sizeof(float))
#define floatget(V,M) memcpy((byte*)(&V), (byte*)(M), sizeof(float))
#define float8get(V,M) doubleget((V),(M))
#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
#define float8store(V,M) doublestore((V),(M))
#endif /* _WIN64 */
#define HAVE_PERROR
#define HAVE_VFPRINT
#define HAVE_RENAME /* Have rename() as function */
#define HAVE_BINARY_STREAMS /* Have "b" flag in streams */
#define HAVE_LONG_JMP /* Have long jump function */
#define HAVE_LOCKING /* have locking() call */
#define HAVE_ERRNO_AS_DEFINE /* errno is a define */
#define HAVE_STDLIB /* everything is include in this file */
#define HAVE_MEMCPY
#define HAVE_MEMMOVE
#define HAVE_GETCWD
#define HAVE_TELL
#define HAVE_TZNAME
#define HAVE_PUTENV
#define HAVE_SELECT
#define HAVE_SETLOCALE
#define HAVE_SOCKET /* Giangi */
#define HAVE_FLOAT_H
#define HAVE_LIMITS_H
#define HAVE_STDDEF_H
#define HAVE_RINT /* defined in this file */
#define NO_FCNTL_NONBLOCK /* No FCNTL */
#define HAVE_ALLOCA
#define HAVE_STRPBRK
#define HAVE_STRSTR
#define HAVE_COMPRESS
#define HAVE_CREATESEMAPHORE
#define HAVE_ISNAN
#define HAVE_FINITE
#define HAVE_QUERY_CACHE
#define SPRINTF_RETURNS_INT
#define HAVE_SETFILEPOINTER
#define HAVE_VIO_READ_BUFF
#define HAVE_STRNLEN
#ifndef __NT__
#undef FILE_SHARE_DELETE
#define FILE_SHARE_DELETE 0 /* Not implemented on Win 98/ME */
#endif
#ifdef NOT_USED
#define HAVE_SNPRINTF /* Gave link error */
#define _snprintf snprintf
#endif
#ifdef _MSC_VER
#define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */
#define HAVE_ANSI_INCLUDE
#define HAVE_SYS_UTIME_H
#define HAVE_STRTOUL
#endif
#define my_reinterpret_cast(A) reinterpret_cast <A>
#define my_const_cast(A) const_cast<A>
/* MYSQL OPTIONS */
#ifdef _CUSTOMCONFIG_
#include <custom_conf.h>
#else
#define DEFAULT_MYSQL_HOME "c:\\mysql"
#define PACKAGE "mysql"
#define DEFAULT_BASEDIR "C:\\"
#define SHAREDIR "share"
#define DEFAULT_CHARSET_HOME "C:/mysql/"
#endif
#ifndef DEFAULT_HOME_ENV
#define DEFAULT_HOME_ENV MYSQL_HOME
#endif
#ifndef DEFAULT_GROUP_SUFFIX_ENV
#define DEFAULT_GROUP_SUFFIX_ENV MYSQL_GROUP_SUFFIX
#endif
/* File name handling */
#define FN_LIBCHAR '\\'
#define FN_ROOTDIR "\\"
#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
#define FN_NO_CASE_SENCE /* Files are not case-sensitive */
#define OS_FILE_LIMIT 2048
#define DO_NOT_REMOVE_THREAD_WRAPPERS
#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
#define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V))
/* The following is only used for statistics, so it should be good enough */
#ifdef __NT__ /* This should also work on Win98 but .. */
#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
#define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C))
#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
#else
#define thread_safe_add(V,C,L) \
pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
#define thread_safe_sub(V,C,L) \
pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
#define statistic_add(V,C,L) (V)+=(C)
#endif
#define statistic_increment(V,L) thread_safe_increment((V),(L))
#define statistic_decrement(V,L) thread_safe_decrement((V),(L))
#define shared_memory_buffer_length 16000
#define default_shared_memory_base_name "MYSQL"
#ifdef CYBOZU
#define MYSQL_DEFAULT_CHARSET_NAME "utf8"
#define MYSQL_DEFAULT_COLLATION_NAME "utf8_general_cs"
#define HAVE_UTF8_GENERAL_CS 1
#else
#define MYSQL_DEFAULT_CHARSET_NAME "latin1"
#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
#endif
#define HAVE_SPATIAL 1
#define HAVE_RTREE_KEYS 1
#define HAVE_OPENSSL 1
#define HAVE_YASSL 1
/* Define charsets you want */
/* #undef HAVE_CHARSET_armscii8 */
/* #undef HAVE_CHARSET_ascii */
#ifndef CYBOZU
#define HAVE_CHARSET_big5 1
#define HAVE_CHARSET_cp1250 1
#endif
/* #undef HAVE_CHARSET_cp1251 */
/* #undef HAVE_CHARSET_cp1256 */
/* #undef HAVE_CHARSET_cp1257 */
/* #undef HAVE_CHARSET_cp850 */
/* #undef HAVE_CHARSET_cp852 */
/* #undef HAVE_CHARSET_cp866 */
#define HAVE_CHARSET_cp932 1
/* #undef HAVE_CHARSET_dec8 */
#ifndef CYBOZU
#define HAVE_CHARSET_eucjpms 1
#define HAVE_CHARSET_euckr 1
#define HAVE_CHARSET_gb2312 1
#define HAVE_CHARSET_gbk 1
#endif
/* #undef HAVE_CHARSET_greek */
/* #undef HAVE_CHARSET_hebrew */
/* #undef HAVE_CHARSET_hp8 */
/* #undef HAVE_CHARSET_keybcs2 */
/* #undef HAVE_CHARSET_koi8r */
/* #undef HAVE_CHARSET_koi8u */
#ifndef CYBOZU
#define HAVE_CHARSET_latin1 1
#define HAVE_CHARSET_latin2 1
#endif
/* #undef HAVE_CHARSET_latin5 */
/* #undef HAVE_CHARSET_latin7 */
/* #undef HAVE_CHARSET_macce */
/* #undef HAVE_CHARSET_macroman */
#define HAVE_CHARSET_sjis 1
/* #undef HAVE_CHARSET_swe7 */
#ifndef CYBOZU
#define HAVE_CHARSET_tis620 1
#define HAVE_CHARSET_ucs2 1
#define HAVE_CHARSET_ujis 1
#endif
#define HAVE_CHARSET_utf8 1
#define HAVE_UCA_COLLATIONS 1

137
3rdparty/mysql/include/decimal.h vendored Normal file
View File

@ -0,0 +1,137 @@
/* Copyright (c) 2000, 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef DECIMAL_INCLUDED
#define DECIMAL_INCLUDED
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;
#ifndef MYSQL_ABI_CHECK
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(decimal_t *from, ulonglong *to);
int ulonglong2decimal(ulonglong from, decimal_t *to);
int decimal2longlong(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(decimal_t *from);
int decimal2bin(decimal_t *from, uchar *to, int precision, int scale);
int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale);
/**
Convert decimal to lldiv_t.
The integer part is stored in to->quot.
The fractional part is multiplied to 10^9 and stored to to->rem.
@param from Decimal value
@param to lldiv_t value
@retval 0 on success
@retval !0 in error
*/
int decimal2lldiv_t(const decimal_t *from, lldiv_t *to);
/**
Convert doube to lldiv_t.
The integer part is stored in to->quot.
The fractional part is multiplied to 10^9 and stored to to->rem.
@param from Decimal value
@param to lldiv_t value
@retval 0 on success
@retval !0 in error
*/
int double2lldiv_t(double from, lldiv_t *to);
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)
/*
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
#endif // !MYSQL_ABI_CHECK
#endif

113
3rdparty/mysql/include/errmsg.h vendored Normal file
View File

@ -0,0 +1,113 @@
#ifndef ERRMSG_INCLUDED
#define ERRMSG_INCLUDED
/* Copyright (c) 2000, 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/* Error messages for MySQL clients */
/* (Error messages for the 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_UNUSED_1 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_INSECURE_API_ERR 2062
#define CR_ERROR_LAST /*Copy last error nr:*/ 2062
/* Add error numbers before CR_ERROR_LAST and change it accordingly. */
#endif /* ERRMSG_INCLUDED */

156
3rdparty/mysql/include/keycache.h vendored Normal file
View File

@ -0,0 +1,156 @@
/* Copyright (c) 2003, 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/* Key cache variable structures */
#ifndef _keycache_h
#define _keycache_h
#include "my_sys.h" /* flush_type */
C_MODE_START
/* declare structures that is used by st_key_cache */
struct st_block_link;
typedef struct st_block_link BLOCK_LINK;
struct st_hash_link;
typedef struct st_hash_link HASH_LINK;
/* Thread specific variables */
typedef struct st_keycache_thread_var
{
mysql_cond_t suspend;
struct st_keycache_thread_var *next,**prev;
void *opt_info;
} st_keycache_thread_var;
/* info about requests in a waiting queue */
typedef struct st_keycache_wqueue
{
st_keycache_thread_var *last_thread; /* circular list of waiting threads */
} KEYCACHE_WQUEUE;
#define CHANGED_BLOCKS_HASH 128 /* must be power of 2 */
/*
The key cache structure
It also contains read-only statistics parameters.
*/
typedef struct st_key_cache
{
my_bool key_cache_inited;
my_bool in_resize; /* true during resize operation */
my_bool resize_in_flush; /* true during flush of resize operation */
my_bool can_be_used; /* usage of cache for read/write is allowed */
size_t key_cache_mem_size; /* specified size of the cache memory */
uint key_cache_block_size; /* size of the page buffer of a cache block */
ulonglong min_warm_blocks; /* min number of warm blocks; */
ulonglong age_threshold; /* age threshold for hot blocks */
ulonglong keycache_time; /* total number of block link operations */
uint hash_entries; /* max number of entries in the hash table */
int hash_links; /* max number of hash links */
int hash_links_used; /* number of hash links currently used */
int disk_blocks; /* max number of blocks in the cache */
ulong blocks_used; /* maximum number of concurrently used blocks */
ulong blocks_unused; /* number of currently unused blocks */
ulong blocks_changed; /* number of currently dirty blocks */
ulong warm_blocks; /* number of blocks in warm sub-chain */
ulong cnt_for_resize_op; /* counter to block resize operation */
long blocks_available; /* number of blocks available in the LRU chain */
HASH_LINK **hash_root; /* arr. of entries into hash table buckets */
HASH_LINK *hash_link_root; /* memory for hash table links */
HASH_LINK *free_hash_list; /* list of free hash links */
BLOCK_LINK *free_block_list; /* list of free blocks */
BLOCK_LINK *block_root; /* memory for block links */
uchar *block_mem; /* memory for block buffers */
BLOCK_LINK *used_last; /* ptr to the last block of the LRU chain */
BLOCK_LINK *used_ins; /* ptr to the insertion block in LRU chain */
mysql_mutex_t cache_lock; /* to lock access to the cache structure */
KEYCACHE_WQUEUE resize_queue; /* threads waiting during resize operation */
/*
Waiting for a zero resize count. Using a queue for symmetry though
only one thread can wait here.
*/
KEYCACHE_WQUEUE waiting_for_resize_cnt;
KEYCACHE_WQUEUE waiting_for_hash_link; /* waiting for a free hash link */
KEYCACHE_WQUEUE waiting_for_block; /* requests waiting for a free block */
BLOCK_LINK *changed_blocks[CHANGED_BLOCKS_HASH]; /* hash for dirty file bl.*/
BLOCK_LINK *file_blocks[CHANGED_BLOCKS_HASH]; /* hash for other file bl.*/
/*
The following variables are and variables used to hold parameters for
initializing 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 */
/* Statistics variables. These are reset in reset_key_cache_counters(). */
ulong global_blocks_changed; /* number of currently dirty blocks */
ulonglong global_cache_w_requests;/* number of write requests (write hits) */
ulonglong global_cache_write; /* number of writes from cache to files */
ulonglong global_cache_r_requests;/* number of read requests (read hits) */
ulonglong global_cache_read; /* number of reads from files to cache */
int blocks; /* max number of blocks in the cache */
my_bool in_init; /* Set to 1 in MySQL during init/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, ulonglong key_cache_block_size,
size_t use_mem, ulonglong division_limit,
ulonglong age_threshold);
extern int resize_key_cache(KEY_CACHE *keycache,
st_keycache_thread_var *thread_var,
ulonglong key_cache_block_size,
size_t use_mem, ulonglong division_limit,
ulonglong age_threshold);
extern uchar *key_cache_read(KEY_CACHE *keycache,
st_keycache_thread_var *thread_var,
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,
st_keycache_thread_var *thread_var,
File file, my_off_t filepos, int level,
uchar *buff, uint length);
extern int key_cache_write(KEY_CACHE *keycache,
st_keycache_thread_var *thread_var,
File file, my_off_t filepos, int level,
uchar *buff, uint length,
uint block_length,int force_write);
extern int flush_key_blocks(KEY_CACHE *keycache,
st_keycache_thread_var *thread_var,
int file, enum flush_type type);
extern void end_key_cache(KEY_CACHE *keycache, my_bool cleanup);
/* 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);
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);
C_MODE_END
#endif /* _keycache_h */

93
3rdparty/mysql/include/little_endian.h vendored Normal file
View File

@ -0,0 +1,93 @@
#ifndef LITTLE_ENDIAN_INCLUDED
#define LITTLE_ENDIAN_INCLUDED
/* 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
Data in little-endian format.
*/
#include <string.h>
static inline void float4get (float *V, const uchar *M)
{
memcpy(V, (M), sizeof(float));
}
static inline void float4store(uchar *V, float M)
{
memcpy(V, (&M), sizeof(float));
}
static inline void float8get (double *V, const uchar *M)
{
memcpy(V, M, sizeof(double));
}
static inline void float8store(uchar *V, double M)
{
memcpy(V, &M, sizeof(double));
}
static inline void floatget (float *V, const uchar *M) { float4get(V, M); }
static inline void floatstore (uchar *V, float M) { float4store(V, M); }
/* Bi-endian hardware.... */
#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
static inline void doublestore(uchar *T, double V)
{ *(((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]; }
static inline void doubleget(double *V, const uchar *M)
{ 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; }
#else /* Bi-endian hardware.... */
static inline void doublestore(uchar *T, double V) { memcpy(T, &V, sizeof(double)); }
static inline void doubleget (double *V, const uchar *M) { memcpy(V, M, sizeof(double)); }
#endif /* Bi-endian hardware.... */
static inline void ushortget(uint16 *V, const uchar *pM) { *V= uint2korr(pM); }
static inline void shortget (int16 *V, const uchar *pM) { *V= sint2korr(pM); }
static inline void longget (int32 *V, const uchar *pM) { *V= sint4korr(pM); }
static inline void ulongget (uint32 *V, const uchar *pM) { *V= uint4korr(pM); }
static inline void shortstore(uchar *T, int16 V) { int2store(T, V); }
static inline void longstore (uchar *T, int32 V) { int4store(T, V); }
static inline void longlongget(longlong *V, const uchar *M)
{
memcpy(V, (M), sizeof(ulonglong));
}
static inline void longlongstore(uchar *T, longlong V)
{
memcpy((T), &V, sizeof(ulonglong));
}
#endif /* LITTLE_ENDIAN_INCLUDED */

View File

@ -1,9 +1,8 @@
/* Copyright (C) 2000 MySQL AB
/* 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; either version 2 of the License, or
(at your option) any later version.
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -12,16 +11,17 @@
You 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 */
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
A better inplementation of the UNIX ctype(3) library.
Notes: my_global.h should be included before ctype.h
*/
#ifndef _m_ctype_h
#define _m_ctype_h
#include "my_global.h" /* uint16, uchar */
#ifdef __cplusplus
extern "C" {
#endif
@ -37,17 +37,113 @@ extern "C" {
#define my_wc_t ulong
#define MY_CS_REPLACEMENT_CHARACTER 0xFFFD
/*
On i386 we store Unicode->CS conversion tables for
some character sets using Big-endian order,
to copy two bytes at onces.
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 struct unicase_info_char_st
{
uint32 toupper;
uint32 tolower;
uint32 sort;
} MY_UNICASE_CHARACTER;
typedef struct unicase_info_st
{
uint16 toupper;
uint16 tolower;
uint16 sort;
my_wc_t maxchar;
const MY_UNICASE_CHARACTER **page;
} MY_UNICASE_INFO;
extern MY_UNICASE_INFO *my_unicase_default[256];
extern MY_UNICASE_INFO *my_unicase_turkish[256];
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
#define MY_UCA_MAX_WEIGHT_SIZE 8
#define MY_UCA_WEIGHT_LEVELS 1
typedef struct my_contraction_t
{
my_wc_t ch[MY_UCA_MAX_CONTRACTION]; /* Character sequence */
uint16 weight[MY_UCA_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;
} 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;
typedef struct uni_ctype_st
{
uchar pctype;
uchar *ctype;
} MY_UNI_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 */
@ -73,79 +169,123 @@ extern MY_UNICASE_INFO *my_unicase_turkish[256];
#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 full unicode */
#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_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_CHARSET_UNDEFINED 0
/* Character repertoire flags */
#define MY_REPERTOIRE_ASCII 1 /* Pure ASCII U+0000..U+007F */
#define MY_REPERTOIRE_EXTENDED 2 /* Extended characters: U+0080..U+FFFF */
#define MY_REPERTOIRE_UNICODE30 3 /* ASCII | EXTENDED: U+0000..U+FFFF */
/* 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
typedef struct my_uni_idx_st
{
uint16 from;
uint16 to;
uchar *tab;
uint16 from;
uint16 to;
const uchar *tab;
} MY_UNI_IDX;
typedef struct
{
uint beg;
uint end;
uint mblen;
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
};
struct charset_info_st;
typedef struct my_charset_loader_st
{
char error[128];
void *(*once_alloc)(size_t);
void *(*mem_malloc)(size_t);
void *(*mem_realloc)(void *, size_t);
void (*mem_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 */
typedef struct my_collation_handler_st
{
my_bool (*init)(struct charset_info_st *, void *(*alloc)(uint));
my_bool (*init)(struct charset_info_st *, MY_CHARSET_LOADER *);
/* Collation routines */
int (*strnncoll)(struct charset_info_st *,
const uchar *, uint, const uchar *, uint, my_bool);
int (*strnncollsp)(struct charset_info_st *,
const uchar *, uint, const uchar *, uint,
int (*strnncoll)(const struct charset_info_st *,
const uchar *, size_t, const uchar *, size_t, my_bool);
int (*strnncollsp)(const struct charset_info_st *,
const uchar *, size_t, const uchar *, size_t,
my_bool diff_if_only_endspace_difference);
int (*strnxfrm)(struct charset_info_st *,
uchar *, uint, const uchar *, uint);
uint (*strnxfrmlen)(struct charset_info_st *, uint);
my_bool (*like_range)(struct charset_info_st *,
const char *s, uint s_length,
size_t (*strnxfrm)(const struct charset_info_st *,
uchar *dst, size_t dstlen, uint nweights,
const uchar *src, size_t srclen, uint flags);
size_t (*strnxfrmlen)(const struct charset_info_st *, size_t);
my_bool (*like_range)(const struct charset_info_st *,
const char *s, size_t s_length,
pchar w_prefix, pchar w_one, pchar w_many,
uint res_length,
size_t res_length,
char *min_str, char *max_str,
uint *min_len, uint *max_len);
int (*wildcmp)(struct charset_info_st *,
size_t *min_len, size_t *max_len);
int (*wildcmp)(const struct charset_info_st *,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
int escape,int w_one, int w_many);
int (*strcasecmp)(struct charset_info_st *, const char *, const char *);
int (*strcasecmp)(const struct charset_info_st *, const char *,
const char *);
uint (*instr)(struct charset_info_st *,
const char *b, uint b_length,
const char *s, uint s_length,
uint (*instr)(const struct charset_info_st *,
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)(struct charset_info_st *cs, const uchar *key, uint len,
ulong *nr1, ulong *nr2);
my_bool (*propagate)(struct charset_info_st *cs, const uchar *str, uint len);
void (*hash_sort)(const struct charset_info_st *cs, const uchar *key,
size_t len, ulong *nr1, ulong *nr2);
my_bool (*propagate)(const struct charset_info_st *cs, const uchar *str,
size_t len);
} MY_COLLATION_HANDLER;
extern MY_COLLATION_HANDLER my_collation_mb_bin_handler;
@ -153,66 +293,95 @@ 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_ucs2_uca_handler;
/* Some typedef to make it easy for C++ to make function pointers */
typedef int (*my_charset_conv_mb_wc)(const struct charset_info_st *,
my_wc_t *, const uchar *, const uchar *);
typedef int (*my_charset_conv_wc_mb)(const struct charset_info_st *, my_wc_t,
uchar *, uchar *);
typedef size_t (*my_charset_conv_case)(const struct charset_info_st *,
char *, size_t, char *, size_t);
/* See strings/CHARSET_INFO.txt about information on this structure */
typedef struct my_charset_handler_st
{
my_bool (*init)(struct charset_info_st *, void *(*alloc)(uint));
my_bool (*init)(struct charset_info_st *, MY_CHARSET_LOADER *loader);
/* Multibyte routines */
int (*ismbchar)(struct charset_info_st *, const char *, const char *);
int (*mbcharlen)(struct charset_info_st *, uint);
uint (*numchars)(struct charset_info_st *, const char *b, const char *e);
uint (*charpos)(struct charset_info_st *, const char *b, const char *e, uint pos);
uint (*well_formed_len)(struct charset_info_st *,
uint (*ismbchar)(const struct charset_info_st *, const char *,
const char *);
uint (*mbcharlen)(const struct charset_info_st *, uint c);
size_t (*numchars)(const struct charset_info_st *, const char *b,
const char *e);
size_t (*charpos)(const struct charset_info_st *, const char *b,
const char *e, size_t pos);
size_t (*well_formed_len)(const struct charset_info_st *,
const char *b,const char *e,
uint nchars, int *error);
uint (*lengthsp)(struct charset_info_st *, const char *ptr, uint length);
uint (*numcells)(struct charset_info_st *, const char *b, const char *e);
size_t nchars, int *error);
size_t (*lengthsp)(const struct charset_info_st *, const char *ptr,
size_t length);
size_t (*numcells)(const struct charset_info_st *, const char *b,
const char *e);
/* Unicode convertion */
int (*mb_wc)(struct charset_info_st *cs,my_wc_t *wc,
const unsigned char *s,const unsigned char *e);
int (*wc_mb)(struct charset_info_st *cs,my_wc_t wc,
unsigned char *s,unsigned char *e);
/* Functions for case and sort convertion */
void (*caseup_str)(struct charset_info_st *, char *);
void (*casedn_str)(struct charset_info_st *, char *);
uint (*caseup)(struct charset_info_st *, char *src, uint srclen,
char *dst, uint dstlen);
uint (*casedn)(struct charset_info_st *, char *src, uint srclen,
char *dst, uint dstlen);
/* Unicode conversion */
my_charset_conv_mb_wc mb_wc;
my_charset_conv_wc_mb wc_mb;
/* CTYPE scanner */
int (*ctype)(const struct charset_info_st *cs, int *ctype,
const uchar *s, const uchar *e);
/* Functions for case and sort conversion */
size_t (*caseup_str)(const struct charset_info_st *, char *);
size_t (*casedn_str)(const struct charset_info_st *, char *);
my_charset_conv_case caseup;
my_charset_conv_case casedn;
/* Charset dependant snprintf() */
int (*snprintf)(struct charset_info_st *, char *to, uint n, const char *fmt,
...);
int (*long10_to_str)(struct charset_info_st *, char *to, uint n, int radix,
long int val);
int (*longlong10_to_str)(struct charset_info_st *, char *to, uint n,
int radix, longlong val);
size_t (*snprintf)(const struct charset_info_st *, char *to, size_t n,
const char *fmt,
...) MY_ATTRIBUTE((format(printf, 4, 5)));
size_t (*long10_to_str)(const struct charset_info_st *, char *to, size_t n,
int radix, long int val);
size_t (*longlong10_to_str)(const struct charset_info_st *, char *to,
size_t n, int radix, longlong val);
void (*fill)(struct charset_info_st *, char *to, uint len, int fill);
void (*fill)(const struct charset_info_st *, char *to, size_t len,
int fill);
/* String-to-number convertion routines */
long (*strntol)(struct charset_info_st *, const char *s, uint l,
int base, char **e, int *err);
ulong (*strntoul)(struct charset_info_st *, const char *s, uint l,
int base, char **e, int *err);
longlong (*strntoll)(struct charset_info_st *, const char *s, uint l,
int base, char **e, int *err);
ulonglong (*strntoull)(struct charset_info_st *, const char *s, uint l,
int base, char **e, int *err);
double (*strntod)(struct charset_info_st *, char *s, uint l, char **e,
int *err);
longlong (*strtoll10)(struct charset_info_st *cs,
/* String-to-number conversion routines */
long (*strntol)(const struct charset_info_st *, const char *s,
size_t l, int base, char **e, int *err);
ulong (*strntoul)(const struct charset_info_st *, const char *s,
size_t l, int base, char **e, int *err);
longlong (*strntoll)(const struct charset_info_st *, const char *s,
size_t l, int base, char **e, int *err);
ulonglong (*strntoull)(const struct charset_info_st *, const char *s,
size_t l, int base, char **e, int *err);
double (*strntod)(const struct charset_info_st *, char *s,
size_t l, char **e, int *err);
longlong (*strtoll10)(const struct charset_info_st *cs,
const char *nptr, char **endptr, int *error);
ulong (*scan)(struct charset_info_st *, const char *b, const char *e,
int sq);
ulonglong (*strntoull10rnd)(const struct charset_info_st *cs,
const char *str, size_t length,
int unsigned_fl,
char **endptr, int *error);
size_t (*scan)(const struct charset_info_st *, const char *b,
const char *e, int sq);
} MY_CHARSET_HANDLER;
extern MY_CHARSET_HANDLER my_charset_8bit_handler;
extern MY_CHARSET_HANDLER my_charset_ascii_handler;
extern MY_CHARSET_HANDLER my_charset_ucs2_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 */
typedef struct charset_info_st
{
uint number;
@ -223,38 +392,45 @@ typedef struct charset_info_st
const char *name;
const char *comment;
const char *tailoring;
uchar *ctype;
uchar *to_lower;
uchar *to_upper;
uchar *sort_order;
uint16 *contractions;
uint16 **sort_order_big;
uint16 *tab_to_uni;
MY_UNI_IDX *tab_from_uni;
MY_UNICASE_INFO **caseinfo;
uchar *state_map;
uchar *ident_map;
const uchar *ctype;
const uchar *to_lower;
const uchar *to_upper;
const uchar *sort_order;
MY_UCA_INFO *uca; /* This can be changed in apply_one_rule() */
const uint16 *tab_to_uni;
const MY_UNI_IDX *tab_from_uni;
const MY_UNICASE_INFO *caseinfo;
const struct lex_state_maps_st *state_maps; /* parser internal data */
const uchar *ident_map; /* parser internal data */
uint strxfrm_multiply;
uchar caseup_multiply;
uchar casedn_multiply;
uint mbminlen;
uint mbmaxlen;
uint16 min_sort_char;
uint16 max_sort_char; /* For LIKE optimization */
uint mbmaxlenlen;
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_compare;
uchar levels_for_order;
MY_CHARSET_HANDLER *cset;
MY_COLLATION_HANDLER *coll;
} CHARSET_INFO;
#define ILLEGAL_CHARSET_INFO_NUMBER (~0U)
extern CHARSET_INFO my_charset_bin;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_bin;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_filename;
extern CHARSET_INFO my_charset_big5_chinese_ci;
extern CHARSET_INFO my_charset_big5_bin;
extern CHARSET_INFO my_charset_cp932_japanese_ci;
extern CHARSET_INFO my_charset_cp932_bin;
extern CHARSET_INFO my_charset_cp1250_czech_ci;
extern CHARSET_INFO my_charset_eucjpms_japanese_ci;
extern CHARSET_INFO my_charset_eucjpms_bin;
extern CHARSET_INFO my_charset_euckr_korean_ci;
@ -263,7 +439,8 @@ extern CHARSET_INFO my_charset_gb2312_chinese_ci;
extern CHARSET_INFO my_charset_gb2312_bin;
extern CHARSET_INFO my_charset_gbk_chinese_ci;
extern CHARSET_INFO my_charset_gbk_bin;
extern CHARSET_INFO my_charset_latin1;
extern CHARSET_INFO my_charset_gb18030_chinese_ci;
extern CHARSET_INFO my_charset_gb18030_bin;
extern CHARSET_INFO my_charset_latin1_german2_ci;
extern CHARSET_INFO my_charset_latin1_bin;
extern CHARSET_INFO my_charset_latin2_czech_ci;
@ -273,152 +450,267 @@ extern CHARSET_INFO my_charset_tis620_thai_ci;
extern CHARSET_INFO my_charset_tis620_bin;
extern CHARSET_INFO my_charset_ucs2_general_ci;
extern CHARSET_INFO my_charset_ucs2_bin;
extern CHARSET_INFO my_charset_ucs2_general_uca;
extern CHARSET_INFO my_charset_ucs2_unicode_ci;
extern CHARSET_INFO my_charset_ucs2_general_mysql500_ci;
extern CHARSET_INFO my_charset_ujis_japanese_ci;
extern CHARSET_INFO my_charset_ujis_bin;
extern CHARSET_INFO my_charset_utf8_general_ci;
extern CHARSET_INFO my_charset_utf16_bin;
extern CHARSET_INFO my_charset_utf16_general_ci;
extern CHARSET_INFO my_charset_utf16_unicode_ci;
extern CHARSET_INFO my_charset_utf16le_bin;
extern CHARSET_INFO my_charset_utf16le_general_ci;
extern CHARSET_INFO my_charset_utf32_bin;
extern CHARSET_INFO my_charset_utf32_general_ci;
extern CHARSET_INFO my_charset_utf32_unicode_ci;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8_general_ci;
extern CHARSET_INFO my_charset_utf8_tolower_ci;
extern CHARSET_INFO my_charset_utf8_unicode_ci;
extern CHARSET_INFO my_charset_utf8_bin;
extern CHARSET_INFO my_charset_cp1250_czech_ci;
extern CHARSET_INFO my_charset_utf8_general_mysql500_ci;
extern CHARSET_INFO my_charset_utf8mb4_bin;
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_utf8mb4_general_ci;
extern CHARSET_INFO my_charset_utf8mb4_unicode_ci;
#define MY_UTF8MB3 "utf8"
#define MY_UTF8MB4 "utf8mb4"
/* declarations for simple charsets */
extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *,
uint);
uint my_strnxfrmlen_simple(CHARSET_INFO *, uint);
extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint,
const uchar *, uint, my_bool);
extern size_t my_strnxfrm_simple(const CHARSET_INFO *,
uchar *dst, size_t dstlen, uint nweights,
const uchar *src, size_t srclen, uint flags);
size_t my_strnxfrmlen_simple(const CHARSET_INFO *, size_t);
extern int my_strnncoll_simple(const CHARSET_INFO *, const uchar *, size_t,
const uchar *, size_t, my_bool);
extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, uint,
const uchar *, uint,
extern int my_strnncollsp_simple(const CHARSET_INFO *, const uchar *, size_t,
const uchar *, size_t,
my_bool diff_if_only_endspace_difference);
extern void my_hash_sort_simple(CHARSET_INFO *cs,
const uchar *key, uint len,
extern void my_hash_sort_simple(const CHARSET_INFO *cs,
const uchar *key, size_t len,
ulong *nr1, ulong *nr2);
extern uint my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, uint length);
extern size_t my_lengthsp_8bit(const CHARSET_INFO *cs, const char *ptr,
size_t length);
extern uint my_instr_simple(struct charset_info_st *,
const char *b, uint b_length,
const char *s, uint s_length,
extern uint my_instr_simple(const struct charset_info_st *,
const char *b, size_t b_length,
const char *s, size_t s_length,
my_match_t *match, uint nmatch);
/* Functions for 8bit */
extern void my_caseup_str_8bit(CHARSET_INFO *, char *);
extern void my_casedn_str_8bit(CHARSET_INFO *, char *);
extern uint my_caseup_8bit(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern uint my_casedn_8bit(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern size_t my_caseup_str_8bit(const CHARSET_INFO *, char *);
extern size_t my_casedn_str_8bit(const CHARSET_INFO *, char *);
extern size_t my_caseup_8bit(const CHARSET_INFO *, char *src, size_t srclen,
char *dst, size_t dstlen);
extern size_t my_casedn_8bit(const CHARSET_INFO *, char *src, size_t srclen,
char *dst, size_t dstlen);
extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *);
extern int my_strcasecmp_8bit(const 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_mb_wc_8bit(const CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,
const uchar *e);
int my_wc_mb_8bit(const CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
ulong my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq);
int my_mb_ctype_8bit(const CHARSET_INFO *,int *, const uchar *,const uchar *);
int my_mb_ctype_mb(const CHARSET_INFO *,int *, const uchar *,const uchar *);
int my_snprintf_8bit(struct charset_info_st *, char *to, uint n,
const char *fmt, ...);
size_t my_scan_8bit(const CHARSET_INFO *cs, const char *b, const char *e,
int sq);
long my_strntol_8bit(CHARSET_INFO *, const char *s, uint l, int base,
char **e, int *err);
ulong my_strntoul_8bit(CHARSET_INFO *, const char *s, uint l, int base,
char **e, int *err);
longlong my_strntoll_8bit(CHARSET_INFO *, const char *s, uint l, int base,
char **e, int *err);
ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, uint l, int base,
char **e, int *err);
double my_strntod_8bit(CHARSET_INFO *, char *s, uint l,char **e,
size_t my_snprintf_8bit(const struct charset_info_st *, char *to, size_t n,
const char *fmt, ...)
MY_ATTRIBUTE((format(printf, 4, 5)));
long my_strntol_8bit(const CHARSET_INFO *, const char *s, size_t l,
int base, char **e, int *err);
ulong my_strntoul_8bit(const CHARSET_INFO *, const char *s, size_t l,
int base, char **e, int *err);
longlong my_strntoll_8bit(const CHARSET_INFO *, const char *s, size_t l,
int base, char **e, int *err);
ulonglong my_strntoull_8bit(const CHARSET_INFO *, const char *s, size_t l,
int base, char **e, int *err);
double my_strntod_8bit(const CHARSET_INFO *, char *s, size_t l, char **e,
int *err);
int my_long10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix,
long int val);
int my_longlong10_to_str_8bit(CHARSET_INFO *, char *to, uint l, int radix,
longlong val);
size_t my_long10_to_str_8bit(const CHARSET_INFO *, char *to, size_t l,
int radix, long int val);
size_t my_longlong10_to_str_8bit(const CHARSET_INFO *, char *to, size_t l,
int radix, longlong val);
longlong my_strtoll10_8bit(CHARSET_INFO *cs,
longlong my_strtoll10_8bit(const CHARSET_INFO *cs,
const char *nptr, char **endptr, int *error);
longlong my_strtoll10_ucs2(CHARSET_INFO *cs,
longlong my_strtoll10_ucs2(const CHARSET_INFO *cs,
const char *nptr, char **endptr, int *error);
void my_fill_8bit(CHARSET_INFO *cs, char* to, uint l, int fill);
ulonglong my_strntoull10rnd_8bit(const CHARSET_INFO *cs,
const char *str, size_t length, int
unsigned_fl, char **endptr, int *error);
ulonglong my_strntoull10rnd_ucs2(const CHARSET_INFO *cs,
const char *str, size_t length,
int unsigned_fl, char **endptr, int *error);
my_bool my_like_range_simple(CHARSET_INFO *cs,
const char *ptr, uint ptr_length,
void my_fill_8bit(const CHARSET_INFO *cs, char* to, size_t l, int fill);
/* For 8-bit character set */
my_bool my_like_range_simple(const CHARSET_INFO *cs,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
uint res_length,
size_t res_length,
char *min_str, char *max_str,
uint *min_length, uint *max_length);
size_t *min_length, size_t *max_length);
my_bool my_like_range_mb(CHARSET_INFO *cs,
const char *ptr, uint ptr_length,
/* For ASCII-based multi-byte character sets with mbminlen=1 */
my_bool my_like_range_mb(const CHARSET_INFO *cs,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
uint res_length,
size_t res_length,
char *min_str, char *max_str,
uint *min_length, uint *max_length);
size_t *min_length, size_t *max_length);
my_bool my_like_range_ucs2(CHARSET_INFO *cs,
const char *ptr, uint ptr_length,
pbool escape, pbool w_one, pbool w_many,
uint res_length,
char *min_str, char *max_str,
uint *min_length, uint *max_length);
/* For other character sets, with arbitrary mbminlen and mbmaxlen numbers */
my_bool my_like_range_generic(const 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 *,
int my_wildcmp_8bit(const 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 *,
int my_wildcmp_bin(const CHARSET_INFO *,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many);
uint my_numchars_8bit(CHARSET_INFO *, const char *b, const char *e);
uint my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e,
uint pos, int *error);
int my_mbcharlen_8bit(CHARSET_INFO *, uint c);
size_t my_numchars_8bit(const CHARSET_INFO *, const char *b, const char *e);
size_t my_numcells_8bit(const CHARSET_INFO *, const char *b, const char *e);
size_t my_charpos_8bit(const CHARSET_INFO *, const char *b, const char *e,
size_t pos);
size_t my_well_formed_len_8bit(const CHARSET_INFO *, const char *b,
const char *e, size_t pos, int *error);
uint my_mbcharlen_8bit(const CHARSET_INFO *, uint c);
/* Functions for multibyte charsets */
extern void my_caseup_str_mb(CHARSET_INFO *, char *);
extern void my_casedn_str_mb(CHARSET_INFO *, char *);
extern uint my_caseup_mb(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern uint my_casedn_mb(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *);
extern size_t my_caseup_str_mb(const CHARSET_INFO *, char *);
extern size_t my_casedn_str_mb(const CHARSET_INFO *, char *);
extern size_t my_caseup_mb(const CHARSET_INFO *, char *src, size_t srclen,
char *dst, size_t dstlen);
extern size_t my_casedn_mb(const CHARSET_INFO *, char *src, size_t srclen,
char *dst, size_t dstlen);
extern size_t my_caseup_mb_varlen(const CHARSET_INFO *, char *src,
size_t srclen, char *dst, size_t dstlen);
extern size_t my_casedn_mb_varlen(const CHARSET_INFO *, char *src,
size_t srclen, char *dst, size_t dstlen);
extern size_t my_caseup_ujis(const CHARSET_INFO *, char *src, size_t srclen,
char *dst, size_t dstlen);
extern size_t my_casedn_ujis(const CHARSET_INFO *, char *src, size_t srclen,
char *dst, size_t dstlen);
extern int my_strcasecmp_mb(const CHARSET_INFO * cs,const char *,
const char *);
int my_wildcmp_mb(CHARSET_INFO *,
int my_wildcmp_mb(const CHARSET_INFO *,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many);
uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
uint my_numcells_mb(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
uint my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e,
uint pos, int *error);
uint my_instr_mb(struct charset_info_st *,
const char *b, uint b_length,
const char *s, uint s_length,
size_t my_numchars_mb(const CHARSET_INFO *, const char *b, const char *e);
size_t my_numcells_mb(const CHARSET_INFO *, const char *b, const char *e);
size_t my_charpos_mb(const CHARSET_INFO *, const char *b, const char *e,
size_t pos);
size_t my_well_formed_len_mb(const CHARSET_INFO *, const char *b,
const char *e, size_t pos, int *error);
uint my_instr_mb(const struct charset_info_st *,
const char *b, size_t b_length,
const char *s, size_t s_length,
my_match_t *match, uint nmatch);
int my_wildcmp_unicode(CHARSET_INFO *cs,
int my_strnncoll_mb_bin(const CHARSET_INFO * cs,
const uchar *s, size_t slen,
const uchar *t, size_t tlen,
my_bool t_is_prefix);
int my_strnncollsp_mb_bin(const CHARSET_INFO *cs,
const uchar *a, size_t a_length,
const uchar *b, size_t b_length,
my_bool diff_if_only_endspace_difference);
int my_wildcmp_mb_bin(const 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(const CHARSET_INFO * cs MY_ATTRIBUTE((unused)),
const char *s, const char *t);
void my_hash_sort_mb_bin(const CHARSET_INFO *cs MY_ATTRIBUTE((unused)),
const uchar *key, size_t len,ulong *nr1, ulong *nr2);
size_t my_strnxfrm_mb(const CHARSET_INFO *,
uchar *dst, size_t dstlen, uint nweights,
const uchar *src, size_t srclen, uint flags);
size_t my_strnxfrm_unicode(const CHARSET_INFO *,
uchar *dst, size_t dstlen, uint nweights,
const uchar *src, size_t srclen, uint flags);
size_t my_strnxfrm_unicode_full_bin(const CHARSET_INFO *,
uchar *dst, size_t dstlen, uint nweights,
const uchar *src, size_t srclen, uint flags);
size_t my_strnxfrmlen_unicode_full_bin(const CHARSET_INFO *, size_t);
int my_wildcmp_unicode(const 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);
const MY_UNICASE_INFO *weights);
extern my_bool my_parse_charset_xml(const char *bug, uint len,
int (*add)(CHARSET_INFO *cs));
extern my_bool my_parse_charset_xml(MY_CHARSET_LOADER *loader,
const char *buf, size_t buflen);
extern char *my_strchr(const CHARSET_INFO *cs, const char *str,
const char *end, pchar c);
extern size_t my_strcspn(const CHARSET_INFO *cs, const char *str,
const char *end, const char *reject,
size_t reject_length);
my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, uint len);
my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len);
my_bool my_propagate_simple(const CHARSET_INFO *cs, const uchar *str,
size_t len);
my_bool my_propagate_complex(const CHARSET_INFO *cs, const uchar *str,
size_t len);
uint my_string_repertoire(const CHARSET_INFO *cs, const char *str, size_t len);
my_bool my_charset_is_ascii_based(const CHARSET_INFO *cs);
my_bool my_charset_is_8bit_pure_ascii(const CHARSET_INFO *cs);
uint my_charset_repertoire(const 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(const CHARSET_INFO *cs,
uchar *str, uchar *frmend, uchar *strend,
uint nweights, uint flags, uint level);
my_bool my_charset_is_ascii_compatible(const CHARSET_INFO *cs);
const MY_CONTRACTIONS *my_charset_get_contractions(const CHARSET_INFO *cs,
int level);
extern size_t my_vsnprintf_ex(const CHARSET_INFO *cs, char *to, size_t n,
const char* fmt, va_list ap);
size_t my_convert(char *to, size_t to_length, const CHARSET_INFO *to_cs,
const char *from, size_t from_length,
const CHARSET_INFO *from_cs, uint *errors);
uint my_mbcharlen_ptr(const CHARSET_INFO *cs, const char *s, const char *e);
#define _MY_U 01 /* Upper case */
#define _MY_L 02 /* Lower case */
#define _MY_NMR 04 /* Numeral (digit) */
@ -453,7 +745,8 @@ my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len);
#define my_binary_compare(s) ((s)->state & MY_CS_BINSORT)
#define use_strnxfrm(s) ((s)->state & MY_CS_STRNXFRM)
#define my_strnxfrm(s, a, b, c, d) ((s)->coll->strnxfrm((s), (a), (b), (c), (d)))
#define my_strnxfrm(cs, d, dl, s, sl) \
((cs)->coll->strnxfrm((cs), (d), (dl), (dl), (s), (sl), MY_STRXFRM_PAD_WITH_SPACE))
#define my_strnncoll(s, a, b, c, d) ((s)->coll->strnncoll((s), (a), (b), (c), (d), 0))
#define my_like_range(s, a, b, c, d, e, f, g, h, i, j) \
((s)->coll->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h), (i), (j)))
@ -464,11 +757,39 @@ my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len);
#define use_mb(s) ((s)->cset->ismbchar != NULL)
#define my_ismbchar(s, a, b) ((s)->cset->ismbchar((s), (a), (b)))
#ifdef USE_MB
#define my_mbcharlen(s, a) ((s)->cset->mbcharlen((s),(a)))
#else
#define my_mbcharlen(s, a) 1
#endif
/**
Get the length of gb18030 code by the given two leading bytes
@param[in] s charset_info
@param[in] a first byte of gb18030 code
@param[in] b second byte of gb18030 code
@return the length of gb18030 code starting with given two bytes,
the length would be 2 or 4 for valid gb18030 code,
or 0 for invalid gb18030 code
*/
#define my_mbcharlen_2(s, a, b) ((s)->cset->mbcharlen((s),((((a) & 0xFF) << 8) + ((b) & 0xFF))))
/**
Get the maximum length of leading bytes needed to determine the length of a
multi-byte gb18030 code
@param[in] s charset_info
@return number of leading bytes we need, would be 2 for gb18030
and 1 for all other charsets
*/
#define my_mbmaxlenlen(s) ((s)->mbmaxlenlen)
/**
Judge if the given byte is a possible leading byte for a charset.
For gb18030 whose mbmaxlenlen is 2, we can't determine the length of
a multi-byte character by looking at the first byte only
@param[in] s charset_info
@param[in] i possible leading byte
@return true if it is, otherwise false
*/
#define my_ismb1st(s, i) \
(my_mbcharlen((s), (i)) > 1 || \
(my_mbmaxlenlen((s)) == 2 && my_mbcharlen((s), (i)) == 0))
#define my_caseup_str(s, a) ((s)->cset->caseup_str((s), (a)))
#define my_casedn_str(s, a) ((s)->cset->casedn_str((s), (a)))
@ -478,14 +799,6 @@ my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len);
#define my_strntoull(s, a, b, c,d, e) ((s)->cset->strntoull((s),(a),(b),(c),(d),(e)))
#define my_strntod(s, a, b, c, d) ((s)->cset->strntod((s),(a),(b),(c),(d)))
/* 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

344
3rdparty/mysql/include/m_string.h vendored Normal file
View File

@ -0,0 +1,344 @@
/*
Copyright (c) 2000, 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef _m_string_h
#define _m_string_h
#include "my_global.h" /* HAVE_* */
#include <string.h>
#define bfill please_use_memset_rather_than_bfill
#define bzero please_use_memset_rather_than_bzero
#define bmove please_use_memmove_rather_than_bmove
#define strmov please_use_my_stpcpy_or_my_stpmov_rather_than_strmov
#define strnmov please_use_my_stpncpy_or_my_stpnmov_rather_than_strnmov
#include "mysql/service_my_snprintf.h"
#if defined(__cplusplus)
extern "C" {
#endif
/*
my_str_malloc(), my_str_realloc() and my_str_free() are assigned to
implementations in strings/alloc.c, but can be overridden in
the calling program.
*/
extern void *(*my_str_malloc)(size_t);
extern void *(*my_str_realloc)(void *, size_t);
extern void (*my_str_free)(void *);
/* Declared in int2str() */
extern char _dig_vec_upper[];
extern char _dig_vec_lower[];
/* Prototypes for string functions */
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);
extern char *my_stpmov(char *dst,const char *src);
extern char *my_stpnmov(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, ...);
/**
Copy a string from src to dst until (and including) terminating null byte.
@param dst Destination
@param src Source
@note src and dst cannot overlap.
Use my_stpmov() if src and dst overlaps.
@note Unsafe, consider using my_stpnpy() instead.
@return pointer to terminating null byte.
*/
static inline char *my_stpcpy(char *dst, const char *src)
{
#if defined(HAVE_BUILTIN_STPCPY)
return __builtin_stpcpy(dst, src);
#elif defined(HAVE_STPCPY)
return stpcpy(dst, src);
#else
/* Fallback to implementation supporting overlap. */
return my_stpmov(dst, src);
#endif
}
/**
Copy fixed-size string from src to dst.
@param dst Destination
@param src Source
@param n Maximum number of characters to copy.
@note src and dst cannot overlap
Use my_stpnmov() if src and dst overlaps.
@return pointer to terminating null byte.
*/
static inline char *my_stpncpy(char *dst, const char *src, size_t n)
{
#if defined(HAVE_STPNCPY)
return stpncpy(dst, src, n);
#else
/* Fallback to implementation supporting overlap. */
return my_stpnmov(dst, src, n);
#endif
}
static inline longlong my_strtoll(const char *nptr, char **endptr, int base)
{
#if defined _WIN32
return _strtoi64(nptr, endptr, base);
#else
return strtoll(nptr, endptr, base);
#endif
}
static inline ulonglong my_strtoull(const char *nptr, char **endptr, int base)
{
#if defined _WIN32
return _strtoui64(nptr, endptr, base);
#else
return strtoull(nptr, endptr, base);
#endif
}
static inline char *my_strtok_r(char *str, const char *delim, char **saveptr)
{
#if defined _WIN32
return strtok_s(str, delim, saveptr);
#else
return strtok_r(str, delim, saveptr);
#endif
}
/* native_ rather than my_ since my_strcasecmp already exists */
static inline int native_strcasecmp(const char *s1, const char *s2)
{
#if defined _WIN32
return _stricmp(s1, s2);
#else
return strcasecmp(s1, s2);
#endif
}
/* native_ rather than my_ for consistency with native_strcasecmp */
static inline int native_strncasecmp(const char *s1, const char *s2, size_t n)
{
#if defined _WIN32
return _strnicmp(s1, s2, n);
#else
return strncasecmp(s1, s2, n);
#endif
}
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);
/* 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);
#define NOT_FIXED_DEC 31
/*
The longest string my_fcvt can return is 311 + "precision" bytes.
Here we assume that we never cal my_fcvt() with precision >= NOT_FIXED_DEC
(+ 1 byte for the terminating '\0').
*/
#define FLOATING_POINT_BUFFER (311 + NOT_FIXED_DEC)
/*
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);
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))
#else
extern char *ll2str(longlong val,char *dst,int radix, int upcase);
extern char *longlong10_to_str(longlong val,char *dst,int radix);
#endif
#define longlong2str(A,B,C) ll2str((A),(B),(C),1)
#if defined(__cplusplus)
}
#endif
/*
LEX_STRING -- a pair of a C-string and its length.
(it's part of the plugin API as a MYSQL_LEX_STRING)
Ditto LEX_CSTRING/MYSQL_LEX_CSTRING.
*/
#include <mysql/mysql_lex_string.h>
typedef struct st_mysql_lex_string LEX_STRING;
typedef struct st_mysql_const_lex_string LEX_CSTRING;
#define STRING_WITH_LEN(X) (X), ((sizeof(X) - 1))
#define USTRING_WITH_LEN(X) ((uchar*) X), ((sizeof(X) - 1))
#define C_STRING_WITH_LEN(X) ((char *) (X)), ((sizeof(X) - 1))
/**
Skip trailing space.
On most systems reading memory in larger chunks (ideally equal to the size of
the chinks that the machine physically reads from memory) causes fewer memory
access loops and hence increased performance.
This is why the 'int' type is used : it's closest to that (according to how
it's defined in C).
So when we determine the amount of whitespace at the end of a string we do
the following :
1. We divide the string into 3 zones :
a) from the start of the string (__start) to the first multiple
of sizeof(int) (__start_words)
b) from the end of the string (__end) to the last multiple of sizeof(int)
(__end_words)
c) a zone that is aligned to sizeof(int) and can be safely accessed
through an int *
2. We start comparing backwards from (c) char-by-char. If all we find is
space then we continue
3. If there are elements in zone (b) we compare them as unsigned ints to a
int mask (SPACE_INT) consisting of all spaces
4. Finally we compare the remaining part (a) of the string char by char.
This covers for the last non-space unsigned int from 3. (if any)
This algorithm works well for relatively larger strings, but it will slow
the things down for smaller strings (because of the additional calculations
and checks compared to the naive method). Thus the barrier of length 20
is added.
@param ptr pointer to the input string
@param len the length of the string
@return the last non-space character
*/
#if defined(__sparc) || defined(__sparcv9)
static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len)
{
/* SPACE_INT is a word that contains only spaces */
#if SIZEOF_INT == 4
const unsigned SPACE_INT= 0x20202020U;
#elif SIZEOF_INT == 8
const unsigned SPACE_INT= 0x2020202020202020ULL;
#else
#error define the appropriate constant for a word full of spaces
#endif
const uchar *end= ptr + len;
if (len > 20)
{
const uchar *end_words= (const uchar *)(intptr)
(((ulonglong)(intptr)end) / SIZEOF_INT * SIZEOF_INT);
const uchar *start_words= (const uchar *)(intptr)
((((ulonglong)(intptr)ptr) + SIZEOF_INT - 1) / SIZEOF_INT * SIZEOF_INT);
DBUG_ASSERT(end_words > ptr);
while (end > end_words && end[-1] == 0x20)
end--;
if (end[-1] == 0x20 && start_words < end_words)
while (end > start_words && ((unsigned *)end)[-1] == SPACE_INT)
end -= SIZEOF_INT;
}
while (end > ptr && end[-1] == 0x20)
end--;
return (end);
}
#else
/*
Reads 8 bytes at a time, ignoring alignment.
We use uint8korr, which is fast (it simply reads a *ulonglong)
on all platforms, except sparc.
*/
static inline const uchar *skip_trailing_space(const uchar *ptr, size_t len)
{
const uchar *end= ptr + len;
while (end - ptr >= 8)
{
if (uint8korr(end-8) != 0x2020202020202020ULL)
break;
end-= 8;
}
while (end > ptr && end[-1] == 0x20)
end--;
return (end);
}
#endif
static inline void lex_string_set(LEX_STRING *lex_str, const char *c_str)
{
lex_str->str= (char *) c_str;
lex_str->length= strlen(c_str);
}
static inline void lex_cstring_set(LEX_CSTRING *lex_str, const char *c_str)
{
lex_str->str= c_str;
lex_str->length= strlen(c_str);
}
#endif

View File

@ -1,9 +1,8 @@
/* Copyright (C) 2000 MySQL AB
/* 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; either version 2 of the License, or
(at your option) any later version.
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -12,9 +11,9 @@
You 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 */
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
/*
Data structures for mysys/my_alloc.c (root memory allocator)
*/
@ -24,6 +23,13 @@
#define ALLOC_MAX_BLOCK_TO_DROP 4096
#define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10
/* PSI_memory_key */
#include "mysql/psi/psi_memory.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct st_used_mem
{ /* struct for once_alloc (block) */
struct st_used_mem *next; /* Next block in use */
@ -38,15 +44,22 @@ typedef struct st_mem_root
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 */
unsigned int min_malloc;
unsigned int block_size; /* initial block size */
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
/*
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

213
3rdparty/mysql/include/my_byteorder.h vendored Normal file
View File

@ -0,0 +1,213 @@
#ifndef MY_BYTEORDER_INCLUDED
#define MY_BYTEORDER_INCLUDED
/* Copyright (c) 2001, 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 */
/*
Functions 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) || defined(__x86_64__)
#include "byte_order_generic_x86.h"
#else
#include "byte_order_generic.h"
#endif
static inline int32 sint3korr(const uchar *A)
{
return
((int32) (((A[2]) & 128) ?
(((uint32) 255L << 24) |
(((uint32) A[2]) << 16) |
(((uint32) A[1]) << 8) |
((uint32) A[0])) :
(((uint32) A[2]) << 16) |
(((uint32) A[1]) << 8) |
((uint32) A[0])))
;
}
static inline uint32 uint3korr(const uchar *A)
{
return
(uint32) (((uint32) (A[0])) +
(((uint32) (A[1])) << 8) +
(((uint32) (A[2])) << 16))
;
}
static inline ulonglong uint5korr(const uchar *A)
{
return
((ulonglong)(((uint32) (A[0])) +
(((uint32) (A[1])) << 8) +
(((uint32) (A[2])) << 16) +
(((uint32) (A[3])) << 24)) +
(((ulonglong) (A[4])) << 32))
;
}
static inline ulonglong uint6korr(const uchar *A)
{
return
((ulonglong)(((uint32) (A[0])) +
(((uint32) (A[1])) << 8) +
(((uint32) (A[2])) << 16) +
(((uint32) (A[3])) << 24)) +
(((ulonglong) (A[4])) << 32) +
(((ulonglong) (A[5])) << 40))
;
}
static inline void int3store(uchar *T, uint A)
{
*(T)= (uchar) (A);
*(T+1)= (uchar) (A >> 8);
*(T+2)= (uchar) (A >> 16);
}
static inline void int5store(uchar *T, ulonglong A)
{
*(T)= (uchar) (A);
*(T+1)= (uchar) (A >> 8);
*(T+2)= (uchar) (A >> 16);
*(T+3)= (uchar) (A >> 24);
*(T+4)= (uchar) (A >> 32);
}
static inline void int6store(uchar *T, ulonglong A)
{
*(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);
}
#ifdef __cplusplus
static inline int16 sint2korr(const char *pT)
{
return sint2korr(static_cast<const uchar*>(static_cast<const void*>(pT)));
}
static inline uint16 uint2korr(const char *pT)
{
return uint2korr(static_cast<const uchar*>(static_cast<const void*>(pT)));
}
static inline uint32 uint3korr(const char *pT)
{
return uint3korr(static_cast<const uchar*>(static_cast<const void*>(pT)));
}
static inline int32 sint3korr(const char *pT)
{
return sint3korr(static_cast<const uchar*>(static_cast<const void*>(pT)));
}
static inline uint32 uint4korr(const char *pT)
{
return uint4korr(static_cast<const uchar*>(static_cast<const void*>(pT)));
}
static inline int32 sint4korr(const char *pT)
{
return sint4korr(static_cast<const uchar*>(static_cast<const void*>(pT)));
}
static inline ulonglong uint6korr(const char *pT)
{
return uint6korr(static_cast<const uchar*>(static_cast<const void*>(pT)));
}
static inline ulonglong uint8korr(const char *pT)
{
return uint8korr(static_cast<const uchar*>(static_cast<const void*>(pT)));
}
static inline longlong sint8korr(const char *pT)
{
return sint8korr(static_cast<const uchar*>(static_cast<const void*>(pT)));
}
static inline void int2store(char *pT, uint16 A)
{
int2store(static_cast<uchar*>(static_cast<void*>(pT)), A);
}
static inline void int3store(char *pT, uint A)
{
int3store(static_cast<uchar*>(static_cast<void*>(pT)), A);
}
static inline void int4store(char *pT, uint32 A)
{
int4store(static_cast<uchar*>(static_cast<void*>(pT)), A);
}
static inline void int5store(char *pT, ulonglong A)
{
int5store(static_cast<uchar*>(static_cast<void*>(pT)), A);
}
static inline void int6store(char *pT, ulonglong A)
{
int6store(static_cast<uchar*>(static_cast<void*>(pT)), A);
}
static inline void int8store(char *pT, ulonglong A)
{
int8store(static_cast<uchar*>(static_cast<void*>(pT)), A);
}
#endif /* __cplusplus */
/*
Functions for reading and storing in machine format from/to
short/long to/from some place in memory V should be a variable
and M a pointer to byte.
*/
#ifdef WORDS_BIGENDIAN
#include "big_endian.h"
#else
#include "little_endian.h"
#endif
#ifdef __cplusplus
static inline void float4store(char *V, float M)
{
float4store(static_cast<uchar*>(static_cast<void*>(V)), M);
}
static inline void float8get(double *V, const char *M)
{
float8get(V, static_cast<const uchar*>(static_cast<const void*>(M)));
}
static inline void float8store(char *V, double M)
{
float8store(static_cast<uchar*>(static_cast<void*>(V)), M);
}
#endif /* __cplusplus */
#endif /* MY_BYTEORDER_INCLUDED */

64
3rdparty/mysql/include/my_command.h vendored Normal file
View File

@ -0,0 +1,64 @@
/* Copyright (c) 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef _mysql_command_h
#define _mysql_command_h
/**
@enum enum_server_command
@brief 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_BINLOG_DUMP_GTID,
COM_RESET_CONNECTION,
/* don't forget to update const char *command_name[] in sql_parse.cc */
/* Must be last */
COM_END
};
#endif /* _mysql_command_h */

178
3rdparty/mysql/include/my_compiler.h vendored Normal file
View File

@ -0,0 +1,178 @@
#ifndef MY_COMPILER_INCLUDED
#define MY_COMPILER_INCLUDED
/* Copyright (c) 2010, 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-1301 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.
*/
#include <stddef.h> /* size_t */
#if defined __GNUC__
/*
Convenience macro to test the minimum required GCC version.
These should be used with care as Clang also sets __GNUC__ and
__GNUC_MINOR__ (currently to 4.2). Prefer using feature specific
CMake checks in configure.cmake instead.
*/
# define MY_GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
#else
# define MY_GNUC_PREREQ(maj, min) (0)
#endif
/*
The macros below are borrowed from include/linux/compiler.h in the
Linux kernel. Use them to indicate the likelyhood 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
*/
#ifdef HAVE_BUILTIN_EXPECT
// likely/unlikely are likely to clash with other symbols, do not #define
#if defined(__cplusplus)
inline bool likely(bool expr)
{
return __builtin_expect(expr, true);
}
inline bool unlikely(bool expr)
{
return __builtin_expect(expr, false);
}
#else
# define likely(x) __builtin_expect((x),1)
# define unlikely(x) __builtin_expect((x),0)
#endif
#else /* HAVE_BUILTIN_EXPECT */
#if defined(__cplusplus)
inline bool likely(bool expr)
{
return expr;
}
inline bool unlikely(bool expr)
{
return expr;
}
#else
# define likely(x) (x)
# define unlikely(x) (x)
#endif
#endif /* HAVE_BUILTIN_EXPECT */
/* Comunicate to the compiler the unreachability of the code. */
#ifdef HAVE_BUILTIN_UNREACHABLE
# define MY_ASSERT_UNREACHABLE() __builtin_unreachable()
#else
# define MY_ASSERT_UNREACHABLE() do { assert(0); } while (0)
#endif
#if defined __GNUC__ || defined __SUNPRO_C || defined __SUNPRO_CC
/* 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))))
/* Microsoft Visual C++ */
#elif defined _MSC_VER
# define MY_ALIGNOF(type) __alignof(type)
# define MY_ALIGNED(n) __declspec(align(n))
#else /* Make sure they are defined for other compilers. */
# define MY_ALIGNOF(type)
# define MY_ALIGNED(size)
#endif
/* Visual Studio requires '__inline' for C code */
#if !defined(__cplusplus) && defined(_MSC_VER)
# define inline __inline
#endif
/* Provide __func__ macro definition for Visual Studio. */
#if defined(_MSC_VER)
# define __func__ __FUNCTION__
#endif
/**
C++ Type Traits
*/
#ifdef __cplusplus
/**
Opaque storage with a particular alignment.
Partial specialization used due to MSVC++.
*/
template<size_t alignment> 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> {};
/**
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 <size_t size, size_t alignment>
struct my_aligned_storage
{
union
{
char data[size];
my_alignment_imp<alignment> align;
};
};
#endif /* __cplusplus */
/*
Disable MY_ATTRIBUTE for Sun Studio and Visual Studio.
Note that Sun Studio supports some __attribute__ variants,
but not format or unused which we use quite a lot.
*/
#ifndef MY_ATTRIBUTE
#if defined(__GNUC__)
# define MY_ATTRIBUTE(A) __attribute__(A)
#else
# define MY_ATTRIBUTE(A)
#endif
#endif
#ifndef __has_attribute
# define __has_attribute(x) 0
#endif
#if __has_attribute(no_sanitize_undefined)
# define SUPPRESS_UBSAN __attribute__((no_sanitize_undefined))
#else
# define SUPPRESS_UBSAN
#endif
#endif /* MY_COMPILER_INCLUDED */

454
3rdparty/mysql/include/my_config.h vendored Normal file
View File

@ -0,0 +1,454 @@
/* Copyright (c) 2009, 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-1301 USA */
#ifndef MY_CONFIG_H
#define MY_CONFIG_H
/*
* From configure.cmake, in order of appearance
*/
/* #undef HAVE_LLVM_LIBCPP */
#define _LARGEFILE_SOURCE 1
/* Libraries */
/* #undef HAVE_LIBM */
/* #undef HAVE_LIBNSL */
/* #undef HAVE_LIBCRYPT */
/* #undef HAVE_LIBSOCKET */
/* #undef HAVE_LIBDL */
/* #undef HAVE_LIBRT */
/* #undef HAVE_LIBWRAP */
/* Header files */
/* #undef HAVE_ALLOCA_H */
/* #undef HAVE_ARPA_INET_H */
/* #undef HAVE_DIRENT_H */
/* #undef HAVE_DLFCN_H */
/* #undef HAVE_EXECINFO_H */
/* #undef HAVE_FPU_CONTROL_H */
/* #undef HAVE_GRP_H */
/* #undef HAVE_IEEEFP_H */
/* #undef HAVE_LANGINFO_H */
#define HAVE_MALLOC_H 1
/* #undef HAVE_NETINET_IN_H */
/* #undef HAVE_POLL_H */
/* #undef HAVE_PWD_H */
/* #undef HAVE_STRINGS_H */
/* #undef HAVE_SYS_CDEFS_H */
/* #undef HAVE_SYS_IOCTL_H */
/* #undef HAVE_SYS_MMAN_H */
/* #undef HAVE_SYS_RESOURCE_H */
/* #undef HAVE_SYS_SELECT_H */
/* #undef HAVE_SYS_SOCKET_H */
/* #undef HAVE_TERM_H */
/* #undef HAVE_TERMIOS_H */
/* #undef HAVE_TERMIO_H */
/* #undef HAVE_UNISTD_H */
/* #undef HAVE_SYS_WAIT_H */
/* #undef HAVE_SYS_PARAM_H */
/* #undef HAVE_FNMATCH_H */
/* #undef HAVE_SYS_UN_H */
/* #undef HAVE_VIS_H */
/* #undef HAVE_SASL_SASL_H */
/* Libevent */
/* #undef HAVE_DEVPOLL */
/* #undef HAVE_SYS_DEVPOLL_H */
/* #undef HAVE_SYS_EPOLL_H */
/* #undef HAVE_TAILQFOREACH */
/* Functions */
#define HAVE_ALIGNED_MALLOC 1
/* #undef HAVE_BACKTRACE */
/* #undef HAVE_PRINTSTACK */
/* #undef HAVE_INDEX */
/* #undef HAVE_CLOCK_GETTIME */
/* #undef HAVE_CUSERID */
/* #undef HAVE_DIRECTIO */
/* #undef HAVE_FTRUNCATE */
#define HAVE_COMPRESS 1
/* #undef HAVE_CRYPT */
/* #undef HAVE_DLOPEN */
/* #undef HAVE_FCHMOD */
/* #undef HAVE_FCNTL */
/* #undef HAVE_FDATASYNC */
/* #undef HAVE_DECL_FDATASYNC */
/* #undef HAVE_FEDISABLEEXCEPT */
/* #undef HAVE_FSEEKO */
/* #undef HAVE_FSYNC */
/* #undef HAVE_GETHOSTBYADDR_R */
/* #undef HAVE_GETHRTIME */
#define HAVE_GETNAMEINFO 1
/* #undef HAVE_GETPASS */
/* #undef HAVE_GETPASSPHRASE */
/* #undef HAVE_GETPWNAM */
/* #undef HAVE_GETPWUID */
/* #undef HAVE_GETRLIMIT */
/* #undef HAVE_GETRUSAGE */
/* #undef HAVE_INITGROUPS */
/* #undef HAVE_ISSETUGID */
/* #undef HAVE_GETUID */
/* #undef HAVE_GETEUID */
/* #undef HAVE_GETGID */
/* #undef HAVE_GETEGID */
/* #undef HAVE_LSTAT */
/* #undef HAVE_MADVISE */
/* #undef HAVE_MALLOC_INFO */
/* #undef HAVE_MEMRCHR */
/* #undef HAVE_MLOCK */
/* #undef HAVE_MLOCKALL */
/* #undef HAVE_MMAP64 */
/* #undef HAVE_POLL */
/* #undef HAVE_POSIX_FALLOCATE */
/* #undef HAVE_POSIX_MEMALIGN */
/* #undef HAVE_PREAD */
/* #undef HAVE_PTHREAD_CONDATTR_SETCLOCK */
/* #undef HAVE_PTHREAD_SIGMASK */
/* #undef HAVE_READDIR_R */
/* #undef HAVE_READLINK */
/* #undef HAVE_REALPATH */
/* #undef HAVE_SETFD */
/* #undef HAVE_SIGACTION */
/* #undef HAVE_SLEEP */
/* #undef HAVE_STPCPY */
/* #undef HAVE_STPNCPY */
/* #undef HAVE_STRLCPY */
#define HAVE_STRNLEN 1
/* #undef HAVE_STRLCAT */
/* #undef HAVE_STRSIGNAL */
/* #undef HAVE_FGETLN */
/* #undef HAVE_STRSEP */
#define HAVE_TELL 1
/* #undef HAVE_VASPRINTF */
/* #undef HAVE_MEMALIGN */
/* #undef HAVE_NL_LANGINFO */
/* #undef HAVE_HTONLL */
/* #undef DNS_USE_CPU_CLOCK_FOR_ID */
/* #undef HAVE_EPOLL */
/* #undef HAVE_EVENT_PORTS */
#define HAVE_INET_NTOP 1
/* #undef HAVE_WORKING_KQUEUE */
/* #undef HAVE_TIMERADD */
/* #undef HAVE_TIMERCLEAR */
/* #undef HAVE_TIMERCMP */
/* #undef HAVE_TIMERISSET */
/* WL2373 */
/* #undef HAVE_SYS_TIME_H */
/* #undef HAVE_SYS_TIMES_H */
/* #undef HAVE_TIMES */
/* #undef HAVE_GETTIMEOFDAY */
/* Symbols */
/* #undef HAVE_LRAND48 */
/* #undef GWINSZ_IN_SYS_IOCTL */
/* #undef FIONREAD_IN_SYS_IOCTL */
/* #undef FIONREAD_IN_SYS_FILIO */
/* #undef HAVE_SIGEV_THREAD_ID */
/* #undef HAVE_SIGEV_PORT */
#define HAVE_LOG2 1
#define HAVE_ISINF 1
/* #undef HAVE_KQUEUE_TIMERS */
/* #undef HAVE_POSIX_TIMERS */
/* Endianess */
/* #undef WORDS_BIGENDIAN */
/* Type sizes */
#define SIZEOF_VOIDP 8
#define SIZEOF_CHARP 8
#define SIZEOF_LONG 4
#define SIZEOF_SHORT 2
#define SIZEOF_INT 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_OFF_T 4
#define SIZEOF_TIME_T 8
/* #undef HAVE_UINT */
/* #undef HAVE_ULONG */
/* #undef HAVE_U_INT32_T */
#define HAVE_STRUCT_TIMESPEC
/* Support for tagging symbols with __attribute__((visibility("hidden"))) */
/* #undef HAVE_VISIBILITY_HIDDEN */
/* Code tests*/
#define STACK_DIRECTION -1
/* #undef TIME_WITH_SYS_TIME */
#define NO_FCNTL_NONBLOCK 1
/* #undef HAVE_PAUSE_INSTRUCTION */
/* #undef HAVE_FAKE_PAUSE_INSTRUCTION */
/* #undef HAVE_HMT_PRIORITY_INSTRUCTION */
/* #undef HAVE_ABI_CXA_DEMANGLE */
/* #undef HAVE_BSS_START */
/* #undef HAVE_BUILTIN_UNREACHABLE */
/* #undef HAVE_BUILTIN_EXPECT */
/* #undef HAVE_BUILTIN_STPCPY */
/* #undef HAVE_GCC_ATOMIC_BUILTINS */
/* #undef HAVE_GCC_SYNC_BUILTINS */
/* #undef HAVE_VALGRIND */
/* IPV6 */
/* #undef HAVE_NETINET_IN6_H */
#define HAVE_STRUCT_SOCKADDR_IN6 1
#define HAVE_STRUCT_IN6_ADDR 1
#define HAVE_IPV6 1
/* #undef ss_family */
/* #undef HAVE_SOCKADDR_IN_SIN_LEN */
/* #undef HAVE_SOCKADDR_IN6_SIN6_LEN */
/*
* Platform specific CMake files
*/
#define MACHINE_TYPE "x86_64"
/* #undef HAVE_LINUX_LARGE_PAGES */
/* #undef HAVE_SOLARIS_LARGE_PAGES */
/* #undef HAVE_SOLARIS_ATOMIC */
/* #undef HAVE_SOLARIS_STYLE_GETHOST */
#define SYSTEM_TYPE "Win64"
/* Windows stuff, mostly functions, that have Posix analogs but named differently */
/* #undef IPPROTO_IPV6 */
/* #undef IPV6_V6ONLY */
/* This should mean case insensitive file system */
#define FN_NO_CASE_SENSE 1
/*
* From main CMakeLists.txt
*/
#define MAX_INDEXES 64U
/* #undef WITH_INNODB_MEMCACHED */
/* #undef ENABLE_MEMCACHED_SASL */
/* #undef ENABLE_MEMCACHED_SASL_PWDB */
#define ENABLED_PROFILING 1
/* #undef HAVE_ASAN */
#define ENABLED_LOCAL_INFILE 1
/* #undef OPTIMIZER_TRACE */
#define DEFAULT_MYSQL_HOME "C:/Program Files/MySQL/MySQL Server 6.1"
#define SHAREDIR "share"
#define DEFAULT_BASEDIR "C:/Program Files/MySQL/MySQL Server 6.1"
#define MYSQL_DATADIR "C:/Program Files/MySQL/MySQL Server 6.1/data"
#define MYSQL_KEYRINGDIR "C:/Program Files/MySQL/MySQL Server 6.1/keyring"
#define DEFAULT_CHARSET_HOME "C:/Program Files/MySQL/MySQL Server 6.1"
#define PLUGINDIR "C:/Program Files/MySQL/MySQL Server 6.1/lib/plugin"
/* #undef DEFAULT_SYSCONFDIR */
#define DEFAULT_TMPDIR ""
#define INSTALL_SBINDIR "/bin"
#define INSTALL_BINDIR "/bin"
#define INSTALL_MYSQLSHAREDIR "/share"
#define INSTALL_SHAREDIR "/share"
#define INSTALL_PLUGINDIR "/lib/plugin"
#define INSTALL_INCLUDEDIR "/include"
#define INSTALL_SCRIPTDIR "/scripts"
#define INSTALL_MYSQLDATADIR "/data"
#define INSTALL_MYSQLKEYRINGDIR "/keyring"
/* #undef INSTALL_PLUGINTESTDIR */
#define INSTALL_INFODIR "/docs"
#define INSTALL_MYSQLTESTDIR "/mysql-test"
#define INSTALL_DOCREADMEDIR "/."
#define INSTALL_DOCDIR "/docs"
#define INSTALL_MANDIR "/man"
#define INSTALL_SUPPORTFILESDIR "/support-files"
#define INSTALL_LIBDIR "/lib"
/*
* Readline
*/
/* #undef HAVE_MBSTATE_T */
/* #undef HAVE_LANGINFO_CODESET */
/* #undef HAVE_WCSDUP */
/* #undef HAVE_WCHAR_T */
/* #undef HAVE_WINT_T */
/* #undef HAVE_CURSES_H */
/* #undef HAVE_NCURSES_H */
/* #undef USE_LIBEDIT_INTERFACE */
/* #undef HAVE_HIST_ENTRY */
/* #undef USE_NEW_EDITLINE_INTERFACE */
/*
* Libedit
*/
/* #undef HAVE_DECL_TGOTO */
/*
* DTrace
*/
/* #undef HAVE_DTRACE */
/*
* Character sets
*/
#define MYSQL_DEFAULT_CHARSET_NAME "latin1"
#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
#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_gb18030 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
/* #undef HAVE_CHARSET_utf8mb3 */
#define HAVE_CHARSET_utf8 1
#define HAVE_CHARSET_utf16 1
#define HAVE_CHARSET_utf32 1
#define HAVE_UCA_COLLATIONS 1
/*
* Feature set
*/
#define WITH_PARTITION_STORAGE_ENGINE 1
/*
* Performance schema
*/
/* #undef WITH_PERFSCHEMA_STORAGE_ENGINE */
/* #undef DISABLE_PSI_THREAD */
/* #undef DISABLE_PSI_MUTEX */
/* #undef DISABLE_PSI_RWLOCK */
/* #undef DISABLE_PSI_COND */
/* #undef DISABLE_PSI_FILE */
/* #undef DISABLE_PSI_TABLE */
/* #undef DISABLE_PSI_SOCKET */
/* #undef DISABLE_PSI_STAGE */
/* #undef DISABLE_PSI_STATEMENT */
/* #undef DISABLE_PSI_SP */
/* #undef DISABLE_PSI_PS */
/* #undef DISABLE_PSI_IDLE */
/* #undef DISABLE_PSI_STATEMENT_DIGEST */
/* #undef DISABLE_PSI_METADATA */
/* #undef DISABLE_PSI_MEMORY */
/* #undef DISABLE_PSI_TRANSACTION */
/*
* syscall
*/
/* #undef HAVE_SYS_THREAD_SELFID */
/* #undef HAVE_SYS_GETTID */
/* #undef HAVE_PTHREAD_GETTHREADID_NP */
/* #undef HAVE_PTHREAD_SETNAME_NP */
/* #undef HAVE_INTEGER_PTHREAD_SELF */
/* Platform-specific C++ compiler behaviors we rely upon */
/*
This macro defines whether the compiler in use needs a 'typename' keyword
to access the types defined inside a class template, such types are called
dependent types. Some compilers require it, some others forbid it, and some
others may work with or without it. For example, GCC requires the 'typename'
keyword whenever needing to access a type inside a template, but msvc
forbids it.
*/
#define HAVE_IMPLICIT_DEPENDENT_NAME_TYPING 1
/*
* MySQL version
*/
#define DOT_FRM_VERSION 6
#define MYSQL_VERSION_MAJOR 6
#define MYSQL_VERSION_MINOR 1
#define MYSQL_VERSION_PATCH 9
#define MYSQL_VERSION_EXTRA ""
#define PACKAGE "mysql"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME "MySQL Server"
#define PACKAGE_STRING "MySQL Server 6.1.9"
#define PACKAGE_TARNAME "mysql"
#define PACKAGE_VERSION "6.1.9"
#define VERSION "6.1.9"
#define PROTOCOL_VERSION 10
/*
* CPU info
*/
#define CPU_LEVEL1_DCACHE_LINESIZE 64
/*
* NDB
*/
/* #undef WITH_NDBCLUSTER_STORAGE_ENGINE */
/* #undef HAVE_PTHREAD_SETSCHEDPARAM */
/*
* Other
*/
/* #undef EXTRA_DEBUG */
/* #undef HAVE_CHOWN */
/*
* Hardcoded values needed by libevent/NDB/memcached
*/
#define HAVE_FCNTL_H 1
#define HAVE_GETADDRINFO 1
#define HAVE_INTTYPES_H 1
/* libevent's select.c is not Windows compatible */
#ifndef _WIN32
#define HAVE_SELECT 1
#endif
#define HAVE_SIGNAL_H 1
#define HAVE_STDARG_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRDUP 1
#define HAVE_STRTOK_R 1
#define HAVE_STRTOLL 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TYPES_H 1
#define SIZEOF_CHAR 1
/*
* Needed by libevent
*/
/* #undef HAVE_SOCKLEN_T */
/* For --secure-file-priv */
#define DEFAULT_SECURE_FILE_PRIV_DIR "NULL"
#define DEFAULT_SECURE_FILE_PRIV_EMBEDDED_DIR "NULL"
/* #undef HAVE_LIBNUMA */
/* For default value of --early_plugin_load */
/* #undef DEFAULT_EARLY_PLUGIN_LOAD */
#endif

View File

@ -1,9 +1,8 @@
/* Copyright (C) 2000 MySQL AB
/* 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; either version 2 of the License, or
(at your option) any later version.
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -12,90 +11,235 @@
You 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 */
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef _dbug_h
#define _dbug_h
#ifndef MY_DBUG_INCLUDED
#define MY_DBUG_INCLUDED
#ifdef __cplusplus
#include "my_global.h" /* MYSQL_PLUGIN_IMPORT */
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(DBUG_OFF) && !defined(_lint)
extern int _db_on_,_no_db_;
extern FILE *_db_fp_;
extern char *_db_process_;
extern int _db_keyword_(const char *keyword);
extern int _db_strict_keyword_(const char *keyword);
extern void _db_setjmp_(void);
extern void _db_longjmp_(void);
extern void _db_push_(const char *control);
extern void _db_pop_(void);
extern void _db_enter_(const char *_func_,const char *_file_,uint _line_,
const char **_sfunc_,const char **_sfile_,
uint *_slevel_, char ***);
extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_,
uint *_slevel_);
extern void _db_pargs_(uint _line_,const char *keyword);
extern void _db_doprnt_ _VARARGS((const char *format,...));
extern void _db_dump_(uint _line_,const char *keyword,const char *memory,
uint length);
extern void _db_output_(uint flag);
extern void _db_lock_file(void);
extern void _db_unlock_file(void);
#if !defined(DBUG_OFF)
#define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \
char **_db_framep_; \
_db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \
&_db_framep_)
#define DBUG_LEAVE \
(_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_))
#define DBUG_RETURN(a1) {DBUG_LEAVE; return(a1);}
#define DBUG_VOID_RETURN {DBUG_LEAVE; return;}
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 */
struct _db_stack_frame_ *prev; /* pointer to the previous frame */
};
struct _db_code_state_;
extern MYSQL_PLUGIN_IMPORT 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_(uint _line_, struct _db_stack_frame_ *_stack_frame_);
extern void _db_pargs_(uint _line_,const char *keyword);
extern int _db_enabled_();
extern void _db_doprnt_(const char *format,...)
MY_ATTRIBUTE((format(printf, 1, 2)));
extern void _db_doputs_(const char *log);
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);
extern FILE *_db_fp_(void);
extern void _db_flush_();
extern const char* _db_get_func_(void);
#define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_; \
_db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_)
#define DBUG_LEAVE _db_return_ (__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)
#define DBUG_EXECUTE(keyword,a1) \
{if (_db_on_) {if (_db_keyword_ (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) \
{if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}}
do \
{ \
if (_dbug_on_) \
{ \
_db_pargs_(__LINE__,keyword); \
if (_db_enabled_()) \
{ \
_db_doprnt_ arglist; \
} \
} \
} while(0)
/*
An alternate to DBUG_PRINT() macro, which takes a single string
as the second argument.
*/
#define DBUG_PUTS(keyword,arg) \
do \
{ \
if (_dbug_on_) \
{ \
_db_pargs_(__LINE__,keyword); \
if (_db_enabled_()) \
{ \
_db_doputs_(arg); \
} \
} \
} while(0)
#define DBUG_PUSH(a1) _db_push_ (a1)
#define DBUG_POP() _db_pop_ ()
#define DBUG_PROCESS(a1) (_db_process_ = a1)
#define DBUG_FILE (_db_fp_)
#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_SETJMP(a1) (_db_setjmp_ (), setjmp (a1))
#define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2))
#define DBUG_DUMP(keyword,a1,a2)\
{if (_db_on_) {_db_dump_(__LINE__,keyword,a1,a2);}}
#define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr)
#define DEBUGGER_OFF _no_db_=1;_db_on_=0;
#define DEBUGGER_ON _no_db_=0
#define DBUG_LOCK_FILE { _db_lock_file(); }
#define DBUG_UNLOCK_FILE { _db_unlock_file(); }
#define DBUG_OUTPUT(A) { _db_output_(A); }
#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) assert(A)
#define DBUG_EXECUTE_IF(keyword,a1) \
{if (_db_on_) {if (_db_strict_keyword_ (keyword)) { a1 }}}
#else /* No debugger */
#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)
#ifndef _WIN32
#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(2) (now it would cause a "test signal" popup).
*/
#include <crtdbg.h>
#define DBUG_ABORT() (_db_flush_(),\
(void)_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE),\
(void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR),\
_exit(2))
#endif
#define DBUG_CHECK_CRASH(func, op) \
do { char _dbuf_[255]; strxnmov(_dbuf_, sizeof(_dbuf_)-1, (func), (op)); \
DBUG_EXECUTE_IF(_dbuf_, DBUG_ABORT()); } while(0)
#define DBUG_CRASH_ENTER(func) \
DBUG_ENTER(func); DBUG_CHECK_CRASH(func, "_crash_enter")
#define DBUG_CRASH_RETURN(val) \
DBUG_CHECK_CRASH(_db_get_func_(), "_crash_return")
#define DBUG_CRASH_VOID_RETURN \
DBUG_CHECK_CRASH (_db_get_func_(), "_crash_return")
/*
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 _WIN32
#define DBUG_SUICIDE() DBUG_ABORT()
#else
extern void _db_suicide_();
extern void _db_flush_gcov_();
#define DBUG_SUICIDE() (_db_flush_(), _db_suicide_())
#endif
#else /* No debugger */
#define DBUG_ENTER(a1)
#define DBUG_RETURN(a1) return(a1)
#define DBUG_VOID_RETURN return
#define DBUG_EXECUTE(keyword,a1) {}
#define DBUG_EXECUTE_IF(keyword,a1) {}
#define DBUG_PRINT(keyword,arglist) {}
#define DBUG_PUSH(a1) {}
#define DBUG_POP() {}
#define DBUG_PROCESS(a1) {}
#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_PUTS(keyword,arg) do { } while(0)
#define DBUG_LOG(keyword,arglist) 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_SETJMP(a1) setjmp(a1)
#define DBUG_LONGJMP(a1) longjmp(a1)
#define DBUG_DUMP(keyword,a1,a2) do { } while(0)
#define DBUG_END() do { } while(0)
#define DBUG_ASSERT(A) do { } while(0)
#define DBUG_LOCK_FILE do { } while(0)
#define DBUG_FILE (stderr)
#define DBUG_SETJMP setjmp
#define DBUG_LONGJMP longjmp
#define DBUG_DUMP(keyword,a1,a2) {}
#define DBUG_IN_USE 0
#define DEBUGGER_OFF
#define DEBUGGER_ON
#define DBUG_LOCK_FILE
#define DBUG_UNLOCK_FILE
#define DBUG_OUTPUT(A)
#define DBUG_ASSERT(A) {}
#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 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)
#endif
#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
}
#endif
#endif
#ifdef __cplusplus
#if !defined(DBUG_OFF)
#include <sstream>
/*
A C++ interface to the DBUG_PUTS macro. The DBUG_LOG macro also
takes two arguments. The first argument is the keyword, as that of the
DBUG_PRINT. The 2nd argument 'v' will be passed to a C++ output stream.
This enables the use of C++ style output stream operator. In the code, it
will be used as follows:
DBUG_LOG("blob", "space: " << space_id);
Note: DBUG_PRINT() has a limitation of 1024 bytes for a single
print out. This limitation is not there for DBUG_PUTS and DBUG_LOG
macros.
*/
#define DBUG_LOG(keyword, v) do { \
std::ostringstream sout; \
sout << v; \
DBUG_PUTS(keyword, sout.str().c_str()); \
} while(0)
#endif /* DBUG_OFF */
#endif /* __cplusplus */
#endif /* MY_DBUG_INCLUDED */

93
3rdparty/mysql/include/my_dir.h vendored Normal file
View File

@ -0,0 +1,93 @@
/* 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 St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef MY_DIR_H
#define MY_DIR_H
#include "my_global.h"
#include <sys/stat.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Defines for my_dir and my_stat */
#ifdef _WIN32
#define S_IROTH _S_IREAD
#define S_IFIFO _S_IFIFO
#endif
#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 */
#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 */
#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)
#define MY_DONT_SORT 512 /* my_lib; Don't sort files */
#define MY_WANT_STAT 1024 /* my_lib; stat files */
/* typedefs for my_dir & my_stat */
#if(_MSC_VER)
#define MY_STAT struct _stati64 /* 64 bit file size */
#else
#define MY_STAT struct stat /* Orginal struct have what we need */
#endif
/* 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_off_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 */

149
3rdparty/mysql/include/my_getopt.h vendored Normal file
View File

@ -0,0 +1,149 @@
/*
Copyright (c) 2002, 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 _my_getopt_h
#define _my_getopt_h
#include "my_sys.h" /* loglevel */
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_PASSWORD 16
#if SIZEOF_INT == 4
#define GET_INT32 GET_INT
#define GET_UINT32 GET_UINT
#elif SIZEOF_LONG == 4
#define GET_INT32 GET_LONG
#define GET_UINT32 GET_ULONG
#else
#error Neither int or long is of 4 bytes width
#endif
#define GET_ASK_ADDR 128
#define GET_TYPE_MASK 127
/**
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 0<id<=255 it's means one
character for a short option
(like -A), if >255 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.
id=-1 is a special case and is used
to generate deprecation warnings for
plugin options. It should not be
used for anything else.
*/
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)(int, const struct my_option *, 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 *, size_t, const struct my_option *,
int *);
extern char *disabled_my_option;
extern my_bool my_getopt_print_errors;
extern my_bool my_getopt_skip_unknown;
extern my_error_reporter my_getopt_error_reporter;
extern int handle_options (int *argc, char ***argv,
const struct my_option *longopts, my_get_one_option);
extern int my_handle_options (int *argc, char ***argv,
const struct my_option *longopts,
my_get_one_option,
const char **command_list, my_bool ignore_unknown_option);
extern void print_cmdline_password_warning();
extern void my_cleanup_options(const struct my_option *options);
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);
extern void my_print_variables_ex(const struct my_option *options, FILE* file);
extern void my_getopt_register_get_addr(my_getopt_value);
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);
my_bool getopt_compare_strings(const char *s, const char *t, uint length);
ulonglong max_of_int_range(int var_type);
ulonglong getopt_double2ulonglong(double);
double getopt_ulonglong2double(ulonglong);
C_MODE_END
#endif /* _my_getopt_h */

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,8 @@
/* Copyright (C) 2000 MySQL AB
/* 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; either version 2 of the License, or
(at your option) any later version.
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -12,7 +11,7 @@
You 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 */
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef _list_h_
#define _list_h_
@ -34,11 +33,11 @@ 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,gptr argument);
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((gptr) old,MYF(MY_FAE)); }
#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old); my_free(old); }
#ifdef __cplusplus
}

View File

@ -1,717 +0,0 @@
/* Copyright (C) 2000 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; 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Defines to make different thread packages compatible */
#ifndef _my_pthread_h
#define _my_pthread_h
#include <errno.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__) || defined(OS2)
#ifdef OS2
typedef ULONG HANDLE;
typedef ULONG DWORD;
typedef int sigset_t;
#endif
#ifdef OS2
typedef HMTX pthread_mutex_t;
#else
typedef CRITICAL_SECTION pthread_mutex_t;
#endif
typedef HANDLE pthread_t;
typedef struct thread_attr {
DWORD dwStackSize ;
DWORD dwCreatingFlag ;
int priority ;
} 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;
typedef struct {
uint32 waiting;
#ifdef OS2
HEV semaphore;
#else
HANDLE semaphore;
#endif
} pthread_cond_t;
#ifndef OS2
struct timespec { /* For pthread_cond_timedwait() */
time_t tv_sec;
long tv_nsec;
};
#endif
typedef int pthread_mutexattr_t;
#define win_pthread_self my_thread_var->pthread_self
#ifdef OS2
#define pthread_handler_t EXTERNC void * _Optlink
typedef void * (_Optlink *pthread_handler)(void *);
#else
#define pthread_handler_t EXTERNC void * __cdecl
typedef void * (__cdecl *pthread_handler)(void *);
#endif
void win_pthread_init(void);
int win_pthread_setspecific(void *A,void *B,uint length);
int pthread_create(pthread_t *,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,
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,DWORD stack);
int pthread_attr_setprio(pthread_attr_t *connect_att,int priority);
int pthread_attr_destroy(pthread_attr_t *connect_att);
struct tm *localtime_r(const time_t *timep,struct tm *tmp);
struct tm *gmtime_r(const time_t *timep,struct tm *tmp);
void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
#ifndef OS2
#define ETIMEDOUT 145 /* Win32 doesn't have this */
#define getpid() GetCurrentThreadId()
#endif
#define pthread_self() win_pthread_self
#define HAVE_LOCALTIME_R 1
#define _REENTRANT 1
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
#ifdef USE_TLS /* For LIBMYSQL.DLL */
#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 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 my_pthread_setspecific_ptr(T,V) (!TlsSetValue((T),(V)))
#define pthread_setspecific(A,B) (!TlsSetValue((A),(B)))
#else
#define pthread_key(T,V) __declspec(thread) T V
#define pthread_key_create(A,B) pthread_dummy(0)
#define pthread_key_delete(A) pthread_dummy(0)
#define pthread_getspecific(A) (&(A))
#define my_pthread_getspecific(T,A) (&(A))
#define my_pthread_getspecific_ptr(T,V) (V)
#define my_pthread_setspecific_ptr(T,V) ((T)=(V),0)
#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A))
#endif /* USE_TLS */
#define pthread_equal(A,B) ((A) == (B))
#ifdef OS2
extern int pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *);
extern int pthread_mutex_lock (pthread_mutex_t *);
extern int pthread_mutex_unlock (pthread_mutex_t *);
extern int pthread_mutex_destroy (pthread_mutex_t *);
#define my_pthread_setprio(A,B) DosSetPriority(PRTYS_THREAD,PRTYC_NOCHANGE, B, A)
#define pthread_kill(A,B) raise(B)
#define pthread_exit(A) pthread_dummy()
#else
#define pthread_mutex_init(A,B) (InitializeCriticalSection(A),0)
#define pthread_mutex_lock(A) (EnterCriticalSection(A),0)
#define pthread_mutex_trylock(A) (WaitForSingleObject((A), 0) == WAIT_TIMEOUT)
#define pthread_mutex_unlock(A) LeaveCriticalSection(A)
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
#define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B))
#define pthread_kill(A,B) pthread_dummy(0)
#endif /* OS2 */
/* Dummy defines for easier code */
#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
#define my_pthread_attr_setprio(A,B) pthread_attr_setprio(A,B)
#define pthread_attr_setscope(A,B)
#define pthread_detach_this_thread()
#define pthread_condattr_init(A)
#define pthread_condattr_destroy(A)
/*Irena: compiler does not like this: */
/*#define my_pthread_getprio(pthread_t thread_id) pthread_dummy(0) */
#define my_pthread_getprio(thread_id) pthread_dummy(0)
#elif defined(HAVE_UNIXWARE7_THREADS)
#include <thread.h>
#include <synch.h>
#ifndef _REENTRANT
#define _REENTRANT
#endif
#define HAVE_NONPOSIX_SIGWAIT
#define pthread_t thread_t
#define pthread_cond_t cond_t
#define pthread_mutex_t mutex_t
#define pthread_key_t thread_key_t
typedef int pthread_attr_t; /* Needed by Unixware 7.0.0 */
#define pthread_key_create(A,B) thr_keycreate((A),(B))
#define pthread_key_delete(A) thr_keydelete(A)
#define pthread_handler_t EXTERNC void *
#define pthread_key(T,V) pthread_key_t V
void * my_pthread_getspecific_imp(pthread_key_t key);
#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B))
#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,V)
#define pthread_setspecific(A,B) thr_setspecific(A,B)
#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,V)
#define pthread_create(A,B,C,D) thr_create(NULL,65536L,(C),(D),THR_DETACHED,(A))
#define pthread_cond_init(a,b) cond_init((a),USYNC_THREAD,NULL)
#define pthread_cond_destroy(a) cond_destroy(a)
#define pthread_cond_signal(a) cond_signal(a)
#define pthread_cond_wait(a,b) cond_wait((a),(b))
#define pthread_cond_timedwait(a,b,c) cond_timedwait((a),(b),(c))
#define pthread_cond_broadcast(a) cond_broadcast(a)
#define pthread_mutex_init(a,b) mutex_init((a),USYNC_THREAD,NULL)
#define pthread_mutex_lock(a) mutex_lock(a)
#define pthread_mutex_unlock(a) mutex_unlock(a)
#define pthread_mutex_destroy(a) mutex_destroy(a)
#define pthread_self() thr_self()
#define pthread_exit(A) thr_exit(A)
#define pthread_equal(A,B) (((A) == (B)) ? 1 : 0)
#define pthread_kill(A,B) thr_kill((A),(B))
#define HAVE_PTHREAD_KILL
#define pthread_sigmask(A,B,C) thr_sigsetmask((A),(B),(C))
extern int my_sigwait(const sigset_t *set,int *sig);
#define pthread_detach_this_thread() pthread_dummy(0)
#define pthread_attr_init(A) pthread_dummy(0)
#define pthread_attr_destroy(A) pthread_dummy(0)
#define pthread_attr_setscope(A,B) pthread_dummy(0)
#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
#define my_pthread_setprio(A,B) pthread_dummy (0)
#define my_pthread_getprio(A) pthread_dummy (0)
#define my_pthread_attr_setprio(A,B) pthread_dummy(0)
#else /* Normal threads */
#ifdef HAVE_rts_threads
#define sigwait org_sigwait
#include <signal.h>
#undef sigwait
#endif
#include <pthread.h>
#ifndef _REENTRANT
#define _REENTRANT
#endif
#ifdef HAVE_THR_SETCONCURRENCY
#include <thread.h> /* Probably solaris */
#endif
#ifdef HAVE_SCHED_H
#include <sched.h>
#endif
#ifdef HAVE_SYNCH_H
#include <synch.h>
#endif
#if defined(__EMX__) && (!defined(EMX_PTHREAD_REV) || (EMX_PTHREAD_REV < 2))
#error Requires at least rev 2 of EMX pthreads library.
#endif
#ifdef __NETWARE__
void my_pthread_exit(void *status);
#define pthread_exit(A) my_pthread_exit(A)
#endif
extern int my_pthread_getprio(pthread_t thread_id);
#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 *);
/* 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
#elif defined(HAVE_mit_thread)
#define USE_ALARM_THREAD
#undef HAVE_LOCALTIME_R
#define HAVE_LOCALTIME_R
#undef HAVE_GMTIME_R
#define HAVE_GMTIME_R
#undef HAVE_PTHREAD_ATTR_SETSCOPE
#define HAVE_PTHREAD_ATTR_SETSCOPE
#undef HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE /* If we are running linux */
#undef HAVE_RWLOCK_T
#undef HAVE_RWLOCK_INIT
#undef HAVE_PTHREAD_RWLOCK_RDLOCK
#undef HAVE_SNPRINTF
#define my_pthread_attr_setprio(A,B)
#endif /* defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM) */
#if defined(_BSDI_VERSION) && _BSDI_VERSION < 199910
int sigwait(sigset_t *set, int *sig);
#endif
#ifndef HAVE_NONPOSIX_SIGWAIT
#define my_sigwait(A,B) sigwait((A),(B))
#else
int my_sigwait(const sigset_t *set,int *sig);
#endif
#ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT
#ifndef SAFE_MUTEX
#define pthread_mutex_init(a,b) my_pthread_mutex_init((a),(b))
extern int my_pthread_mutex_init(pthread_mutex_t *mp,
const pthread_mutexattr_t *attr);
#endif /* SAFE_MUTEX */
#define pthread_cond_init(a,b) my_pthread_cond_init((a),(b))
extern int my_pthread_cond_init(pthread_cond_t *mp,
const pthread_condattr_t *attr);
#endif /* HAVE_NONPOSIX_PTHREAD_MUTEX_INIT */
#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_mit_thread) && !defined(HAVE_rts_threads) && !defined(sigwait) && !defined(alpha_linux_port) && !defined(HAVE_NONPOSIX_SIGWAIT) && !defined(HAVE_DEC_3_2_THREADS) && !defined(_AIX)
int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
#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 s; sigset_t set; \
sigemptyset(&set); \
s.sa_handler = (B); \
s.sa_mask = set; \
s.sa_flags = 0; \
sigaction((A), &s, (struct sigaction *) 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
#ifndef my_pthread_setprio
#if defined(HAVE_PTHREAD_SETPRIO_NP) /* FSU threads */
#define my_pthread_setprio(A,B) pthread_setprio_np((A),(B))
#elif defined(HAVE_PTHREAD_SETPRIO)
#define my_pthread_setprio(A,B) pthread_setprio((A),(B))
#else
extern void my_pthread_setprio(pthread_t thread_id,int prior);
#endif
#endif
#ifndef my_pthread_attr_setprio
#ifdef HAVE_PTHREAD_ATTR_SETPRIO
#define my_pthread_attr_setprio(A,B) pthread_attr_setprio((A),(B))
#else
extern void my_pthread_attr_setprio(pthread_attr_t *attr, int priority);
#endif
#endif
#if !defined(HAVE_PTHREAD_ATTR_SETSCOPE) || defined(HAVE_DEC_3_2_THREADS)
#define pthread_attr_setscope(A,B)
#undef HAVE_GETHOSTBYADDR_R /* No definition */
#endif
#if defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT) && !defined(SAFE_MUTEX)
extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mutex,
struct timespec *abstime);
#define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C))
#endif
#if defined(OS2)
#define my_pthread_getspecific(T,A) ((T) &(A))
#define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A))
#elif !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC)
#define my_pthread_getspecific(A,B) ((A) pthread_getspecific(B))
#else
#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B))
void *my_pthread_getspecific_imp(pthread_key_t key);
#endif /* OS2 */
#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
#ifdef HAVE_CTHREADS_WRAPPER /* For MacOSX */
#define pthread_cond_destroy(A) pthread_dummy(0)
#define pthread_mutex_destroy(A) pthread_dummy(0)
#define pthread_attr_delete(A) pthread_dummy(0)
#define pthread_condattr_delete(A) pthread_dummy(0)
#define pthread_attr_setstacksize(A,B) pthread_dummy(0)
#define pthread_equal(A,B) ((A) == (B))
#define pthread_cond_timedwait(a,b,c) pthread_cond_wait((a),(b))
#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))
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
#define pthread_kill(A,B) pthread_dummy(0)
#undef pthread_detach_this_thread
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
#endif
#ifdef HAVE_DARWIN5_THREADS
#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C))
#define pthread_kill(A,B) pthread_dummy(0)
#define pthread_condattr_init(A) pthread_dummy(0)
#define pthread_condattr_destroy(A) pthread_dummy(0)
#undef pthread_detach_this_thread
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); }
#endif
#if ((defined(HAVE_PTHREAD_ATTR_CREATE) && !defined(HAVE_SIGWAIT)) || defined(HAVE_DEC_3_2_THREADS)) && !defined(HAVE_CTHREADS_WRAPPER)
/* 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(0)
#undef pthread_detach_this_thread
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
#elif !defined(__NETWARE__) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */
#define HAVE_PTHREAD_KILL
#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
/* safe_mutex adds checking to mutex for easier debugging */
#if defined(__NETWARE__) && !defined(SAFE_MUTEX_DETECT_DESTROY)
#define SAFE_MUTEX_DETECT_DESTROY
#endif
typedef struct st_safe_mutex_t
{
pthread_mutex_t global,mutex;
const char *file;
uint line,count;
pthread_t thread;
#ifdef SAFE_MUTEX_DETECT_DESTROY
struct st_safe_mutex_info_t *info; /* to track destroying of mutexes */
#endif
} safe_mutex_t;
#ifdef SAFE_MUTEX_DETECT_DESTROY
/*
Used to track the destroying of mutexes. This needs to be a seperate
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 *file, uint line);
int safe_mutex_lock(safe_mutex_t *mp,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,
struct timespec *abstime, const char *file, uint line);
void safe_mutex_global_init(void);
void safe_mutex_end(FILE *file);
/* Wrappers if safe mutex is actually used */
#ifdef SAFE_MUTEX
#undef pthread_mutex_init
#undef pthread_mutex_lock
#undef pthread_mutex_unlock
#undef pthread_mutex_destroy
#undef pthread_mutex_wait
#undef pthread_mutex_timedwait
#undef pthread_mutex_t
#undef pthread_cond_wait
#undef pthread_cond_timedwait
#undef pthread_mutex_trylock
#define pthread_mutex_init(A,B) safe_mutex_init((A),(B),__FILE__,__LINE__)
#define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__)
#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__)
#define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__)
#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__)
#define pthread_mutex_trylock(A) pthread_mutex_lock(A)
#define pthread_mutex_t safe_mutex_t
#define safe_mutex_assert_owner(mp) \
DBUG_ASSERT((mp)->count > 0 && \
pthread_equal(pthread_self(), (mp)->thread))
#define safe_mutex_assert_not_owner(mp) \
DBUG_ASSERT(! (mp)->count || \
! pthread_equal(pthread_self(), (mp)->thread))
#else
#define safe_mutex_assert_owner(mp)
#define safe_mutex_assert_not_owner(mp)
#endif /* SAFE_MUTEX */
/* READ-WRITE thread locking */
#ifdef HAVE_BROKEN_RWLOCK /* For OpenUnix */
#undef HAVE_PTHREAD_RWLOCK_RDLOCK
#undef HAVE_RWLOCK_INIT
#undef HAVE_RWLOCK_T
#endif
#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 */
typedef struct _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 */
} my_rw_lock_t;
#define rw_lock_t my_rw_lock_t
#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_rwlock_destroy((A))
extern int my_rwlock_init(my_rw_lock_t *, void *);
extern int my_rwlock_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 *);
#endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */
#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
extern my_bool my_thread_global_init(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 long my_thread_id(void);
extern int pthread_no_free(void *);
extern int pthread_dummy(int);
/* All thread specific variables are in the following struct */
#define THREAD_NAME_SIZE 10
#ifndef DEFAULT_THREAD_STACK
#if SIZEOF_CHARP > 4
/*
MySQL can survive with 32K, but some glibc libraries require > 128K stack
To resolve hostnames. Also recursive stored procedures needs stack.
*/
#define DEFAULT_THREAD_STACK (256*1024L)
#else
#define DEFAULT_THREAD_STACK (192*1024)
#endif
#endif
struct st_my_thread_var
{
int thr_errno;
pthread_cond_t suspend;
pthread_mutex_t mutex;
pthread_mutex_t * volatile current_mutex;
pthread_cond_t * volatile current_cond;
pthread_t pthread_self;
long id;
int cmp_length;
int volatile abort;
my_bool init;
struct st_my_thread_var *next,**prev;
void *opt_info;
#ifndef DBUG_OFF
gptr dbug;
char name[THREAD_NAME_SIZE+1];
#endif
};
extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
#define my_thread_var (_my_thread_var())
#define my_errno my_thread_var->thr_errno
/*
Keep track of shutdown,signal, and main threads so that my_end() will not
report errors with them
*/
extern pthread_t shutdown_th, main_th, signal_th;
/* statistics_xxx functions are for not essential statistic */
#ifndef thread_safe_increment
#ifdef HAVE_ATOMIC_ADD
#define thread_safe_increment(V,L) atomic_inc((atomic_t*) &V)
#define thread_safe_decrement(V,L) atomic_dec((atomic_t*) &V)
#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V)
#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V)
#else
#define thread_safe_increment(V,L) \
(pthread_mutex_lock((L)), (V)++, pthread_mutex_unlock((L)))
#define thread_safe_decrement(V,L) \
(pthread_mutex_lock((L)), (V)--, pthread_mutex_unlock((L)))
#define thread_safe_add(V,C,L) (pthread_mutex_lock((L)), (V)+=(C), pthread_mutex_unlock((L)))
#define thread_safe_sub(V,C,L) \
(pthread_mutex_lock((L)), (V)-=(C), pthread_mutex_unlock((L)))
#endif /* HAVE_ATOMIC_ADD */
#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))
#else
#define statistic_decrement(V,L) (V)--
#define statistic_increment(V,L) (V)++
#define statistic_add(V,C,L) (V)+=(C)
#endif /* SAFE_STATISTICS */
#endif /* thread_safe_increment */
#ifdef __cplusplus
}
#endif
#endif /* _my_ptread_h */

File diff suppressed because it is too large Load Diff

186
3rdparty/mysql/include/my_thread.h vendored Normal file
View File

@ -0,0 +1,186 @@
/* 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 Street, Fifth Floor, Boston, MA 02110-1301, USA */
/* Defines to make different thread packages compatible */
#ifndef MY_THREAD_INCLUDED
#define MY_THREAD_INCLUDED
#include "my_global.h" /* my_bool */
#if !defined(_WIN32)
#include <pthread.h>
#endif
#ifndef ETIME
#define ETIME ETIMEDOUT /* For FreeBSD */
#endif
#ifndef ETIMEDOUT
#define ETIMEDOUT 145 /* Win32 doesn't have this */
#endif
/*
MySQL can survive with 32K, but some glibc libraries require > 128K stack
To resolve hostnames. Also recursive stored procedures needs stack.
*/
#if SIZEOF_CHARP > 4
#define DEFAULT_THREAD_STACK (256*1024L)
#else
#define DEFAULT_THREAD_STACK (192*1024)
#endif
#ifdef __cplusplus
#define EXTERNC extern "C"
#else
#define EXTERNC
#endif
C_MODE_START
#ifdef _WIN32
typedef volatile LONG my_thread_once_t;
typedef DWORD my_thread_t;
typedef struct thread_attr
{
DWORD dwStackSize;
int detachstate;
} my_thread_attr_t;
#define MY_THREAD_CREATE_JOINABLE 0
#define MY_THREAD_CREATE_DETACHED 1
typedef void * (__cdecl *my_start_routine)(void *);
#define MY_THREAD_ONCE_INIT 0
#define MY_THREAD_ONCE_INPROGRESS 1
#define MY_THREAD_ONCE_DONE 2
#else
typedef pthread_once_t my_thread_once_t;
typedef pthread_t my_thread_t;
typedef pthread_attr_t my_thread_attr_t;
#define MY_THREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE
#define MY_THREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED
typedef void *(* my_start_routine)(void *);
#define MY_THREAD_ONCE_INIT PTHREAD_ONCE_INIT
#endif
typedef struct st_my_thread_handle
{
my_thread_t thread;
#ifdef _WIN32
HANDLE handle;
#endif
} my_thread_handle;
int my_thread_once(my_thread_once_t *once_control, void (*init_routine)(void));
static inline my_thread_t my_thread_self()
{
#ifdef _WIN32
return GetCurrentThreadId();
#else
return pthread_self();
#endif
}
static inline int my_thread_equal(my_thread_t t1, my_thread_t t2)
{
#ifdef _WIN32
return t1 == t2;
#else
return pthread_equal(t1, t2);
#endif
}
static inline int my_thread_attr_init(my_thread_attr_t *attr)
{
#ifdef _WIN32
attr->dwStackSize= 0;
/* Set to joinable by default to match Linux */
attr->detachstate= MY_THREAD_CREATE_JOINABLE;
return 0;
#else
return pthread_attr_init(attr);
#endif
}
static inline int my_thread_attr_destroy(my_thread_attr_t *attr)
{
#ifdef _WIN32
attr->dwStackSize= 0;
/* Set to joinable by default to match Linux */
attr->detachstate= MY_THREAD_CREATE_JOINABLE;
return 0;
#else
return pthread_attr_destroy(attr);
#endif
}
static inline int my_thread_attr_setstacksize(my_thread_attr_t *attr,
size_t stacksize)
{
#ifdef _WIN32
attr->dwStackSize= (DWORD)stacksize;
return 0;
#else
return pthread_attr_setstacksize(attr, stacksize);
#endif
}
static inline int my_thread_attr_setdetachstate(my_thread_attr_t *attr,
int detachstate)
{
#ifdef _WIN32
attr->detachstate= detachstate;
return 0;
#else
return pthread_attr_setdetachstate(attr, detachstate);
#endif
}
static inline int my_thread_attr_getstacksize(my_thread_attr_t *attr,
size_t *stacksize)
{
#ifdef _WIN32
*stacksize= (size_t)attr->dwStackSize;
return 0;
#else
return pthread_attr_getstacksize(attr, stacksize);
#endif
}
static inline void my_thread_yield()
{
#ifdef _WIN32
SwitchToThread();
#else
sched_yield();
#endif
}
int my_thread_create(my_thread_handle *thread, const my_thread_attr_t *attr,
my_start_routine func, void *arg);
int my_thread_join(my_thread_handle *thread, void **value_ptr);
int my_thread_cancel(my_thread_handle *thread);
void my_thread_exit(void *value_ptr);
extern my_bool my_thread_global_init();
extern void my_thread_global_reinit();
extern void my_thread_global_end();
extern my_bool my_thread_init();
extern void my_thread_end();
C_MODE_END
#endif /* MY_THREAD_INCLUDED */

107
3rdparty/mysql/include/my_thread_local.h vendored Normal file
View File

@ -0,0 +1,107 @@
/* Copyright (c) 2000, 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
#ifndef MY_THREAD_LOCAL_INCLUDED
#define MY_THREAD_LOCAL_INCLUDED
#ifndef _WIN32
#include <pthread.h>
#endif
struct _db_code_state_;
typedef uint32 my_thread_id;
C_MODE_START
#ifdef _WIN32
typedef DWORD thread_local_key_t;
#else
typedef pthread_key_t thread_local_key_t;
#endif
static inline int my_create_thread_local_key(thread_local_key_t *key,
void (*destructor)(void *))
{
#ifdef _WIN32
*key= TlsAlloc();
return (*key == TLS_OUT_OF_INDEXES);
#else
return pthread_key_create(key, destructor);
#endif
}
static inline int my_delete_thread_local_key(thread_local_key_t key)
{
#ifdef _WIN32
return !TlsFree(key);
#else
return pthread_key_delete(key);
#endif
}
static inline void* my_get_thread_local(thread_local_key_t key)
{
#ifdef _WIN32
return TlsGetValue(key);
#else
return pthread_getspecific(key);
#endif
}
static inline int my_set_thread_local(thread_local_key_t key,
void *value)
{
#ifdef _WIN32
return !TlsSetValue(key, value);
#else
return pthread_setspecific(key, value);
#endif
}
/**
Retrieve the MySQL thread-local storage variant of errno.
*/
int my_errno();
/**
Set the MySQL thread-local storage variant of errno.
*/
void set_my_errno(int my_errno);
#ifdef _WIN32
/*
thr_winerr is used for returning the original OS error-code in Windows,
my_osmaperr() returns EINVAL for all unknown Windows errors, hence we
preserve the original Windows Error code in thr_winerr.
*/
int thr_winerr();
void set_thr_winerr(int winerr);
#endif
#ifndef DBUG_OFF
/* Return pointer to DBUG for holding current state */
struct _db_code_state_ **my_thread_var_dbug();
my_thread_id my_thread_var_id();
void set_my_thread_var_id(my_thread_id id);
#endif
C_MODE_END
#endif // MY_THREAD_LOCAL_INCLUDED

96
3rdparty/mysql/include/my_xml.h vendored Normal file
View File

@ -0,0 +1,96 @@
/* Copyright (c) 2000, 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-1301, 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 */

View File

@ -1,9 +1,8 @@
/* Copyright (C) 2000-2003 MySQL AB
/* 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; either version 2 of the License, or
(at your option) any later version.
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -12,71 +11,80 @@
You 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 */
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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 __CYGWIN__ /* CYGWIN implements a UNIX API */
#undef WIN
#undef _WIN
#undef _WIN32
#undef _WIN64
#undef __WIN__
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _global_h /* If not standard header */
#ifndef MY_GLOBAL_INCLUDED /* If not standard header */
#ifndef MYSQL_ABI_CHECK
#include <sys/types.h>
#ifdef __LCC__
#include <winsock.h> /* For windows */
#endif
typedef char my_bool;
#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)
#define __WIN__
#endif
#if !defined(__WIN__)
#if !defined(_WIN32)
#define STDCALL
#else
#define STDCALL __stdcall
#endif
typedef char * gptr;
#ifndef my_socket_defined
#ifdef __WIN__
#ifdef _WIN32
#include <windows.h>
#ifdef WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#endif
#define my_socket SOCKET
#else
typedef int my_socket;
#endif /* __WIN__ */
#endif /* _WIN32 */
#endif /* my_socket_defined */
#endif /* _global_h */
#endif /* MY_GLOBAL_INCLUDED */
#include "mysql_version.h"
#include "mysql_com.h"
#include "mysql_time.h"
#include "mysql_version.h"
#include "typelib.h"
#include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */
/* Include declarations of plug-in API */
#include "mysql/client_plugin.h"
/*
Declare my_init() here because it is a documented C API function exported
from the client library. No need to include whole my_sys.h, however.
*/
my_bool my_init(void);
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 */
#ifdef __NETWARE__
#pragma pack(push, 8) /* 8 byte alignment */
#endif
#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) <= FIELD_TYPE_INT24 || (t) == FIELD_TYPE_YEAR || (t) == FIELD_TYPE_NEWDECIMAL)
#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG)
#define INTERNAL_NUM_FIELD(f) (((f)->type <= FIELD_TYPE_INT24 && ((f)->type != FIELD_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == FIELD_TYPE_YEAR)
/**
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_field {
@ -100,21 +108,22 @@ typedef struct st_mysql_field {
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 _global_h
#if defined(NO_CLIENT_LONG_LONG)
typedef unsigned long my_ulonglong;
#elif defined (__WIN__)
#ifndef MY_GLOBAL_INCLUDED
#if defined (_WIN32)
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 */
@ -132,15 +141,16 @@ typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */
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;
MYSQL_ROWS *data;
MEM_ROOT alloc;
/* extra info for embedded library */
struct embedded_query_result *embedded_info;
void *extension;
} MYSQL_DATA;
enum mysql_option
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,
@ -149,9 +159,29 @@ enum mysql_option
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_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,
MYSQL_OPT_SSL_ENFORCE,
MYSQL_OPT_MAX_ALLOWED_PACKET, MYSQL_OPT_NET_BUFFER_LENGTH,
MYSQL_OPT_TLS_VERSION,
MYSQL_OPT_SSL_MODE
};
/**
@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;
@ -166,30 +196,28 @@ struct st_mysql_options {
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 use_ssl; /* Deprecated ! Former use_ssl */
my_bool compress,named_pipe;
/*
On connect, find out the replication role of the server, and
establish connections to all the peers
*/
my_bool rpl_probe;
/*
Each call to mysql_real_query() will parse it to tell if it is a read
or a write, and direct it to the slave or the master
*/
my_bool rpl_parse;
/*
If set, never read from a master, only from slave, when doing
a read that is replication-aware
*/
my_bool no_master_reads;
#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY)
my_bool separate_thread;
#endif
my_bool unused1;
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;
union {
/*
The ip/hostname to use when authenticating
client against embedded server built with
grant tables - only used in embedded server
*/
char *client_ip;
/*
The local address to bind when connecting to
remote server - not used in embedded server
*/
char *bind_address;
} ci;
my_bool unused5;
/* 0 - never report, 1 - always report (default) */
my_bool report_data_truncation;
@ -199,26 +227,25 @@ struct st_mysql_options {
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
enum mysql_status
{
MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT
MYSQL_STATUS_READY, MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT,
MYSQL_STATUS_STATEMENT_GET_RESULT
};
enum mysql_protocol_type
enum mysql_protocol_type
{
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
};
/*
There are three types of queries - the ones that have to go to
the master, the ones that go to a slave, and the adminstrative
type which must happen on the pivot connectioin
*/
enum mysql_rpl_type
enum mysql_ssl_mode
{
MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
SSL_MODE_DISABLED= 1, SSL_MODE_PREFERRED, SSL_MODE_REQUIRED,
SSL_MODE_VERIFY_CA, SSL_MODE_VERIFY_IDENTITY
};
typedef struct character_set
@ -234,13 +261,14 @@ typedef struct character_set
} MY_CHARSET_INFO;
struct st_mysql_methods;
struct st_mysql_stmt;
typedef struct st_mysql
{
NET net; /* Communication parameters */
gptr connector_fd; /* ConnectorFd for SSL */
char *host,*user,*passwd,*unix_socket,*server_version,*host_info,*info;
char *db;
unsigned char *connector_fd; /* ConnectorFd for SSL */
char *host,*user,*passwd,*unix_socket,*server_version,*host_info;
char *info, *db;
struct charset_info_st *charset;
MYSQL_FIELD *fields;
MEM_ROOT field_alloc;
@ -263,85 +291,57 @@ typedef struct st_mysql
/* session-wide random string */
char scramble[SCRAMBLE_LENGTH+1];
/*
Set if this is the original connection, not a master or a slave we have
added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave()
*/
my_bool rpl_pivot;
/*
Pointers to the master, and the next slave connections, points to
itself if lone connection.
*/
struct st_mysql* master, *next_slave;
struct st_mysql* last_used_slave; /* needed for round-robin slave pick */
/* needed for send/read/store/use result to work correctly with replication */
struct st_mysql* last_used_con;
my_bool unused1;
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
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;
#if defined(EMBEDDED_LIBRARY) || defined(EMBEDDED_LIBRARY_COMPATIBLE) || MYSQL_VERSION_ID >= 50100
/* needed for embedded server - no net buffer to store the 'info' */
char *info_buffer;
#endif
void *extension;
} MYSQL;
typedef struct st_mysql_res {
my_ulonglong row_count;
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 */
MEM_ROOT field_alloc;
unsigned int field_count, current_field;
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;
const struct st_mysql_methods *methods;
my_bool unbuffered_fetch_cancelled;
void *extension;
} MYSQL_RES;
#define MAX_MYSQL_MANAGER_ERR 256
#define MAX_MYSQL_MANAGER_MSG 256
#define MANAGER_OK 200
#define MANAGER_INFO 250
#define MANAGER_ACCESS 401
#define MANAGER_CLIENT_ERR 450
#define MANAGER_INTERNAL_ERR 500
#if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT)
#define MYSQL_CLIENT
#endif
typedef struct st_mysql_manager
{
NET net;
char *host,*user,*passwd;
unsigned int port;
my_bool free_me;
my_bool eof;
int cmd_status;
int last_errno;
char* net_buf,*net_buf_pos,*net_data_end;
int net_buf_size;
char last_error[MAX_MYSQL_MANAGER_ERR];
} MYSQL_MANAGER;
/*
Note: MYSQL_PARAMETERS and mysql_get_parameters() have been removed
in server 5.7. But we keep them here to not break compatibility in
Con/C 6.1 series.
*/
typedef struct st_mysql_parameters
{
unsigned long *p_max_allowed_packet;
unsigned long *p_net_buffer_length;
void *extension;
} MYSQL_PARAMETERS;
#if !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
@ -349,6 +349,8 @@ typedef struct st_mysql_parameters
#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length)
#endif
MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void);
/*
Set up and bring down the server; to ensure that applications will
work when linked against either the standard client library or the
@ -356,6 +358,7 @@ typedef struct st_mysql_parameters
*/
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
@ -368,7 +371,6 @@ void STDCALL mysql_server_end(void);
#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
@ -409,7 +411,8 @@ 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);
my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
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,
@ -427,19 +430,17 @@ int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql);
/* perform query on master */
my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
unsigned long length);
/* perform query on slave */
my_bool STDCALL mysql_slave_query(MYSQL *mysql, const char *q,
unsigned long length);
my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
unsigned long length);
void STDCALL mysql_get_character_set_info(MYSQL *mysql,
MY_CHARSET_INFO *charset);
int STDCALL mysql_session_track_get_first(MYSQL *mysql,
enum enum_session_state_type type,
const char **data,
size_t *length);
int STDCALL mysql_session_track_get_next(MYSQL *mysql,
enum enum_session_state_type type,
const char **data,
size_t *length);
/* local infile support */
#define LOCAL_INFILE_ERROR_LEN 512
@ -458,37 +459,6 @@ mysql_set_local_infile_handler(MYSQL *mysql,
void
mysql_set_local_infile_default(MYSQL *mysql);
/*
enable/disable parsing of all queries to decide if they go on master or
slave
*/
void STDCALL mysql_enable_rpl_parse(MYSQL* mysql);
void STDCALL mysql_disable_rpl_parse(MYSQL* mysql);
/* get the value of the parse flag */
int STDCALL mysql_rpl_parse_enabled(MYSQL* mysql);
/* enable/disable reads from master */
void STDCALL mysql_enable_reads_from_master(MYSQL* mysql);
void STDCALL mysql_disable_reads_from_master(MYSQL* mysql);
/* get the value of the master read flag */
my_bool STDCALL mysql_reads_from_master_enabled(MYSQL* mysql);
enum mysql_rpl_type STDCALL mysql_rpl_query_type(const char* q, int len);
/* discover the master and its slaves */
my_bool STDCALL mysql_rpl_probe(MYSQL* mysql);
/* set the master, close/free the old one, if it is not a pivot */
int STDCALL mysql_set_master(MYSQL* mysql, const char* host,
unsigned int port,
const char* user,
const char* passwd);
int STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
unsigned int port,
const char* user,
const char* passwd);
int STDCALL mysql_shutdown(MYSQL *mysql,
enum mysql_enum_shutdown_level
shutdown_level);
@ -511,7 +481,11 @@ 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_processes(MYSQL *mysql);
int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
const char *arg);
const void *arg);
int STDCALL mysql_options4(MYSQL *mysql,enum mysql_option option,
const void *arg1, const void *arg2);
int STDCALL mysql_get_option(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,
my_ulonglong offset);
@ -531,37 +505,18 @@ unsigned long STDCALL mysql_hex_string(char *to,const char *from,
unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
char *to,const char *from,
unsigned long length);
void STDCALL mysql_debug(const char *debug);
char * STDCALL mysql_odbc_escape_string(MYSQL *mysql,
char *to,
unsigned long to_length,
const char *from,
unsigned long from_length,
void *param,
char *
(*extend_buffer)
(void *, char *to,
unsigned long *length));
void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name);
unsigned int STDCALL mysql_thread_safe(void);
my_bool STDCALL mysql_embedded(void);
MYSQL_MANAGER* STDCALL mysql_manager_init(MYSQL_MANAGER* con);
MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con,
const char* host,
const char* user,
const char* passwd,
unsigned int port);
void STDCALL mysql_manager_close(MYSQL_MANAGER* con);
int STDCALL mysql_manager_command(MYSQL_MANAGER* con,
const char* cmd, int cmd_len);
int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con,
char* res_buf,
int res_buf_size);
my_bool STDCALL mysql_read_query_result(MYSQL *mysql);
unsigned long STDCALL mysql_real_escape_string_quote(MYSQL *mysql,
char *to, const char *from,
unsigned long length, char quote);
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 mysql_read_query_result(MYSQL *mysql);
int STDCALL mysql_reset_connection(MYSQL *mysql);
/*
The following definitions are added for the enhanced
The following definitions are added for the enhanced
client-server protocol
*/
@ -643,26 +598,29 @@ typedef struct st_mysql_bind
void *buffer; /* buffer to get/put data */
/* set this if you want to track data truncations happened during fetch */
my_bool *error;
enum enum_field_types buffer_type; /* buffer type */
/* output buffer length, must be set when fetching str/binary */
unsigned long buffer_length;
unsigned char *row_ptr; /* for the current data position */
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 */
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 (*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
{
@ -674,15 +632,15 @@ typedef struct st_mysql_stmt
MYSQL_FIELD *fields; /* result set metadata */
MYSQL_DATA result; /* cached result set */
MYSQL_ROWS *data_cursor; /* current row in cached result */
/* copy of mysql->affected_rows after statement execution */
my_ulonglong affected_rows;
my_ulonglong insert_id; /* copy of mysql->insert_id */
/*
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,
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 */
@ -702,19 +660,20 @@ typedef struct st_mysql_stmt
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;
my_bool unbuffered_fetch_cancelled;
/*
Is set to true if we need to calculate field->max_length for
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;
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,
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.
@ -733,43 +692,12 @@ enum enum_stmt_attr_type
};
typedef struct st_mysql_methods
{
my_bool (*read_query_result)(MYSQL *mysql);
my_bool (*advanced_command)(MYSQL *mysql,
enum enum_server_command command,
const char *header,
unsigned long header_length,
const char *arg,
unsigned long arg_length,
my_bool skip_check);
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);
#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_change_user_result)(MYSQL *mysql, char *buff, const char *passwd);
int (*read_rows_from_cursor)(MYSQL_STMT *stmt);
#endif
} MYSQL_METHODS;
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,
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);
@ -785,16 +713,16 @@ 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,
my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt,
unsigned int param_number,
const char *data,
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 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);
@ -808,6 +736,7 @@ my_bool STDCALL mysql_rollback(MYSQL * mysql);
my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
my_bool STDCALL mysql_more_results(MYSQL *mysql);
int STDCALL mysql_next_result(MYSQL *mysql);
int STDCALL mysql_stmt_next_result(MYSQL_STMT *stmt);
void STDCALL mysql_close(MYSQL *sock);
@ -817,29 +746,8 @@ void STDCALL mysql_close(MYSQL *sock);
#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);
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
#endif
#define HAVE_MYSQL_REAL_CONNECT
/*
The following functions are mainly exported because of mysqlbinlog;
They are not for general usage
*/
#define simple_command(mysql, command, arg, length, skip_check) \
(*(mysql)->methods->advanced_command)(mysql, command, \
NullS, 0, arg, length, skip_check)
unsigned long net_safe_read(MYSQL* mysql);
#ifdef __NETWARE__
#pragma pack(pop) /* restore alignment */
#endif
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,28 @@
/* Copyright (c) 2012, 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 CLIENT_AUTHENTICATION_H
#define CLIENT_AUTHENTICATION_H
#include <my_global.h>
#include "mysql.h"
#include "mysql/client_plugin.h"
C_MODE_START
int sha256_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql);
int sha256_password_init(char *, size_t, int, va_list);
int sha256_password_deinit(void);
C_MODE_END
#endif

View File

@ -0,0 +1,202 @@
#ifndef MYSQL_CLIENT_PLUGIN_INCLUDED
/* Copyright (c) 2010, 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-1301 USA */
/**
@file
MySQL Client Plugin API
This file defines the API for plugins that work on the client side
*/
#define MYSQL_CLIENT_PLUGIN_INCLUDED
#ifndef MYSQL_ABI_CHECK
#include <stdarg.h>
#include <stdlib.h>
#endif
/*
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)
#if defined(MYSQL_DYNAMIC_PLUGIN)
#ifdef __cplusplus
#define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport)
#else
#define MYSQL_PLUGIN_EXPORT __declspec(dllexport)
#endif
#else /* MYSQL_DYNAMIC_PLUGIN */
#ifdef __cplusplus
#define MYSQL_PLUGIN_EXPORT extern "C"
#else
#define MYSQL_PLUGIN_EXPORT
#endif
#endif /*MYSQL_DYNAMIC_PLUGIN */
#else /*_MSC_VER */
#define MYSQL_PLUGIN_EXPORT
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* known plugin types */
#define MYSQL_CLIENT_reserved1 0
#define MYSQL_CLIENT_reserved2 1
#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN 2
#define MYSQL_CLIENT_TRACE_PLUGIN 3
#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION 0x0100
#define MYSQL_CLIENT_TRACE_PLUGIN_INTERFACE_VERSION 0x0100
#define MYSQL_CLIENT_MAX_PLUGINS 4
#define mysql_declare_client_plugin(X) \
MYSQL_PLUGIN_EXPORT 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 */
#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;
/******** authentication plugin specific declarations *********/
#include "plugin_auth_common.h"
struct st_mysql_client_plugin_AUTHENTICATION
{
MYSQL_CLIENT_PLUGIN_HEADER
int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql);
};
/******** 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);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,39 @@
struct st_mysql_client_plugin
{
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;
#include "plugin_auth_common.h"
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;
} MYSQL_PLUGIN_VIO_INFO;
typedef struct st_plugin_vio
{
int (*read_packet)(struct st_plugin_vio *vio,
unsigned char **buf);
int (*write_packet)(struct st_plugin_vio *vio,
const unsigned char *packet,
int packet_len);
void (*info)(struct st_plugin_vio *vio, struct st_plugin_vio_info *info);
} MYSQL_PLUGIN_VIO;
struct st_mysql_client_plugin_AUTHENTICATION
{
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 *);
int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql);
};
struct st_mysql_client_plugin *
mysql_load_plugin(struct st_mysql *mysql, const char *name, int type,
int argc, ...);
struct st_mysql_client_plugin *
mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type,
int argc, va_list args);
struct st_mysql_client_plugin *
mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type);
struct st_mysql_client_plugin *
mysql_client_register_plugin(struct st_mysql *mysql,
struct st_mysql_client_plugin *plugin);
int mysql_plugin_options(struct st_mysql_client_plugin *plugin,
const char *option, const void *value);

View File

@ -0,0 +1,36 @@
/* 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-1301 USA */
/*
** Ask for a password from tty
** This is an own file to avoid conflicts with curses
*/
#ifndef MYSQL_GET_PASSWORD_H_INCLUDED
#define MYSQL_GET_PASSWORD_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
typedef char *(* strdup_handler_t)(const char *, int);
char *get_tty_password_ext(const char *opt_message,
strdup_handler_t strdup_function);
#ifdef __cplusplus
}
#endif
#endif /* ! MYSQL_GET_PASSWORD_H_INCLUDED */

View File

@ -0,0 +1,33 @@
/* Copyright (c) 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef MYSQL_LEX_STRING_INCLUDED
#define MYSQL_LEX_STRING_INCLUDED
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_LEX_CSTRING;
#endif // MYSQL_LEX_STRING_INCLUDED

View File

@ -0,0 +1,143 @@
#ifndef MYSQL_PLUGIN_AUTH_COMMON_INCLUDED
/* Copyright (c) 2010, 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-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 96
/**
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
/**
Flag to be passed back to server from authentication plugins via
authenticated_as when proxy mapping should be done by the server.
*/
#define PROXY_FLAG 0
/*
We need HANDLE definition if on Windows. Define WIN32_LEAN_AND_MEAN (if
not already done) to minimize amount of imported declarations.
*/
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#endif
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

View File

@ -0,0 +1,349 @@
/* Copyright (c) 2012, 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 PLUGIN_TRACE_INCLUDED
#define PLUGIN_TRACE_INCLUDED
/**
@file
========================================================================
Declarations for client-side plugins of type MYSQL_CLIENT_TRACE_PLUGIN
========================================================================
See libmysql/mysql_trace.c for a brief description of the client-side
protocol tracing infrastructure.
*/
#include <mysql/client_plugin.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
Lists of protocol stages and trace events
=========================================
These lists are defined with PROTOCOL_STAGE_LIST() and TRACE_EVENT_LIST(),
respectively. Macros accept a disposition name as an argument.
For example, to process list of protocol stages using disposition "foo",
define protocol_stage_foo(Stage) macro and then put
PROTOCOL_STAGE_LIST(foo)
in your code. This will expand to sequence of protocol_stage_foo(X)
macros where X ranges over the list of protocol stages, and these macros
should generate the actual code. See below how this technique is used
to generate protocol_stage and trace_events enums.
*/
/**
Protocol stages
---------------
A client following the MySQL protocol goes through several stages of it. Each
stage determines what packets can be expected from the server or can be send
by the client.
Upon receiving each trace event, trace plugin will be notified of the current
protocol stage so that it can correctly interpret the event.
These are the possible protocol stages and the transitions between them.
.. digraph:: protocol_stages
CONNECTING -> WAIT_FOR_INIT_PACKET;
CONNECTING -> DISCONNECTED [ label = "failed connection" ];
WAIT_FOR_INIT_PACKET -> AUTHENTICATE;
WAIT_FOR_INIT_PACKET -> SSL_NEGOTIATION -> AUTHENTICATE;
AUTHENTICATE -> READY_FOR_COMMAND [ label = "accepted" ];
AUTHENTICATE -> DISCONNECTED [ label = "rejected" ];
READY_FOR_COMMAND -> DISCONNECTED [ label = "COM_QUIT" ];
READY_FOR_COMMAND -> AUTHENTICATE [ label="after change user" ];
READY_FOR_COMMAND -> WAIT_FOR_PACKET
[ label="wait for a single packet after, e.g., COM_STATISTICS" ];
READY_FOR_COMMAND -> WAIT_FOR_RESULT;
READY_FOR_COMMAND -> WAIT_FOR_PS_DESCRIPTION
[ label="after prepare command" ];
WAIT_FOR_PACKET -> READY_FOR_COMAND;
WAIT_FOR_RESULT -> READY_FOR_COMMAND [ label="simple reply" ];
WAIT_FOR_RESULT -> WAIT_FOR_FIELD_DEF;
WAIT_FOR_RESULT -> FILE_REQUEST;
WAIT_FOR_FIELD_DEF -> WAIT_FOR_ROW [ label="in a resultset" ];
WAIT_FOR_FIELD_DEF -> READY_FOR_COMMAND
[ label="after describe table or prepare command" ];
WAIT_FOR_ROW -> READY_FOR_COMMAND;
WAIT_FOR_ROW -> WAIT_FOR_RESULT [ label="multi-resultset" ];
WAIT_FOR_PS_DESCRIPTION -> WAIT_FOR_PARAM_DEF;
WAIT_FOR_PS_DESCRIPTION -> READY_FOR_COMMAND
[ label="no params and result" ];
WAIT_FOR_PS_DESCRIPTION -> WAIT_FOR_FIELD_DEF [ label="no params" ];
WAIT_FOR_PARAM_DEF -> WAIT_FOR_FIELD_DEF;
WAIT_FOR_PARAM_DEF -> READY_FOR_COMMAND [ label="no result" ];
FILE_REQUEST -> WAIT_FOR_RESULT [label="when whole file sent"];
*/
#define PROTOCOL_STAGE_LIST(X) \
protocol_stage_ ## X(CONNECTING) \
protocol_stage_ ## X(WAIT_FOR_INIT_PACKET) \
protocol_stage_ ## X(AUTHENTICATE) \
protocol_stage_ ## X(SSL_NEGOTIATION) \
protocol_stage_ ## X(READY_FOR_COMMAND) \
protocol_stage_ ## X(WAIT_FOR_PACKET) \
protocol_stage_ ## X(WAIT_FOR_RESULT) \
protocol_stage_ ## X(WAIT_FOR_FIELD_DEF) \
protocol_stage_ ## X(WAIT_FOR_ROW) \
protocol_stage_ ## X(FILE_REQUEST) \
protocol_stage_ ## X(WAIT_FOR_PS_DESCRIPTION) \
protocol_stage_ ## X(WAIT_FOR_PARAM_DEF) \
protocol_stage_ ## X(DISCONNECTED)
/**
Trace events
------------
The following events are generated during the various stages of the
client-server conversation.
---------------------- -----------------------------------------------------
Connection events
---------------------- -----------------------------------------------------
CONNECTING Client is connecting to the server.
CONNECTED Physical connection has been established.
DISCONNECTED Connection with server was broken.
---------------------- -----------------------------------------------------
SSL events
---------------------- -----------------------------------------------------
SEND_SSL_REQUEST Client is sending SSL connection request.
SSL_CONNECT Client is initiating SSL handshake.
SSL_CONNECTED SSL connection has been established.
---------------------- -----------------------------------------------------
Authentication events
---------------------- -----------------------------------------------------
CHALLENGE_RECEIVED Client received authentication challenge.
AUTH_PLUGIN Client selects an authentication plugin to be used
in the following authentication exchange.
SEND_AUTH_RESPONSE Client sends response to the authentication
challenge.
SEND_AUTH_DATA Client sends extra authentication data packet.
AUTHENTICATED Server has accepted connection.
---------------------- -----------------------------------------------------
Command phase events
---------------------- -----------------------------------------------------
SEND_COMMAND Client is sending a command to the server.
SEND_FILE Client is sending local file contents to the server.
---------------------- -----------------------------------------------------
General events
---------------------- -----------------------------------------------------
READ_PACKET Client starts waiting for a packet from server.
PACKET_RECEIVED A packet from server has been received.
PACKET_SENT After successful sending of a packet to the server.
ERROR Client detected an error.
---------------------- -----------------------------------------------------
*/
#define TRACE_EVENT_LIST(X) \
trace_event_ ## X(ERROR) \
trace_event_ ## X(CONNECTING) \
trace_event_ ## X(CONNECTED) \
trace_event_ ## X(DISCONNECTED) \
trace_event_ ## X(SEND_SSL_REQUEST) \
trace_event_ ## X(SSL_CONNECT) \
trace_event_ ## X(SSL_CONNECTED) \
trace_event_ ## X(INIT_PACKET_RECEIVED) \
trace_event_ ## X(AUTH_PLUGIN) \
trace_event_ ## X(SEND_AUTH_RESPONSE) \
trace_event_ ## X(SEND_AUTH_DATA) \
trace_event_ ## X(AUTHENTICATED) \
trace_event_ ## X(SEND_COMMAND) \
trace_event_ ## X(SEND_FILE) \
trace_event_ ## X(READ_PACKET) \
trace_event_ ## X(PACKET_RECEIVED) \
trace_event_ ## X(PACKET_SENT)
/**
Some trace events have additional arguments. These are stored in
st_trace_event_args structure. Various events store their arguments in the
structure as follows. Unused members are set to 0/NULL.
AUTH_PLUGIN
------------- ----------------------------------
plugin_name the name of the plugin
------------- ----------------------------------
SEND_COMMAND
------------- ----------------------------------
cmd the command code
hdr pointer to command packet header
hdr_len length of the header
pkt pointer to command arguments
pkt_len length of arguments
------------- ----------------------------------
Other SEND_* and *_RECEIVED events
------------- ----------------------------------
pkt the data sent or received
pkt_len length of the data
------------- ----------------------------------
PACKET_SENT
------------- ----------------------------------
pkt_len number of bytes sent
------------- ----------------------------------
*/
struct st_trace_event_args
{
const char *plugin_name;
int cmd;
const unsigned char *hdr;
size_t hdr_len;
const unsigned char *pkt;
size_t pkt_len;
};
/* Definitions of protocol_stage and trace_event enums. */
#define protocol_stage_enum(X) PROTOCOL_STAGE_ ## X,
enum protocol_stage {
PROTOCOL_STAGE_LIST(enum)
PROTOCOL_STAGE_LAST
};
#define trace_event_enum(X) TRACE_EVENT_ ## X,
enum trace_event {
TRACE_EVENT_LIST(enum)
TRACE_EVENT_LAST
};
/*
Trace plugin methods
====================
*/
struct st_mysql_client_plugin_TRACE;
struct st_mysql;
/**
Trace plugin tracing_start() method.
Called when tracing with this plugin starts on a connection. A trace
plugin might want to maintain per-connection information. It can
return a pointer to memory area holding such information. It will be
stored in a connection handle and passed to other plugin methods.
@param self pointer to the plugin instance
@param connection_handle
@param stage protocol stage in which tracing has started - currently
it is always CONNECTING stage.
@return A pointer to plugin-specific, per-connection data if any.
*/
typedef
void* (tracing_start_callback)(struct st_mysql_client_plugin_TRACE *self,
struct st_mysql *connection_handle,
enum protocol_stage stage);
/**
Trace plugin tracing_stop() method.
Called when tracing of the connection has ended. If a plugin
allocated any per-connection resources, it should de-allocate them
here.
@param self pointer to the plugin instance
@param connection_handle
@param plugin_data pointer to plugin's per-connection data.
*/
typedef
void (tracing_stop_callback)(struct st_mysql_client_plugin_TRACE *self,
struct st_mysql *connection_handle,
void *plugin_data);
/**
Trace plugin trace_event() method.
Called when a trace event occurs. Plugin can decide to stop tracing
this connection by returning non-zero value.
@param self pointer to the plugin instance
@param plugin_data pointer to plugin's per-connection data
@param connection_handle
@param stage current protocol stage
@param event the trace event
@param args trace event arguments
@return Non-zero if tracing of the connection should end here.
*/
typedef
int (trace_event_handler)(struct st_mysql_client_plugin_TRACE *self,
void *plugin_data,
struct st_mysql *connection_handle,
enum protocol_stage stage,
enum trace_event event,
struct st_trace_event_args args);
struct st_mysql_client_plugin_TRACE
{
MYSQL_CLIENT_PLUGIN_HEADER
tracing_start_callback *tracing_start;
tracing_stop_callback *tracing_stop;
trace_event_handler *trace_event;
};
/**
The global trace_plugin pointer. If it is not NULL, it points at a
loaded trace plugin which should be used to trace all connections made
to the server.
*/
extern
struct st_mysql_client_plugin_TRACE *trace_plugin;
#ifndef DBUG_OFF
/*
Functions for getting names of trace events and protocol
stages for debugging purposes.
*/
const char* protocol_stage_name(enum protocol_stage stage);
const char* trace_event_name(enum trace_event ev);
#endif
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,96 @@
/* 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 as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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_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, int 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 (likely(locker != NULL))
PSI_IDLE_CALL(end_idle_wait)(locker);
}
#endif
/** @} (end of group Idle_instrumentation) */
#endif

View File

@ -0,0 +1,121 @@
/* 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 MYSQL_MDL_H
#define MYSQL_MDL_H
/**
@file mysql/psi/mysql_mdl.h
Instrumentation helpers for metadata locks.
*/
#include "mysql/psi/psi.h"
#ifndef PSI_METADATA_CALL
#define PSI_METADATA_CALL(M) PSI_DYNAMIC_CALL(M)
#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<opaque_mdl_type> (mdl_type),
static_cast<opaque_mdl_duration> (mdl_duration),
static_cast<opaque_mdl_status> (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

View File

@ -0,0 +1,62 @@
/* 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 as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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"
#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 MY_ATTRIBUTE((unused)),
void *info MY_ATTRIBUTE((unused)),
int count MY_ATTRIBUTE((unused)))
#endif
{
#ifdef HAVE_PSI_MEMORY_INTERFACE
PSI_MEMORY_CALL(register_memory)(category, info, count);
#endif
}
/** @} (end of group Memory_instrumentation) */
#endif

View File

@ -0,0 +1,88 @@
/* 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 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, SQLTEXT, SQLTEXT_LENGTH) \
inline_mysql_create_prepared_stmt(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_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)
#else
#define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_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)
#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,
const char *sqltext, size_t sqltext_length)
{
if (locker == NULL)
return NULL;
return PSI_PS_CALL(create_prepared_stmt)(identity, stmt_id,
locker,
stmt_name, stmt_name_length,
sqltext, sqltext_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);
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,97 @@
/* 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 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

View File

@ -0,0 +1,198 @@
/* 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-1301 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

View File

@ -0,0 +1,235 @@
/* Copyright (c) 2010, 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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 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 (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 (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, uint db_len,
const CHARSET_INFO *charset,
PSI_sp_share *sp_share,
const char *src_file, int src_line)
{
PSI_statement_locker *locker;
locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset,
sp_share);
if (likely(locker != NULL))
PSI_STATEMENT_CALL(start_statement)(locker, db, 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 (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 (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 (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 (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 (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 (likely(locker != NULL))
PSI_STATEMENT_CALL(end_statement)(locker, stmt_da);
}
#endif
/** @} (end of group Statement_instrumentation) */
#endif

View File

@ -0,0 +1,142 @@
/* 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,
51 Franklin Street, Suite 500, 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
@{
*/
/**
@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, int src_line)
{
if (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 (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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,213 @@
/* 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 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) \
do {} while (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) \
NULL
#endif
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
#define MYSQL_COMMIT_TRANSACTION(LOCKER) \
inline_mysql_commit_transaction(LOCKER)
#else
#define MYSQL_COMMIT_TRANSACTION(LOCKER) \
NULL
#endif
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
static inline struct PSI_transaction_locker *
inline_mysql_start_transaction(PSI_transaction_locker_state *state,
const void *xid,
const 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

2980
3rdparty/mysql/include/mysql/psi/psi.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,155 @@
/* 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 as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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_PSI_BASE_H
#define MYSQL_PSI_BASE_H
#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_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 */

View File

@ -0,0 +1,155 @@
/* 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 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 */

View File

@ -0,0 +1,101 @@
#ifndef MYSQL_SERVICE_MY_SNPRINTF_INCLUDED
#define MYSQL_SERVICE_MY_SNPRINTF_INCLUDED
/* Copyright (c) 2009, 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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:
% <flag> <width> <precision> <length modifier> <format>
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 <width> and <precision> can be specified as numbers or '*'.
If an asterisk is used, an argument of type int is consumed.
<length modifier> 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).
Standard syntax for positional arguments $n is supported.
Extensions:
Flag '`' (backtick): see above.
Format 'b': binary buffer, prints exactly <precision> bytes from the
argument, without stopping at '\0'.
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef MYSQL_ABI_CHECK
#include <stdarg.h>
#include <stdlib.h>
#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
#endif /* #define MYSQL_SERVICE_MY_SNPRINTF_INCLUDED */

View File

@ -0,0 +1,81 @@
/* 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef MYSQL_SERVICE_MYSQL_ALLOC_INCLUDED
#define MYSQL_SERVICE_MYSQL_ALLOC_INCLUDED
#ifndef MYSQL_ABI_CHECK
#include <stdlib.h>
#endif
/* PSI_memory_key */
#include "mysql/psi/psi_memory.h"
#ifdef __cplusplus
extern "C" {
#endif
/* myf */
typedef int myf_t;
typedef void * (*mysql_malloc_t)(PSI_memory_key key, size_t size, myf_t flags);
typedef void * (*mysql_realloc_t)(PSI_memory_key key, void *ptr, size_t size, myf_t flags);
typedef void (*mysql_claim_t)(void *ptr);
typedef void (*mysql_free_t)(void *ptr);
typedef void * (*my_memdup_t)(PSI_memory_key key, const void *from, size_t length, myf_t flags);
typedef char * (*my_strdup_t)(PSI_memory_key key, const char *from, myf_t flags);
typedef char * (*my_strndup_t)(PSI_memory_key key, const char *from, size_t length, myf_t flags);
struct mysql_malloc_service_st
{
mysql_malloc_t mysql_malloc;
mysql_realloc_t mysql_realloc;
mysql_claim_t mysql_claim;
mysql_free_t mysql_free;
my_memdup_t my_memdup;
my_strdup_t my_strdup;
my_strndup_t my_strndup;
};
extern struct mysql_malloc_service_st *mysql_malloc_service;
#ifdef MYSQL_DYNAMIC_PLUGIN
#define my_malloc mysql_malloc_service->mysql_malloc
#define my_realloc mysql_malloc_service->mysql_realloc
#define my_claim mysql_malloc_service->mysql_claim
#define my_free mysql_malloc_service->mysql_free
#define my_memdup mysql_malloc_service->my_memdup
#define my_strdup mysql_malloc_service->my_strdup
#define my_strndup mysql_malloc_service->my_strndup
#else
extern void * my_malloc(PSI_memory_key key, size_t size, myf_t flags);
extern void * my_realloc(PSI_memory_key key, void *ptr, size_t size, myf_t flags);
extern void my_claim(void *ptr);
extern void my_free(void *ptr);
extern void * my_memdup(PSI_memory_key key, const void *from, size_t length, myf_t flags);
extern char * my_strdup(PSI_memory_key key, const char *from, myf_t flags);
extern char * my_strndup(PSI_memory_key key, const char *from, size_t length, myf_t flags);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,9 +1,8 @@
/* Copyright (C) 2000 MySQL AB
/* Copyright (c) 2000, 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; either version 2 of the License, or
(at your option) any later version.
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -12,7 +11,7 @@
You 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 */
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/*
** Common definition between mysql server & client
@ -20,13 +19,41 @@
#ifndef _mysql_com_h
#define _mysql_com_h
#define NAME_LEN 64 /* Field/table name length */
#include "binary_log_types.h"
#include "my_command.h"
#define HOSTNAME_LENGTH 60
#define USERNAME_LENGTH 16
#define SYSTEM_CHARSET_MBMAXLEN 3
#define FILENAME_CHARSET_MBMAXLEN 5
#define NAME_CHAR_LEN 64 /* Field/table name length */
#define USERNAME_CHAR_LENGTH 32
#define USERNAME_CHAR_LENGTH_STR "32"
#ifndef NAME_LEN
#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
#endif
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
#define MYSQL_AUTODETECT_CHARSET_NAME "auto"
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5
/*
Maximum length of comments
*/
#define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 6.0: 60 characters */
#define TABLE_COMMENT_MAXLEN 2048
#define COLUMN_COMMENT_MAXLEN 1024
#define INDEX_COMMENT_MAXLEN 1024
#define TABLE_PARTITION_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
@ -39,41 +66,25 @@
#define LOCAL_HOST_NAMEDPIPE "."
#if defined(__WIN__) && !defined( _CUSTOMCONFIG_)
#if defined(_WIN32)
#define MYSQL_NAMEDPIPE "MySQL"
#define MYSQL_SERVICENAME "MySQL"
#endif /* __WIN__ */
#endif /* _WIN32 */
/* The length of the header part for each generated column in the .frm file. */
#define FRM_GCOL_HEADER_SIZE 4
/*
You should add new commands to the end of this list, otherwise old
servers won't be able to handle them as 'unsupported'.
Maximum length of the expression statement defined for generated columns.
*/
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,
/* don't forget to update const char *command_name[] in sql_parse.cc */
/* Must be last */
COM_END
};
#define GENERATED_COLUMN_EXPRESSION_MAXLEN 65535 - FRM_GCOL_HEADER_SIZE
/*
Length of random string sent by server on handshake; this is also length of
obfuscated password, recieved from client
obfuscated password, received from client
*/
#define SCRAMBLE_LENGTH 20
#define SCRAMBLE_LENGTH_323 8
#define AUTH_PLUGIN_DATA_PART_1_LENGTH 8
/* length of password stored in the db: new passwords are preceeded with '*' */
#define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH*2+1)
#define SCRAMBLED_PASSWORD_CHAR_LENGTH_323 (SCRAMBLE_LENGTH_323*2)
#define NOT_NULL_FLAG 1 /* Field can't be NULL */
@ -91,11 +102,27 @@ enum enum_server_command
#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */
#define SET_FLAG 2048 /* field is a set */
#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 */
#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 BINCMP_FLAG 131072 /* Intern: Used by sql_yacc */
#define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */
#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */
/**
Intern: Field in TABLE object for new version of altered table,
which participates in a newly added index.
*/
#define FIELD_IN_ADD_INDEX (1 << 20)
#define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */
#define FIELD_FLAGS_STORAGE_MEDIA 22 /* Field storage media, bit 22-23 */
#define FIELD_FLAGS_STORAGE_MEDIA_MASK (3 << FIELD_FLAGS_STORAGE_MEDIA)
#define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25 */
#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3 << FIELD_FLAGS_COLUMN_FORMAT)
#define FIELD_IS_DROPPED (1<< 26) /* Intern: Field is being dropped */
#define EXPLICIT_NULL_FLAG (1<< 27) /* Field is explicitly specified as
NULL by the user */
#define REFRESH_GRANT 1 /* Refresh grant tables */
#define REFRESH_LOG 2 /* Start on new log file */
@ -107,6 +134,12 @@ enum enum_server_command
thread */
#define REFRESH_MASTER 128 /* Remove all bin logs in the index
and truncate the index */
#define REFRESH_ERROR_LOG 256 /* Rotate only the erorr log */
#define REFRESH_ENGINE_LOG 512 /* Flush all storage engine logs */
#define REFRESH_BINARY_LOG 1024 /* Flush the binary log */
#define REFRESH_RELAY_LOG 2048 /* Flush the relay log */
#define REFRESH_GENERAL_LOG 4096 /* Flush the general log */
#define REFRESH_SLOW_LOG 8192 /* Flush the slow query log */
/* The following can't be set with mysql_refresh() */
#define REFRESH_READ_LOCK 16384 /* Lock tables for read */
@ -117,6 +150,8 @@ enum enum_server_command
#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */
#define REFRESH_DES_KEY_FILE 0x40000L
#define REFRESH_USER_RESOURCES 0x80000L
#define REFRESH_FOR_EXPORT 0x100000L /* FLUSH TABLES ... FOR EXPORT */
#define REFRESH_OPTIMIZER_COSTS 0x200000L /* FLUSH OPTIMIZER_COSTS */
#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
@ -133,30 +168,146 @@ enum enum_server_command
#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */
#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
#define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */
#define CLIENT_REMEMBER_OPTIONS (((ulong) 1) << 31)
#define CLIENT_RESERVED2 32768 /* Old flag for 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS (1UL << 16) /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS (1UL << 17) /* Enable/disable multi-results */
#define CLIENT_PS_MULTI_RESULTS (1UL << 18) /* Multi-results in PS-protocol */
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
#define CLIENT_PLUGIN_AUTH (1UL << 19) /* Client supports plugin authentication */
#define CLIENT_CONNECT_ATTRS (1UL << 20) /* Client supports connection attributes */
/* Enable authentication response packet to be larger than 255 bytes. */
#define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1UL << 21)
/* Don't close the connection for a connection with expired password. */
#define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 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 (1UL << 23)
/* Client no longer needs EOF packet */
#define CLIENT_DEPRECATE_EOF (1UL << 24)
#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
#define CLIENT_REMEMBER_OPTIONS (1UL << 31)
#ifdef HAVE_COMPRESS
#define CAN_CLIENT_COMPRESS CLIENT_COMPRESS
#else
#define CAN_CLIENT_COMPRESS 0
#endif
/* Gather all possible capabilites (flags) supported by the server */
#define CLIENT_ALL_FLAGS (CLIENT_LONG_PASSWORD \
| 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_RESERVED2 \
| CLIENT_MULTI_STATEMENTS \
| CLIENT_MULTI_RESULTS \
| CLIENT_PS_MULTI_RESULTS \
| CLIENT_SSL_VERIFY_SERVER_CERT \
| CLIENT_REMEMBER_OPTIONS \
| CLIENT_PLUGIN_AUTH \
| CLIENT_CONNECT_ATTRS \
| CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA \
| CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS \
| CLIENT_SESSION_TRACK \
| CLIENT_DEPRECATE_EOF \
)
/*
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)
/**
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 1
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
#define SERVER_STATUS_MORE_RESULTS 4 /* More results on server */
#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */
#define SERVER_QUERY_NO_GOOD_INDEX_USED 16
#define SERVER_QUERY_NO_INDEX_USED 32
/*
/**
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 64
/*
/**
This flag is sent when a read-only cursor is exhausted, in reply to
COM_STMT_FETCH command.
*/
#define SERVER_STATUS_LAST_ROW_SENT 128
#define SERVER_STATUS_DB_DROPPED 256 /* A database was dropped */
#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512
/**
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 1024
#define SERVER_QUERY_WAS_SLOW 2048
/**
To mark ResultSet containing output parameter values.
*/
#define SERVER_PS_OUT_PARAMS 4096
/**
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 8192
/**
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 (1UL << 14)
/**
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 */
@ -165,6 +316,7 @@ enum enum_server_command
#define ONLY_KILL_QUERY 1
struct st_vio; /* Only C */
typedef struct st_vio Vio;
@ -174,71 +326,58 @@ typedef struct st_vio Vio;
#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 colum */
#define MAX_BLOB_WIDTH 8192 /* Default width for blob */
#define MAX_BLOB_WIDTH 16777216 /* Default width for blob */
typedef struct st_net {
#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY)
Vio* vio;
Vio *vio;
unsigned char *buff,*buff_end,*write_pos,*read_pos;
my_socket fd; /* For Perl DBI/dbd */
unsigned long max_packet,max_packet_size;
unsigned int pkt_nr,compress_pkt_nr;
unsigned int write_timeout, read_timeout, retry_count;
int fcntl;
my_bool compress;
/*
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;
my_bool no_send_ok; /* For SPs and other things that do multiple stmts */
my_bool no_send_eof; /* For SPs' first version read-only cursors */
/*
Set if OK packet is already sent, and we do not need to send error
messages
*/
my_bool no_send_error;
my_bool unused1; /* Please remove with the next incompatible ABI change */
my_bool unused2; /* Please remove with the next incompatible ABI change */
my_bool 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
char last_error[MYSQL_ERRMSG_SIZE], sqlstate[SQLSTATE_LENGTH+1];
/*
Unused, please remove with the next incompatible ABI change.
*/
unsigned char *unused;
unsigned int last_errno;
unsigned char error;
gptr query_cache_query;
my_bool report_error; /* We should report error (we have unreported error) */
my_bool return_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];
/**
Extension pointer, for the caller private use.
Any program linking with the networking library can use this pointer,
which is handy when private connection specific data needs to be
maintained.
The mysqld server process uses this pointer internally,
to maintain the server internal instrumentation for the connection.
*/
void *extension;
} NET;
#define packet_error (~(unsigned long) 0)
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_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
@ -297,9 +436,7 @@ enum mysql_enum_shutdown_level {
/* don't flush InnoDB buffers, flush other storage engines' buffers*/
SHUTDOWN_WAIT_CRITICAL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1,
/* Now the 2 levels of the KILL command */
#if MYSQL_VERSION_ID >= 50000
KILL_QUERY= 254,
#endif
KILL_CONNECTION= 255
};
@ -320,6 +457,30 @@ enum enum_mysql_set_option
MYSQL_OPTION_MULTI_STATEMENTS_OFF
};
/*
Type of state change information that the server can include in the Ok
packet.
Note : 1) session_state_type shouldn't go past 255 (i.e. 1-byte boundary).
2) Modify the definition of SESSION_TRACK_END when a new member is
added.
*/
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 */
};
#define SESSION_TRACK_BEGIN SESSION_TRACK_SYSTEM_VARIABLES
#define SESSION_TRACK_END SESSION_TRACK_TRANSACTION_STATE
#define IS_SESSION_STATE_TYPE(T) \
(((int)(T) >= SESSION_TRACK_BEGIN) && ((T) <= SESSION_TRACK_END))
#define net_new_transaction(net) ((net)->pkt_nr=0)
#ifdef __cplusplus
@ -327,25 +488,23 @@ extern "C" {
#endif
my_bool my_net_init(NET *net, Vio* vio);
void my_net_local_init(NET *net);
void net_end(NET *net);
void net_clear(NET *net);
my_bool net_realloc(NET *net, unsigned long length);
void my_net_local_init(NET *net);
void net_end(NET *net);
void net_clear(NET *net, my_bool check_buffer);
void net_claim_memory_ownership(NET *net);
my_bool net_realloc(NET *net, size_t length);
my_bool net_flush(NET *net);
my_bool my_net_write(NET *net,const char *packet,unsigned long len);
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 char *header, unsigned long head_len,
const char *packet, unsigned long len);
int net_real_write(NET *net,const char *packet,unsigned long len);
const unsigned char *header, size_t head_len,
const unsigned char *packet, size_t len);
my_bool net_write_packet(NET *net, const unsigned char *packet, size_t length);
unsigned long my_net_read(NET *net);
/*
The following function is not meant for normal usage
Currently it's used internally by manager.c
*/
struct sockaddr;
int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen,
unsigned int timeout);
#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 rand_struct {
unsigned long seed1,seed2,max_value;
@ -370,18 +529,24 @@ typedef struct st_udf_args
char *maybe_null; /* Set to 1 for all maybe_null args */
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; /* 0 if result is independent of arguments */
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 */
@ -406,14 +571,14 @@ void create_random_string(char *to, unsigned int length, struct rand_struct *ran
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 char *, const char *message,
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_password_from_salt_323(char *to, const unsigned long *salt);
void make_scrambled_password(char *to, const char *password);
void scramble(char *to, const char *message, const char *password);
my_bool check_scramble(const char *reply, const char *message,
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);
void make_password_from_salt(char *to, const unsigned char *hash_stage2);
@ -421,24 +586,19 @@ char *octet2hex(char *to, const char *str, unsigned int len);
/* end of password.c */
char *get_tty_password(char *opt_message);
char *get_tty_password(const char *opt_message);
const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
/* Some other useful functions */
my_bool my_init(void);
extern int modify_defaults_file(const char *file_location, const char *option,
const char *option_value,
const char *section_name, int remove_option);
int load_defaults(const char *conf_file, const char **groups,
int *argc, char ***argv);
my_bool my_thread_init(void);
void my_thread_end(void);
#ifdef _global_h
#ifdef MY_GLOBAL_INCLUDED
ulong STDCALL net_field_length(uchar **packet);
my_ulonglong net_field_length_ll(uchar **packet);
char *net_store_length(char *pkg, ulonglong length);
uchar *net_store_length(uchar *pkg, ulonglong length);
unsigned int net_length_size(ulonglong num);
#endif
#ifdef __cplusplus
@ -449,4 +609,5 @@ char *net_store_length(char *pkg, ulonglong length);
#define MYSQL_STMT_HEADER 4
#define MYSQL_LONG_DATA_HEADER 6
#define NOT_FIXED_DEC 31
#endif

View File

@ -0,0 +1,41 @@
/* 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-1301 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

29
3rdparty/mysql/include/mysql_embed.h vendored Normal file
View File

@ -0,0 +1,29 @@
#ifndef MYSQL_EMBED_INCLUDED
#define MYSQL_EMBED_INCLUDED
/* 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 St, Fifth Floor, Boston, MA 02110-1301 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 */

View File

@ -1,9 +1,8 @@
/* Copyright (C) 2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
/* Copyright (c) 2004, 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; either version 2 of the License, or
(at your option) any later version.
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -12,7 +11,7 @@
You 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 */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
#ifndef _mysql_time_h_
#define _mysql_time_h_
@ -48,7 +47,7 @@ enum enum_mysql_timestamp_type
typedef struct st_mysql_time
{
unsigned int year, month, day, hour, minute, second;
unsigned long second_part;
unsigned long second_part; /**< microseconds */
my_bool neg;
enum enum_mysql_timestamp_type time_type;
} MYSQL_TIME;

View File

@ -1,5 +1,7 @@
/* Copyright Abandoned 1996, 1999, 2001 MySQL AB
This file is public domain and comes with NO WARRANTY of any kind */
/* 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 */
@ -8,22 +10,22 @@
#ifdef _CUSTOMCONFIG_
#include <custom_conf.h>
#else
#define PROTOCOL_VERSION 10
#define MYSQL_SERVER_VERSION "5.0.20"
#define MYSQL_BASE_VERSION "mysqld-5.0"
#define MYSQL_SERVER_SUFFIX_DEF "-community-max-nt"
#define FRM_VER 6
#define MYSQL_VERSION_ID 50020
#define MYSQL_PORT 3306
#define MYSQL_UNIX_ADDR "/tmp/mysql.sock"
#define MYSQL_CONFIG_NAME "my"
#define MYSQL_COMPILATION_COMMENT "MySQL Community Edition - Max (GPL)"
#define PROTOCOL_VERSION 10
#define MYSQL_SERVER_VERSION "5.7.16"
#define MYSQL_VERSION_ID 50716
#define MYSQL_PORT 3306
#define MYSQL_PORT_DEFAULT 0
#define MYSQL_UNIX_ADDR "/tmp/mysql.sock"
#define MYSQL_CONFIG_NAME "my"
#define MYSQL_COMPILATION_COMMENT "MySQL Connector/C (GPL)"
#define LIBMYSQL_VERSION "6.1.9"
#define LIBMYSQL_VERSION_ID 60109
/* mysqld compile time options */
#endif /* _CUSTOMCONFIG_ */
#ifndef LICENSE
#define LICENSE GPL
#define LICENSE GPL
#endif /* LICENSE */
#endif /* _mysql_version_h */

1082
3rdparty/mysql/include/mysqld_ername.h vendored Normal file

File diff suppressed because it is too large Load Diff

1089
3rdparty/mysql/include/mysqld_error.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,159 +0,0 @@
/* Copyright (C) 2000 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; 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Parser needs these defines always, even if USE_RAID is not defined */
#define RAID_TYPE_0 1 /* Striping */
#define RAID_TYPE_x 2 /* Some new modes */
#define RAID_TYPE_y 3
#define RAID_DEFAULT_CHUNKS 4
#define RAID_DEFAULT_CHUNKSIZE 256*1024 /* 256kB */
C_MODE_START
#define my_raid_type(raid_type) raid_type_string[(int)(raid_type)]
extern const char *raid_type_string[];
C_MODE_END
#ifdef DONT_USE_RAID
#undef USE_RAID
#endif
#if defined(USE_RAID)
#include "my_dir.h"
/* Trap all occurences of my_...() in source and use our wrapper around this function */
#ifdef MAP_TO_USE_RAID
#define my_read(A,B,C,D) my_raid_read(A,B,C,D)
#define my_write(A,B,C,D) my_raid_write(A,B,C,D)
#define my_pwrite(A,B,C,D,E) my_raid_pwrite(A,B,C,D,E)
#define my_pread(A,B,C,D,E) my_raid_pread(A,B,C,D,E)
#define my_chsize(A,B,C,D) my_raid_chsize(A,B,C,D)
#define my_close(A,B) my_raid_close(A,B)
#define my_tell(A,B) my_raid_tell(A,B)
#define my_seek(A,B,C,D) my_raid_seek(A,B,C,D)
#define my_lock(A,B,C,D,E) my_raid_lock(A,B,C,D,E)
#define my_fstat(A,B,C) my_raid_fstat(A,B,C)
#endif /* MAP_TO_USE_RAID */
#ifdef __cplusplus
extern "C" {
#endif
void init_raid(void);
void end_raid(void);
bool is_raid(File fd);
File my_raid_create(const char *FileName, int CreateFlags, int access_flags,
uint raid_type, uint raid_chunks, ulong raid_chunksize,
myf MyFlags);
File my_raid_open(const char *FileName, int Flags,
uint raid_type, uint raid_chunks, ulong raid_chunksize,
myf MyFlags);
int my_raid_rename(const char *from, const char *to, uint raid_chunks,
myf MyFlags);
int my_raid_delete(const char *from, uint raid_chunks, myf MyFlags);
int my_raid_redel(const char *old_name, const char *new_name,
uint raid_chunks, myf MyFlags);
my_off_t my_raid_seek(File fd, my_off_t pos, int whence, myf MyFlags);
my_off_t my_raid_tell(File fd, myf MyFlags);
uint my_raid_write(File,const byte *Buffer, uint Count, myf MyFlags);
uint my_raid_read(File Filedes, byte *Buffer, uint Count, myf MyFlags);
uint my_raid_pread(File Filedes, byte *Buffer, uint Count, my_off_t offset,
myf MyFlags);
uint my_raid_pwrite(int Filedes, const byte *Buffer, uint Count,
my_off_t offset, myf MyFlags);
int my_raid_lock(File,int locktype, my_off_t start, my_off_t length,
myf MyFlags);
int my_raid_chsize(File fd, my_off_t newlength, int filler, myf MyFlags);
int my_raid_close(File, myf MyFlags);
int my_raid_fstat(int Filedes, struct stat *buf, myf MyFlags);
#ifdef __cplusplus
}
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
class RaidName {
public:
RaidName(const char *FileName);
~RaidName();
bool IsRaid();
int Rename(const char * from, const char * to, myf MyFlags);
private:
uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */
uint _raid_chunks; /* 1..n */
ulong _raid_chunksize; /* 1..n in bytes */
};
class RaidFd {
public:
RaidFd(uint raid_type, uint raid_chunks , ulong raid_chunksize);
~RaidFd();
File Create(const char *FileName, int CreateFlags, int access_flags,
myf MyFlags);
File Open(const char *FileName, int Flags, myf MyFlags);
my_off_t Seek(my_off_t pos,int whence,myf MyFlags);
my_off_t Tell(myf MyFlags);
int Write(const byte *Buffer, uint Count, myf MyFlags);
int Read(const byte *Buffer, uint Count, myf MyFlags);
int Lock(int locktype, my_off_t start, my_off_t length, myf MyFlags);
int Chsize(File fd, my_off_t newlength, int filler, myf MyFlags);
int Fstat(int fd, MY_STAT *stat_area, myf MyFlags );
int Close(myf MyFlags);
static bool IsRaid(File fd);
static DYNAMIC_ARRAY _raid_map; /* Map of RaidFD* */
private:
uint _raid_type; /* RAID_TYPE_0 or RAID_TYPE_1 or RAID_TYPE_5 */
uint _raid_chunks; /* 1..n */
ulong _raid_chunksize; /* 1..n in bytes */
ulong _total_block; /* We are operating with block no x (can be 0..many). */
uint _this_block; /* can be 0.._raid_chunks */
uint _remaining_bytes; /* Maximum bytes that can be written in this block */
my_off_t _position;
my_off_t _size; /* Cached file size for faster seek(SEEK_END) */
File _fd;
File *_fd_vector; /* Array of File */
off_t *_seek_vector; /* Array of cached seek positions */
inline void Calculate()
{
DBUG_ENTER("RaidFd::_Calculate");
DBUG_PRINT("info",("_position: %lu _raid_chunksize: %d, _size: %lu",
(ulong) _position, _raid_chunksize, (ulong) _size));
_total_block = (ulong) (_position / _raid_chunksize);
_this_block = _total_block % _raid_chunks; /* can be 0.._raid_chunks */
_remaining_bytes = (uint) (_raid_chunksize -
(_position - _total_block * _raid_chunksize));
DBUG_PRINT("info",
("_total_block: %d this_block: %d _remaining_bytes:%d",
_total_block, _this_block, _remaining_bytes));
DBUG_VOID_RETURN;
}
};
#endif /* __cplusplus */
#endif /* USE_RAID */

206
3rdparty/mysql/include/sql_common.h vendored Normal file
View File

@ -0,0 +1,206 @@
#ifndef SQL_COMMON_INCLUDED
#define SQL_COMMON_INCLUDED
/* Copyright (c) 2003, 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-1301 USA */
#define SQL_COMMON_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#include <mysql.h>
#include <hash.h>
extern const char *unknown_sqlstate;
extern const char *cant_connect_sqlstate;
extern const char *not_error_sqlstate;
/*
Free all memory allocated in MYSQL handle except the
current options.
*/
void mysql_close_free(MYSQL *mysql);
/*
Clear connection options stored in MYSQL handle and
free memory used by them.
*/
void mysql_close_free_options(MYSQL *mysql);
/**
The structure is used to hold the state change information
received from the server. LIST functions are used for manipulation
of the members of the structure.
*/
typedef struct st_session_track_info_node {
/** head_node->data is a LEX_STRING which contains the variable name. */
LIST *head_node;
LIST *current_node;
} STATE_INFO_NODE;
/**
Store the change info received from the server in an array of linked lists
with STATE_INFO_NODE elements (one per state type).
*/
typedef struct st_session_track_info {
/** Array of STATE_NODE_INFO elements (one per state type). */
struct st_session_track_info_node info_list[SESSION_TRACK_END + 1];
} STATE_INFO;
/*
Access to MYSQL::extension member.
Note: functions mysql_extension_{init,free}() are defined
in client.c.
*/
struct st_mysql_trace_info;
typedef struct st_mysql_extension {
struct st_mysql_trace_info *trace_data;
struct st_session_track_info state_change;
} MYSQL_EXTENSION;
/* "Constructor/destructor" for MYSQL extension structure. */
struct st_mysql_extension* mysql_extension_init(struct st_mysql*);
void mysql_extension_free(struct st_mysql_extension*);
/*
Note: Allocated extension structure is freed in mysql_close_free()
called by mysql_close().
*/
#define MYSQL_EXTENSION_PTR(H) \
( \
(struct st_mysql_extension*) \
( (H)->extension ? \
(H)->extension : ((H)->extension= mysql_extension_init(H)) \
) \
)
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? */
HASH connection_attributes;
char *server_public_key_path;
size_t connection_attributes_length;
my_bool enable_cleartext_plugin;
my_bool unused0; /* Former ssl_enforce */
char *tls_version; /* TLS version option */
long ssl_ctx_flags; /* SSL ctx options flag */
unsigned int ssl_mode;
};
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,
size_t header_length,
const unsigned char *arg,
size_t 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);
void (*free_rows)(MYSQL_DATA *cur);
#endif
} MYSQL_METHODS;
#define simple_command(mysql, command, arg, length, skip_check) \
((mysql)->methods \
? (*(mysql)->methods->advanced_command)(mysql, command, 0, \
0, arg, length, skip_check, NULL) \
: (set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate), 1))
#define stmt_command(mysql, command, arg, length, stmt) \
((mysql)->methods \
? (*(mysql)->methods->advanced_command)(mysql, command, 0, \
0, arg, length, 1, stmt) \
: (set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate), 1))
extern CHARSET_INFO *default_client_charset_info;
MYSQL_FIELD *unpack_fields(MYSQL *mysql, MYSQL_ROWS *data,MEM_ROOT *alloc,
uint fields, my_bool default_value,
uint server_capabilities);
MYSQL_FIELD * cli_read_metadata_ex(MYSQL *mysql, MEM_ROOT *alloc,
unsigned long field_count,
unsigned int fields);
MYSQL_FIELD * cli_read_metadata(MYSQL *mysql, unsigned long field_count,
unsigned int fields);
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, size_t header_length,
const unsigned char *arg, size_t arg_length,
my_bool skip_check, MYSQL_STMT *stmt);
unsigned long cli_safe_read(MYSQL *mysql, my_bool *is_data_packet);
unsigned long cli_safe_read_with_ok(MYSQL *mysql, my_bool parse_ok,
my_bool *is_data_packet);
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_plugin_vio_info;
void mpvio_info(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);
extern my_bool libmysql_cleartext_plugin_enabled;
void read_ok_ex(MYSQL *mysql, unsigned long len);
#ifdef __cplusplus
}
#endif
#define protocol_41(A) ((A)->server_capabilities & CLIENT_PROTOCOL_41)
#endif /* SQL_COMMON_INCLUDED */

255
3rdparty/mysql/include/sql_state.h vendored Normal file
View File

@ -0,0 +1,255 @@
/* 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_BLOB_CANT_HAVE_DEFAULT ,"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 ,"42000", "" },
{ 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_EXITS ,"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_ILLEGAL_VALUE_FOR_TYPE ,"22007", "" },
{ 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_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_FOREIGN_DUPLICATE_KEY_OLD_UNUSED ,"23000", "S1009" },
{ 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_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_ILLEGAL_USER_VAR ,"42000", "S1009" },
{ ER_NET_OK_PACKET_TOO_LARGE ,"08S01", "" },
{ ER_WRONG_TABLESPACE_NAME ,"42000", "" },
{ ER_LOCKING_SERVICE_WRONG_NAME ,"42000", "" },
{ ER_INVALID_JSON_TEXT ,"22032", "" },
{ ER_INVALID_JSON_TEXT_IN_PARAM ,"22032", "" },
{ ER_INVALID_JSON_PATH ,"42000", "" },
{ ER_INVALID_JSON_CHARSET ,"22032", "" },
{ ER_INVALID_JSON_CHARSET_IN_FUNCTION ,"22032", "" },
{ ER_INVALID_TYPE_FOR_JSON ,"22032", "" },
{ ER_INVALID_CAST_TO_JSON ,"22032", "" },
{ ER_INVALID_JSON_PATH_CHARSET ,"42000", "" },
{ ER_INVALID_JSON_PATH_WILDCARD ,"42000", "" },
{ ER_JSON_VALUE_TOO_BIG ,"22032", "" },
{ ER_JSON_KEY_TOO_BIG ,"22032", "" },
{ ER_JSON_USED_AS_KEY ,"42000", "" },
{ ER_JSON_VACUOUS_PATH ,"42000", "" },
{ ER_JSON_BAD_ONE_OR_ALL_ARG ,"42000", "" },
{ ER_NUMERIC_JSON_VALUE_OUT_OF_RANGE ,"22003", "" },
{ ER_INVALID_JSON_VALUE_FOR_CAST ,"22018", "" },
{ ER_JSON_DOCUMENT_TOO_DEEP ,"22032", "" },
{ ER_JSON_DOCUMENT_NULL_KEY ,"22032", "" },
{ ER_INVALID_JSON_PATH_ARRAY_CELL ,"42000", "" },

63
3rdparty/mysql/include/sslopt-case.h vendored Normal file
View File

@ -0,0 +1,63 @@
/* 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-1301 USA */
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
#ifndef MYSQL_CLIENT
#error This header is supposed to be used only in the client
#endif
case OPT_SSL_MODE:
opt_ssl_mode= find_type_or_exit(argument, &ssl_mode_typelib,
opt->name);
ssl_mode_set_explicitly= TRUE;
break;
case OPT_SSL_SSL:
CLIENT_WARN_DEPRECATED("--ssl", "--ssl-mode");
if (!opt_use_ssl_arg)
opt_ssl_mode= SSL_MODE_DISABLED;
else if (opt_ssl_mode < SSL_MODE_REQUIRED)
opt_ssl_mode= SSL_MODE_REQUIRED;
break;
case OPT_SSL_VERIFY_SERVER_CERT:
CLIENT_WARN_DEPRECATED("--ssl-verify-server-cert",
"--ssl-mode=VERIFY_IDENTITY");
if (!opt_ssl_verify_server_cert_arg)
{
if (opt_ssl_mode >= SSL_MODE_VERIFY_IDENTITY)
opt_ssl_mode= SSL_MODE_VERIFY_CA;
}
else
opt_ssl_mode= SSL_MODE_VERIFY_IDENTITY;
break;
case OPT_SSL_CA:
case OPT_SSL_CAPATH:
/* Don't change ssl-mode if set explicitly. */
if (!ssl_mode_set_explicitly)
opt_ssl_mode= SSL_MODE_VERIFY_CA;
break;
case OPT_SSL_KEY:
case OPT_SSL_CERT:
case OPT_SSL_CIPHER:
case OPT_SSL_CRL:
case OPT_SSL_CRLPATH:
case OPT_TLS_VERSION:
#ifdef HAVE_YASSL
/* crl has no effect in yaSSL. */
opt_ssl_crl= NULL;
opt_ssl_crlpath= NULL;
#endif /* HAVE_YASSL */
break;
#endif /* HAVE_OPENSSL */

View File

@ -0,0 +1,67 @@
/* 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-1301 USA */
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
#ifdef MYSQL_CLIENT
{"ssl-mode", OPT_SSL_MODE,
"SSL connection mode.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ssl", OPT_SSL_SSL,
"Deprecated. Use --ssl-mode instead.",
&opt_use_ssl_arg, &opt_use_ssl_arg, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT,
"Deprecated. Use --ssl-mode=VERIFY_IDENTITY instead.",
&opt_ssl_verify_server_cert_arg, &opt_ssl_verify_server_cert_arg,
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
{"ssl", OPT_SSL_SSL,
"If set to ON, this option enforces that SSL is established before client "
"attempts to authenticate to the server. To disable client SSL capabilities "
"use --ssl=OFF.",
&opt_use_ssl, &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
#endif
{"ssl-ca", OPT_SSL_CA,
"CA file in PEM format.",
&opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-capath", OPT_SSL_CAPATH,
"CA directory.",
&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.",
&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.",
&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.",
&opt_ssl_key, &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-crl", OPT_SSL_CRL, "Certificate revocation list.",
&opt_ssl_crl, &opt_ssl_crl, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-crlpath", OPT_SSL_CRLPATH,
"Certificate revocation list path.",
&opt_ssl_crlpath, &opt_ssl_crlpath, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"tls-version", OPT_TLS_VERSION, "TLS version to use, "
#ifndef HAVE_YASSL
"permitted values are: TLSv1, TLSv1.1, TLSv1.2",
#else
"permitted values are: TLSv1, TLSv1.1",
#endif
&opt_tls_version, &opt_tls_version, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#endif /* HAVE_OPENSSL */

75
3rdparty/mysql/include/sslopt-vars.h vendored Normal file
View File

@ -0,0 +1,75 @@
/* 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-1301 USA */
#ifndef SSLOPT_VARS_INCLUDED
#define SSLOPT_VARS_INCLUDED
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
#ifndef MYSQL_CLIENT
#error This header is supposed to be used only in the client
#endif
const char *ssl_mode_names_lib[] =
{"DISABLED", "PREFERRED", "REQUIRED", "VERIFY_CA", "VERIFY_IDENTITY",
NullS };
TYPELIB ssl_mode_typelib = {array_elements(ssl_mode_names_lib) - 1, "",
ssl_mode_names_lib, NULL};
static uint opt_ssl_mode = SSL_MODE_PREFERRED;
static char *opt_ssl_ca = 0;
static char *opt_ssl_capath = 0;
static char *opt_ssl_cert = 0;
static char *opt_ssl_cipher = 0;
static char *opt_ssl_key = 0;
static char *opt_ssl_crl = 0;
static char *opt_ssl_crlpath = 0;
static char *opt_tls_version = 0;
static my_bool ssl_mode_set_explicitly= FALSE;
static my_bool opt_use_ssl_arg= TRUE;
static my_bool opt_ssl_verify_server_cert_arg= FALSE;
static void set_client_ssl_options(MYSQL *mysql)
{
/*
Print a warning if explicitly defined combination of --ssl-mode other than
VERIFY_CA or VERIFY_IDENTITY with explicit --ssl-ca or --ssl-capath values.
*/
if (ssl_mode_set_explicitly &&
opt_ssl_mode < SSL_MODE_VERIFY_CA &&
(opt_ssl_ca || opt_ssl_capath))
{
printf("WARNING: no verification of server certificate will be done. "
"Use --ssl-mode=VERIFY_CA or VERIFY_IDENTITY.\n");
}
/* Set SSL parameters: key, cert, ca, capath, cipher, clr, clrpath. */
if (opt_ssl_mode >= SSL_MODE_VERIFY_CA)
mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
else
mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, NULL,
NULL, opt_ssl_cipher);
mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl);
mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath);
mysql_options(mysql, MYSQL_OPT_TLS_VERSION, opt_tls_version);
mysql_options(mysql, MYSQL_OPT_SSL_MODE, &opt_ssl_mode);
}
#define SSL_SET_OPTIONS(mysql) set_client_ssl_options(mysql);
#else
#define SSL_SET_OPTIONS(mysql) do { } while(0)
#endif
#endif /* SSLOPT_VARS_INCLUDED */

201
3rdparty/mysql/include/thr_cond.h vendored Normal file
View File

@ -0,0 +1,201 @@
#ifndef THR_COND_INCLUDED
#define THR_COND_INCLUDED
/* Copyright (c) 2014, 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-1301 USA */
/**
MySQL condition variable implementation.
There are three "layers":
1) native_cond_*()
Functions that map directly down to OS primitives.
Windows - ConditionVariable
Other OSes - pthread
2) my_cond_*()
Functions that use SAFE_MUTEX (default for debug).
Otherwise native_cond_*() is used.
3) mysql_cond*()
Functions that include Performance Schema instrumentation.
See include/mysql/psi/mysql_thread.h
*/
#include "my_thread.h"
#include "thr_mutex.h"
C_MODE_START
#ifdef _WIN32
typedef CONDITION_VARIABLE native_cond_t;
#else
typedef pthread_cond_t native_cond_t;
#endif
#ifdef _WIN32
/**
Convert abstime to milliseconds
*/
static DWORD get_milliseconds(const struct timespec *abstime)
{
#ifndef HAVE_STRUCT_TIMESPEC
long long millis;
union ft64 now;
if (abstime == NULL)
return INFINITE;
GetSystemTimeAsFileTime(&now.ft);
/*
Calculate time left to abstime
- subtract start time from current time(values are in 100ns units)
- convert to millisec by dividing with 10000
*/
millis= (abstime->tv.i64 - now.i64) / 10000;
/* Don't allow the timeout to be negative */
if (millis < 0)
return 0;
/*
Make sure the calculated timeout does not exceed original timeout
value which could cause "wait for ever" if system time changes
*/
if (millis > abstime->max_timeout_msec)
millis= abstime->max_timeout_msec;
if (millis > UINT_MAX)
millis= UINT_MAX;
return (DWORD)millis;
#else
/*
Convert timespec to millis and subtract current time.
my_getsystime() returns time in 100 ns units.
*/
ulonglong future= abstime->tv_sec * 1000 + abstime->tv_nsec / 1000000;
ulonglong now= my_getsystime() / 10000;
/* Don't allow the timeout to be negative. */
if (future < now)
return 0;
return (DWORD)(future - now);
#endif
}
#endif /* _WIN32 */
static inline int native_cond_init(native_cond_t *cond)
{
#ifdef _WIN32
InitializeConditionVariable(cond);
return 0;
#else
/* pthread_condattr_t is not used in MySQL */
return pthread_cond_init(cond, NULL);
#endif
}
static inline int native_cond_destroy(native_cond_t *cond)
{
#ifdef _WIN32
return 0; /* no destroy function */
#else
return pthread_cond_destroy(cond);
#endif
}
static inline int native_cond_timedwait(native_cond_t *cond,
native_mutex_t *mutex,
const struct timespec *abstime)
{
#ifdef _WIN32
DWORD timeout= get_milliseconds(abstime);
if (!SleepConditionVariableCS(cond, mutex, timeout))
return ETIMEDOUT;
return 0;
#else
return pthread_cond_timedwait(cond, mutex, abstime);
#endif
}
static inline int native_cond_wait(native_cond_t *cond, native_mutex_t *mutex)
{
#ifdef _WIN32
if (!SleepConditionVariableCS(cond, mutex, INFINITE))
return ETIMEDOUT;
return 0;
#else
return pthread_cond_wait(cond, mutex);
#endif
}
static inline int native_cond_signal(native_cond_t *cond)
{
#ifdef _WIN32
WakeConditionVariable(cond);
return 0;
#else
return pthread_cond_signal(cond);
#endif
}
static inline int native_cond_broadcast(native_cond_t *cond)
{
#ifdef _WIN32
WakeAllConditionVariable(cond);
return 0;
#else
return pthread_cond_broadcast(cond);
#endif
}
#ifdef SAFE_MUTEX
int safe_cond_wait(native_cond_t *cond, my_mutex_t *mp,
const char *file, uint line);
int safe_cond_timedwait(native_cond_t *cond, my_mutex_t *mp,
const struct timespec *abstime,
const char *file, uint line);
#endif
static inline int my_cond_timedwait(native_cond_t *cond, my_mutex_t *mp,
const struct timespec *abstime
#ifdef SAFE_MUTEX
, const char *file, uint line
#endif
)
{
#ifdef SAFE_MUTEX
return safe_cond_timedwait(cond, mp, abstime, file, line);
#else
return native_cond_timedwait(cond, mp, abstime);
#endif
}
static inline int my_cond_wait(native_cond_t *cond, my_mutex_t *mp
#ifdef SAFE_MUTEX
, const char *file, uint line
#endif
)
{
#ifdef SAFE_MUTEX
return safe_cond_wait(cond, mp, file, line);
#else
return native_cond_wait(cond, mp);
#endif
}
C_MODE_END
#endif /* THR_COND_INCLUDED */

227
3rdparty/mysql/include/thr_mutex.h vendored Normal file
View File

@ -0,0 +1,227 @@
#ifndef THR_MUTEX_INCLUDED
#define THR_MUTEX_INCLUDED
/* Copyright (c) 2014, 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/**
MySQL mutex implementation.
There are three "layers":
1) native_mutex_*()
Functions that map directly down to OS primitives.
Windows - CriticalSection
Other OSes - pthread
2) my_mutex_*()
Functions that implement SAFE_MUTEX (default for debug),
Otherwise native_mutex_*() is used.
3) mysql_mutex_*()
Functions that include Performance Schema instrumentation.
See include/mysql/psi/mysql_thread.h
*/
#include <my_global.h>
#include "my_thread.h"
C_MODE_START
#ifdef _WIN32
typedef CRITICAL_SECTION native_mutex_t;
typedef int native_mutexattr_t;
#else
typedef pthread_mutex_t native_mutex_t;
typedef pthread_mutexattr_t native_mutexattr_t;
#endif
/* Define mutex types, see my_thr_init.c */
#define MY_MUTEX_INIT_SLOW NULL
/* Can be set in /usr/include/pthread.h */
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
extern native_mutexattr_t my_fast_mutexattr;
#define MY_MUTEX_INIT_FAST &my_fast_mutexattr
#else
#define MY_MUTEX_INIT_FAST NULL
#endif
/* Can be set in /usr/include/pthread.h */
#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
extern native_mutexattr_t my_errorcheck_mutexattr;
#define MY_MUTEX_INIT_ERRCHK &my_errorcheck_mutexattr
#else
#define MY_MUTEX_INIT_ERRCHK NULL
#endif
static inline int native_mutex_init(native_mutex_t *mutex,
const native_mutexattr_t *attr)
{
#ifdef _WIN32
InitializeCriticalSection(mutex);
return 0;
#else
return pthread_mutex_init(mutex, attr);
#endif
}
static inline int native_mutex_lock(native_mutex_t *mutex)
{
#ifdef _WIN32
EnterCriticalSection(mutex);
return 0;
#else
return pthread_mutex_lock(mutex);
#endif
}
static inline int native_mutex_trylock(native_mutex_t *mutex)
{
#ifdef _WIN32
if (TryEnterCriticalSection(mutex))
{
/* Don't allow recursive lock */
if (mutex->RecursionCount > 1){
LeaveCriticalSection(mutex);
return EBUSY;
}
return 0;
}
return EBUSY;
#else
return pthread_mutex_trylock(mutex);
#endif
}
static inline int native_mutex_unlock(native_mutex_t *mutex)
{
#ifdef _WIN32
LeaveCriticalSection(mutex);
return 0;
#else
return pthread_mutex_unlock(mutex);
#endif
}
static inline int native_mutex_destroy(native_mutex_t *mutex)
{
#ifdef _WIN32
DeleteCriticalSection(mutex);
return 0;
#else
return pthread_mutex_destroy(mutex);
#endif
}
#ifdef SAFE_MUTEX
/* safe_mutex adds checking to mutex for easier debugging */
typedef struct st_safe_mutex_t
{
native_mutex_t global, mutex;
const char *file;
uint line, count;
my_thread_t thread;
} my_mutex_t;
void safe_mutex_global_init();
int safe_mutex_init(my_mutex_t *mp, const native_mutexattr_t *attr,
const char *file, uint line);
int safe_mutex_lock(my_mutex_t *mp, my_bool try_lock, const char *file, uint line);
int safe_mutex_unlock(my_mutex_t *mp, const char *file, uint line);
int safe_mutex_destroy(my_mutex_t *mp, const char *file, uint line);
static inline void safe_mutex_assert_owner(const my_mutex_t *mp)
{
DBUG_ASSERT(mp->count > 0 &&
my_thread_equal(my_thread_self(), mp->thread));
}
static inline void safe_mutex_assert_not_owner(const my_mutex_t *mp)
{
DBUG_ASSERT(!mp->count ||
!my_thread_equal(my_thread_self(), mp->thread));
}
#else
typedef native_mutex_t my_mutex_t;
#endif
static inline int my_mutex_init(my_mutex_t *mp, const native_mutexattr_t *attr
#ifdef SAFE_MUTEX
, const char *file, uint line
#endif
)
{
#ifdef SAFE_MUTEX
return safe_mutex_init(mp, attr, file, line);
#else
return native_mutex_init(mp, attr);
#endif
}
static inline int my_mutex_lock(my_mutex_t *mp
#ifdef SAFE_MUTEX
, const char *file, uint line
#endif
)
{
#ifdef SAFE_MUTEX
return safe_mutex_lock(mp, FALSE, file, line);
#else
return native_mutex_lock(mp);
#endif
}
static inline int my_mutex_trylock(my_mutex_t *mp
#ifdef SAFE_MUTEX
, const char *file, uint line
#endif
)
{
#ifdef SAFE_MUTEX
return safe_mutex_lock(mp, TRUE, file, line);
#else
return native_mutex_trylock(mp);
#endif
}
static inline int my_mutex_unlock(my_mutex_t *mp
#ifdef SAFE_MUTEX
, const char *file, uint line
#endif
)
{
#ifdef SAFE_MUTEX
return safe_mutex_unlock(mp, file, line);
#else
return native_mutex_unlock(mp);
#endif
}
static inline int my_mutex_destroy(my_mutex_t *mp
#ifdef SAFE_MUTEX
, const char *file, uint line
#endif
)
{
#ifdef SAFE_MUTEX
return safe_mutex_destroy(mp, file, line);
#else
return native_mutex_destroy(mp);
#endif
}
C_MODE_END
#endif /* THR_MUTEX_INCLUDED */

214
3rdparty/mysql/include/thr_rwlock.h vendored Normal file
View File

@ -0,0 +1,214 @@
#ifndef THR_RWLOCK_INCLUDED
#define THR_RWLOCK_INCLUDED
/* Copyright (c) 2014, 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-1301 USA */
/**
MySQL rwlock implementation.
There are two "layers":
1) native_rw_*()
Functions that map directly down to OS primitives.
Windows - SRWLock
Other OSes - pthread
2) mysql_rw*()
Functions that include Performance Schema instrumentation.
See include/mysql/psi/mysql_thread.h
This file also includes rw_pr_*(), which implements a special
version of rwlocks that prefer readers. The P_S version of these
are mysql_prlock_*() - see include/mysql/psi/mysql_thread.h
*/
#include "my_global.h"
#include "my_thread.h"
#include "thr_cond.h"
C_MODE_START
#ifdef _WIN32
typedef struct st_my_rw_lock_t
{
SRWLOCK srwlock; /* native reader writer lock */
BOOL have_exclusive_srwlock; /* used for unlock */
} native_rw_lock_t;
#else
typedef pthread_rwlock_t native_rw_lock_t;
#endif
static inline int native_rw_init(native_rw_lock_t *rwp)
{
#ifdef _WIN32
InitializeSRWLock(&rwp->srwlock);
rwp->have_exclusive_srwlock = FALSE;
return 0;
#else
/* pthread_rwlockattr_t is not used in MySQL */
return pthread_rwlock_init(rwp, NULL);
#endif
}
static inline int native_rw_destroy(native_rw_lock_t *rwp)
{
#ifdef _WIN32
return 0; /* no destroy function */
#else
return pthread_rwlock_destroy(rwp);
#endif
}
static inline int native_rw_rdlock(native_rw_lock_t *rwp)
{
#ifdef _WIN32
AcquireSRWLockShared(&rwp->srwlock);
return 0;
#else
return pthread_rwlock_rdlock(rwp);
#endif
}
static inline int native_rw_tryrdlock(native_rw_lock_t *rwp)
{
#ifdef _WIN32
if (!TryAcquireSRWLockShared(&rwp->srwlock))
return EBUSY;
return 0;
#else
return pthread_rwlock_tryrdlock(rwp);
#endif
}
static inline int native_rw_wrlock(native_rw_lock_t *rwp)
{
#ifdef _WIN32
AcquireSRWLockExclusive(&rwp->srwlock);
rwp->have_exclusive_srwlock= TRUE;
return 0;
#else
return pthread_rwlock_wrlock(rwp);
#endif
}
static inline int native_rw_trywrlock(native_rw_lock_t *rwp)
{
#ifdef _WIN32
if (!TryAcquireSRWLockExclusive(&rwp->srwlock))
return EBUSY;
rwp->have_exclusive_srwlock= TRUE;
return 0;
#else
return pthread_rwlock_trywrlock(rwp);
#endif
}
static inline int native_rw_unlock(native_rw_lock_t *rwp)
{
#ifdef _WIN32
if (rwp->have_exclusive_srwlock)
{
rwp->have_exclusive_srwlock= FALSE;
ReleaseSRWLockExclusive(&rwp->srwlock);
}
else
ReleaseSRWLockShared(&rwp->srwlock);
return 0;
#else
return pthread_rwlock_unlock(rwp);
#endif
}
/**
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 scenario in which they are most oftenly used
within MDL subsystem. Optimizing for it gives significant
performance improvements in some of 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.
*/
native_mutex_t lock;
/**
Condition variable which is used to wake-up
writers waiting for readers to go away.
*/
native_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). */
my_thread_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 *);
static inline void
rw_pr_lock_assert_write_owner(const rw_pr_lock_t *rwlock MY_ATTRIBUTE((unused)))
{
#ifdef SAFE_MUTEX
DBUG_ASSERT(rwlock->active_writer &&
my_thread_equal(my_thread_self(), rwlock->writer_thread));
#endif
}
static inline void
rw_pr_lock_assert_not_write_owner(const rw_pr_lock_t *rwlock MY_ATTRIBUTE((unused)))
{
#ifdef SAFE_MUTEX
DBUG_ASSERT(!rwlock->active_writer ||
!my_thread_equal(my_thread_self(), rwlock->writer_thread));
#endif
}
C_MODE_END
#endif /* THR_RWLOCK_INCLUDED */

View File

@ -1,9 +1,8 @@
/* Copyright (C) 2000 MySQL AB
/* 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; either version 2 of the License, or
(at your option) any later version.
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -12,12 +11,14 @@
You 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 */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 */
@ -25,10 +26,29 @@ typedef struct st_typelib { /* Different types saved here */
unsigned int *type_lengths;
} TYPELIB;
extern int find_type(char *x,TYPELIB *typelib,unsigned int full_name);
extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
extern int find_type_or_exit(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 (1 << 0)
/** always implicitely on, so unused, but old code may pass it */
#define FIND_TYPE_NO_OVERWRITE (1 << 1)
/** makes @c find_type() accept a number */
#define FIND_TYPE_ALLOW_NUMBER (1 << 2)
/** makes @c find_type() treat ',' as terminator */
#define FIND_TYPE_COMMA_TERM (1 << 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, 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 */

BIN
3rdparty/mysql/lib/Win32/libmysql.dll vendored Normal file

Binary file not shown.

BIN
3rdparty/mysql/lib/Win32/libmysql.lib vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
3rdparty/mysql/lib/x64/libmysql.dll vendored Normal file

Binary file not shown.

BIN
3rdparty/mysql/lib/x64/libmysql.lib vendored Normal file

Binary file not shown.

View File

@ -5,7 +5,7 @@
/* This is the public header file for the PCRE library, to be #included by
applications that call the PCRE functions.
Copyright (c) 1997-2012 University of Cambridge
Copyright (c) 1997-2013 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE.
/* The current PCRE version information. */
#define PCRE_MAJOR 8
#define PCRE_MINOR 30
#define PCRE_MINOR 33
#define PCRE_PRERELEASE
#define PCRE_DATE 2012-02-04
#define PCRE_DATE 2013-05-28
/* When an application links to a PCRE DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE, the appropriate
@ -95,54 +95,77 @@ it is needed here for malloc. */
extern "C" {
#endif
/* Options. Some are compile-time only, some are run-time only, and some are
both, so we keep them all distinct. However, almost all the bits in the options
word are now used. In the long run, we may have to re-use some of the
compile-time only bits for runtime options, or vice versa. In the comments
below, "compile", "exec", and "DFA exec" mean that the option is permitted to
be set for those functions; "used in" means that an option may be set only for
compile, but is subsequently referenced in exec and/or DFA exec. Any of the
compile-time options may be inspected during studying (and therefore JIT
compiling). */
/* Public options. Some are compile-time only, some are run-time only, and some
are both. Most of the compile-time options are saved with the compiled regex so
that they can be inspected during studying (and therefore JIT compiling). Note
that pcre_study() has its own set of options. Originally, all the options
defined here used distinct bits. However, almost all the bits in a 32-bit word
are now used, so in order to conserve them, option bits that were previously
only recognized at matching time (i.e. by pcre_exec() or pcre_dfa_exec()) may
also be used for compile-time options that affect only compiling and are not
relevant for studying or JIT compiling.
#define PCRE_CASELESS 0x00000001 /* Compile */
#define PCRE_MULTILINE 0x00000002 /* Compile */
#define PCRE_DOTALL 0x00000004 /* Compile */
#define PCRE_EXTENDED 0x00000008 /* Compile */
#define PCRE_ANCHORED 0x00000010 /* Compile, exec, DFA exec */
#define PCRE_DOLLAR_ENDONLY 0x00000020 /* Compile, used in exec, DFA exec */
#define PCRE_EXTRA 0x00000040 /* Compile */
#define PCRE_NOTBOL 0x00000080 /* Exec, DFA exec */
#define PCRE_NOTEOL 0x00000100 /* Exec, DFA exec */
#define PCRE_UNGREEDY 0x00000200 /* Compile */
#define PCRE_NOTEMPTY 0x00000400 /* Exec, DFA exec */
/* The next two are also used in exec and DFA exec */
#define PCRE_UTF8 0x00000800 /* Compile (same as PCRE_UTF16) */
#define PCRE_UTF16 0x00000800 /* Compile (same as PCRE_UTF8) */
#define PCRE_NO_AUTO_CAPTURE 0x00001000 /* Compile */
/* The next two are also used in exec and DFA exec */
#define PCRE_NO_UTF8_CHECK 0x00002000 /* Compile (same as PCRE_NO_UTF16_CHECK) */
#define PCRE_NO_UTF16_CHECK 0x00002000 /* Compile (same as PCRE_NO_UTF8_CHECK) */
#define PCRE_AUTO_CALLOUT 0x00004000 /* Compile */
#define PCRE_PARTIAL_SOFT 0x00008000 /* Exec, DFA exec */
#define PCRE_PARTIAL 0x00008000 /* Backwards compatible synonym */
#define PCRE_DFA_SHORTEST 0x00010000 /* DFA exec */
#define PCRE_DFA_RESTART 0x00020000 /* DFA exec */
#define PCRE_FIRSTLINE 0x00040000 /* Compile, used in exec, DFA exec */
#define PCRE_DUPNAMES 0x00080000 /* Compile */
#define PCRE_NEWLINE_CR 0x00100000 /* Compile, exec, DFA exec */
#define PCRE_NEWLINE_LF 0x00200000 /* Compile, exec, DFA exec */
#define PCRE_NEWLINE_CRLF 0x00300000 /* Compile, exec, DFA exec */
#define PCRE_NEWLINE_ANY 0x00400000 /* Compile, exec, DFA exec */
#define PCRE_NEWLINE_ANYCRLF 0x00500000 /* Compile, exec, DFA exec */
#define PCRE_BSR_ANYCRLF 0x00800000 /* Compile, exec, DFA exec */
#define PCRE_BSR_UNICODE 0x01000000 /* Compile, exec, DFA exec */
#define PCRE_JAVASCRIPT_COMPAT 0x02000000 /* Compile, used in exec */
#define PCRE_NO_START_OPTIMIZE 0x04000000 /* Compile, exec, DFA exec */
#define PCRE_NO_START_OPTIMISE 0x04000000 /* Synonym */
#define PCRE_PARTIAL_HARD 0x08000000 /* Exec, DFA exec */
#define PCRE_NOTEMPTY_ATSTART 0x10000000 /* Exec, DFA exec */
#define PCRE_UCP 0x20000000 /* Compile, used in exec, DFA exec */
Some options for pcre_compile() change its behaviour but do not affect the
behaviour of the execution functions. Other options are passed through to the
execution functions and affect their behaviour, with or without affecting the
behaviour of pcre_compile().
Options that can be passed to pcre_compile() are tagged Cx below, with these
variants:
C1 Affects compile only
C2 Does not affect compile; affects exec, dfa_exec
C3 Affects compile, exec, dfa_exec
C4 Affects compile, exec, dfa_exec, study
C5 Affects compile, exec, study
Options that can be set for pcre_exec() and/or pcre_dfa_exec() are flagged with
E and D, respectively. They take precedence over C3, C4, and C5 settings passed
from pcre_compile(). Those that are compatible with JIT execution are flagged
with J. */
#define PCRE_CASELESS 0x00000001 /* C1 */
#define PCRE_MULTILINE 0x00000002 /* C1 */
#define PCRE_DOTALL 0x00000004 /* C1 */
#define PCRE_EXTENDED 0x00000008 /* C1 */
#define PCRE_ANCHORED 0x00000010 /* C4 E D */
#define PCRE_DOLLAR_ENDONLY 0x00000020 /* C2 */
#define PCRE_EXTRA 0x00000040 /* C1 */
#define PCRE_NOTBOL 0x00000080 /* E D J */
#define PCRE_NOTEOL 0x00000100 /* E D J */
#define PCRE_UNGREEDY 0x00000200 /* C1 */
#define PCRE_NOTEMPTY 0x00000400 /* E D J */
#define PCRE_UTF8 0x00000800 /* C4 ) */
#define PCRE_UTF16 0x00000800 /* C4 ) Synonyms */
#define PCRE_UTF32 0x00000800 /* C4 ) */
#define PCRE_NO_AUTO_CAPTURE 0x00001000 /* C1 */
#define PCRE_NO_UTF8_CHECK 0x00002000 /* C1 E D J ) */
#define PCRE_NO_UTF16_CHECK 0x00002000 /* C1 E D J ) Synonyms */
#define PCRE_NO_UTF32_CHECK 0x00002000 /* C1 E D J ) */
#define PCRE_AUTO_CALLOUT 0x00004000 /* C1 */
#define PCRE_PARTIAL_SOFT 0x00008000 /* E D J ) Synonyms */
#define PCRE_PARTIAL 0x00008000 /* E D J ) */
/* This pair use the same bit. */
#define PCRE_NEVER_UTF 0x00010000 /* C1 ) Overlaid */
#define PCRE_DFA_SHORTEST 0x00010000 /* D ) Overlaid */
#define PCRE_DFA_RESTART 0x00020000 /* D */
#define PCRE_FIRSTLINE 0x00040000 /* C3 */
#define PCRE_DUPNAMES 0x00080000 /* C1 */
#define PCRE_NEWLINE_CR 0x00100000 /* C3 E D */
#define PCRE_NEWLINE_LF 0x00200000 /* C3 E D */
#define PCRE_NEWLINE_CRLF 0x00300000 /* C3 E D */
#define PCRE_NEWLINE_ANY 0x00400000 /* C3 E D */
#define PCRE_NEWLINE_ANYCRLF 0x00500000 /* C3 E D */
#define PCRE_BSR_ANYCRLF 0x00800000 /* C3 E D */
#define PCRE_BSR_UNICODE 0x01000000 /* C3 E D */
#define PCRE_JAVASCRIPT_COMPAT 0x02000000 /* C5 */
#define PCRE_NO_START_OPTIMIZE 0x04000000 /* C2 E D ) Synonyms */
#define PCRE_NO_START_OPTIMISE 0x04000000 /* C2 E D ) */
#define PCRE_PARTIAL_HARD 0x08000000 /* E D J */
#define PCRE_NOTEMPTY_ATSTART 0x10000000 /* E D J */
#define PCRE_UCP 0x20000000 /* C3 */
/* Exec-time and get/set-time error codes */
@ -156,8 +179,9 @@ compiling). */
#define PCRE_ERROR_NOSUBSTRING (-7)
#define PCRE_ERROR_MATCHLIMIT (-8)
#define PCRE_ERROR_CALLOUT (-9) /* Never used by PCRE itself */
#define PCRE_ERROR_BADUTF8 (-10) /* Same for 8/16 */
#define PCRE_ERROR_BADUTF16 (-10) /* Same for 8/16 */
#define PCRE_ERROR_BADUTF8 (-10) /* Same for 8/16/32 */
#define PCRE_ERROR_BADUTF16 (-10) /* Same for 8/16/32 */
#define PCRE_ERROR_BADUTF32 (-10) /* Same for 8/16/32 */
#define PCRE_ERROR_BADUTF8_OFFSET (-11) /* Same for 8/16 */
#define PCRE_ERROR_BADUTF16_OFFSET (-11) /* Same for 8/16 */
#define PCRE_ERROR_PARTIAL (-12)
@ -179,6 +203,10 @@ compiling). */
#define PCRE_ERROR_JIT_STACKLIMIT (-27)
#define PCRE_ERROR_BADMODE (-28)
#define PCRE_ERROR_BADENDIANNESS (-29)
#define PCRE_ERROR_DFA_BADRESTART (-30)
#define PCRE_ERROR_JIT_BADOPTION (-31)
#define PCRE_ERROR_BADLENGTH (-32)
#define PCRE_ERROR_UNSET (-33)
/* Specific error codes for UTF-8 validity checks */
@ -204,6 +232,7 @@ compiling). */
#define PCRE_UTF8_ERR19 19
#define PCRE_UTF8_ERR20 20
#define PCRE_UTF8_ERR21 21
#define PCRE_UTF8_ERR22 22 /* Unused (was non-character) */
/* Specific error codes for UTF-16 validity checks */
@ -211,7 +240,14 @@ compiling). */
#define PCRE_UTF16_ERR1 1
#define PCRE_UTF16_ERR2 2
#define PCRE_UTF16_ERR3 3
#define PCRE_UTF16_ERR4 4
#define PCRE_UTF16_ERR4 4 /* Unused (was non-character) */
/* Specific error codes for UTF-32 validity checks */
#define PCRE_UTF32_ERR0 0
#define PCRE_UTF32_ERR1 1
#define PCRE_UTF32_ERR2 2 /* Unused (was non-character) */
#define PCRE_UTF32_ERR3 3
/* Request types for pcre_fullinfo() */
@ -234,6 +270,13 @@ compiling). */
#define PCRE_INFO_MINLENGTH 15
#define PCRE_INFO_JIT 16
#define PCRE_INFO_JITSIZE 17
#define PCRE_INFO_MAXLOOKBEHIND 18
#define PCRE_INFO_FIRSTCHARACTER 19
#define PCRE_INFO_FIRSTCHARACTERFLAGS 20
#define PCRE_INFO_REQUIREDCHAR 21
#define PCRE_INFO_REQUIREDCHARFLAGS 22
#define PCRE_INFO_MATCHLIMIT 23
#define PCRE_INFO_RECURSIONLIMIT 24
/* Request types for pcre_config(). Do not re-arrange, in order to remain
compatible. */
@ -250,13 +293,17 @@ compatible. */
#define PCRE_CONFIG_JIT 9
#define PCRE_CONFIG_UTF16 10
#define PCRE_CONFIG_JITTARGET 11
#define PCRE_CONFIG_UTF32 12
/* Request types for pcre_study(). Do not re-arrange, in order to remain
compatible. */
#define PCRE_STUDY_JIT_COMPILE 0x0001
#define PCRE_STUDY_JIT_COMPILE 0x0001
#define PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE 0x0002
#define PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE 0x0004
#define PCRE_STUDY_EXTRA_NEEDED 0x0008
/* Bit flags for the pcre[16]_extra structure. Do not re-arrange or redefine
/* Bit flags for the pcre[16|32]_extra structure. Do not re-arrange or redefine
these bits, just add new ones on the end, in order to remain compatible. */
#define PCRE_EXTRA_STUDY_DATA 0x0001
@ -275,12 +322,18 @@ typedef struct real_pcre pcre;
struct real_pcre16; /* declaration; the definition is private */
typedef struct real_pcre16 pcre16;
struct real_pcre32; /* declaration; the definition is private */
typedef struct real_pcre32 pcre32;
struct real_pcre_jit_stack; /* declaration; the definition is private */
typedef struct real_pcre_jit_stack pcre_jit_stack;
struct real_pcre16_jit_stack; /* declaration; the definition is private */
typedef struct real_pcre16_jit_stack pcre16_jit_stack;
struct real_pcre32_jit_stack; /* declaration; the definition is private */
typedef struct real_pcre32_jit_stack pcre32_jit_stack;
/* If PCRE is compiled with 16 bit character support, PCRE_UCHAR16 must contain
a 16 bit wide signed data type. Otherwise it can be a dummy data type since
pcre16 functions are not implemented. There is a check for this in pcre_internal.h. */
@ -292,6 +345,17 @@ pcre16 functions are not implemented. There is a check for this in pcre_internal
#define PCRE_SPTR16 const PCRE_UCHAR16 *
#endif
/* If PCRE is compiled with 32 bit character support, PCRE_UCHAR32 must contain
a 32 bit wide signed data type. Otherwise it can be a dummy data type since
pcre32 functions are not implemented. There is a check for this in pcre_internal.h. */
#ifndef PCRE_UCHAR32
#define PCRE_UCHAR32 unsigned int
#endif
#ifndef PCRE_SPTR32
#define PCRE_SPTR32 const PCRE_UCHAR32 *
#endif
/* When PCRE is compiled as a C++ library, the subject pointer type can be
replaced with a custom type. For conventional use, the public interface is a
const char *. */
@ -328,6 +392,19 @@ typedef struct pcre16_extra {
void *executable_jit; /* Contains a pointer to a compiled jit code */
} pcre16_extra;
/* Same structure as above, but with 32 bit char pointers. */
typedef struct pcre32_extra {
unsigned long int flags; /* Bits for which fields are set */
void *study_data; /* Opaque data from pcre_study() */
unsigned long int match_limit; /* Maximum number of calls to match() */
void *callout_data; /* Data passed back in callouts */
const unsigned char *tables; /* Pointer to character tables */
unsigned long int match_limit_recursion; /* Max recursive calls to match() */
PCRE_UCHAR32 **mark; /* For passing back a mark pointer */
void *executable_jit; /* Contains a pointer to a compiled jit code */
} pcre32_extra;
/* The structure for passing out data via the pcre_callout_function. We use a
structure so that new fields can be added on the end in future versions,
without changing the API of the function, thereby allowing old clients to work
@ -375,6 +452,28 @@ typedef struct pcre16_callout_block {
/* ------------------------------------------------------------------ */
} pcre16_callout_block;
/* Same structure as above, but with 32 bit char pointers. */
typedef struct pcre32_callout_block {
int version; /* Identifies version of block */
/* ------------------------ Version 0 ------------------------------- */
int callout_number; /* Number compiled into pattern */
int *offset_vector; /* The offset vector */
PCRE_SPTR32 subject; /* The subject being matched */
int subject_length; /* The length of the subject */
int start_match; /* Offset to start of this match attempt */
int current_position; /* Where we currently are in the subject */
int capture_top; /* Max current capture */
int capture_last; /* Most recently closed capture */
void *callout_data; /* Data passed in with the call */
/* ------------------- Added for Version 1 -------------------------- */
int pattern_position; /* Offset to next item in the pattern */
int next_item_length; /* Length of next item in the pattern */
/* ------------------- Added for Version 2 -------------------------- */
const PCRE_UCHAR32 *mark; /* Pointer to current mark or NULL */
/* ------------------------------------------------------------------ */
} pcre32_callout_block;
/* Indirection for store get and free functions. These can be set to
alternative malloc/free functions if required. Special ones are used in the
non-recursive case for "frames". There is also an optional callout function
@ -393,6 +492,12 @@ PCRE_EXP_DECL void (*pcre16_free)(void *);
PCRE_EXP_DECL void *(*pcre16_stack_malloc)(size_t);
PCRE_EXP_DECL void (*pcre16_stack_free)(void *);
PCRE_EXP_DECL int (*pcre16_callout)(pcre16_callout_block *);
PCRE_EXP_DECL void *(*pcre32_malloc)(size_t);
PCRE_EXP_DECL void (*pcre32_free)(void *);
PCRE_EXP_DECL void *(*pcre32_stack_malloc)(size_t);
PCRE_EXP_DECL void (*pcre32_stack_free)(void *);
PCRE_EXP_DECL int (*pcre32_callout)(pcre32_callout_block *);
#else /* VPCOMPAT */
PCRE_EXP_DECL void *pcre_malloc(size_t);
PCRE_EXP_DECL void pcre_free(void *);
@ -405,12 +510,19 @@ PCRE_EXP_DECL void pcre16_free(void *);
PCRE_EXP_DECL void *pcre16_stack_malloc(size_t);
PCRE_EXP_DECL void pcre16_stack_free(void *);
PCRE_EXP_DECL int pcre16_callout(pcre16_callout_block *);
PCRE_EXP_DECL void *pcre32_malloc(size_t);
PCRE_EXP_DECL void pcre32_free(void *);
PCRE_EXP_DECL void *pcre32_stack_malloc(size_t);
PCRE_EXP_DECL void pcre32_stack_free(void *);
PCRE_EXP_DECL int pcre32_callout(pcre32_callout_block *);
#endif /* VPCOMPAT */
/* User defined callback which provides a stack just before the match starts. */
typedef pcre_jit_stack *(*pcre_jit_callback)(void *);
typedef pcre16_jit_stack *(*pcre16_jit_callback)(void *);
typedef pcre32_jit_stack *(*pcre32_jit_callback)(void *);
/* Exported PCRE functions */
@ -418,83 +530,131 @@ PCRE_EXP_DECL pcre *pcre_compile(const char *, int, const char **, int *,
const unsigned char *);
PCRE_EXP_DECL pcre16 *pcre16_compile(PCRE_SPTR16, int, const char **, int *,
const unsigned char *);
PCRE_EXP_DECL pcre32 *pcre32_compile(PCRE_SPTR32, int, const char **, int *,
const unsigned char *);
PCRE_EXP_DECL pcre *pcre_compile2(const char *, int, int *, const char **,
int *, const unsigned char *);
PCRE_EXP_DECL pcre16 *pcre16_compile2(PCRE_SPTR16, int, int *, const char **,
int *, const unsigned char *);
PCRE_EXP_DECL pcre32 *pcre32_compile2(PCRE_SPTR32, int, int *, const char **,
int *, const unsigned char *);
PCRE_EXP_DECL int pcre_config(int, void *);
PCRE_EXP_DECL int pcre16_config(int, void *);
PCRE_EXP_DECL int pcre32_config(int, void *);
PCRE_EXP_DECL int pcre_copy_named_substring(const pcre *, const char *,
int *, int, const char *, char *, int);
PCRE_EXP_DECL int pcre16_copy_named_substring(const pcre16 *, PCRE_SPTR16,
int *, int, PCRE_SPTR16, PCRE_UCHAR16 *, int);
PCRE_EXP_DECL int pcre32_copy_named_substring(const pcre32 *, PCRE_SPTR32,
int *, int, PCRE_SPTR32, PCRE_UCHAR32 *, int);
PCRE_EXP_DECL int pcre_copy_substring(const char *, int *, int, int,
char *, int);
PCRE_EXP_DECL int pcre16_copy_substring(PCRE_SPTR16, int *, int, int,
PCRE_UCHAR16 *, int);
PCRE_EXP_DECL int pcre32_copy_substring(PCRE_SPTR32, int *, int, int,
PCRE_UCHAR32 *, int);
PCRE_EXP_DECL int pcre_dfa_exec(const pcre *, const pcre_extra *,
const char *, int, int, int, int *, int , int *, int);
PCRE_EXP_DECL int pcre16_dfa_exec(const pcre16 *, const pcre16_extra *,
PCRE_SPTR16, int, int, int, int *, int , int *, int);
PCRE_EXP_DECL int pcre32_dfa_exec(const pcre32 *, const pcre32_extra *,
PCRE_SPTR32, int, int, int, int *, int , int *, int);
PCRE_EXP_DECL int pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR,
int, int, int, int *, int);
PCRE_EXP_DECL int pcre16_exec(const pcre16 *, const pcre16_extra *,
PCRE_SPTR16, int, int, int, int *, int);
PCRE_EXP_DECL int pcre32_exec(const pcre32 *, const pcre32_extra *,
PCRE_SPTR32, int, int, int, int *, int);
PCRE_EXP_DECL int pcre_jit_exec(const pcre *, const pcre_extra *,
PCRE_SPTR, int, int, int, int *, int,
pcre_jit_stack *);
PCRE_EXP_DECL int pcre16_jit_exec(const pcre16 *, const pcre16_extra *,
PCRE_SPTR16, int, int, int, int *, int,
pcre16_jit_stack *);
PCRE_EXP_DECL int pcre32_jit_exec(const pcre32 *, const pcre32_extra *,
PCRE_SPTR32, int, int, int, int *, int,
pcre32_jit_stack *);
PCRE_EXP_DECL void pcre_free_substring(const char *);
PCRE_EXP_DECL void pcre16_free_substring(PCRE_SPTR16);
PCRE_EXP_DECL void pcre32_free_substring(PCRE_SPTR32);
PCRE_EXP_DECL void pcre_free_substring_list(const char **);
PCRE_EXP_DECL void pcre16_free_substring_list(PCRE_SPTR16 *);
PCRE_EXP_DECL void pcre32_free_substring_list(PCRE_SPTR32 *);
PCRE_EXP_DECL int pcre_fullinfo(const pcre *, const pcre_extra *, int,
void *);
PCRE_EXP_DECL int pcre16_fullinfo(const pcre16 *, const pcre16_extra *, int,
void *);
PCRE_EXP_DECL int pcre32_fullinfo(const pcre32 *, const pcre32_extra *, int,
void *);
PCRE_EXP_DECL int pcre_get_named_substring(const pcre *, const char *,
int *, int, const char *, const char **);
PCRE_EXP_DECL int pcre16_get_named_substring(const pcre16 *, PCRE_SPTR16,
int *, int, PCRE_SPTR16, PCRE_SPTR16 *);
PCRE_EXP_DECL int pcre32_get_named_substring(const pcre32 *, PCRE_SPTR32,
int *, int, PCRE_SPTR32, PCRE_SPTR32 *);
PCRE_EXP_DECL int pcre_get_stringnumber(const pcre *, const char *);
PCRE_EXP_DECL int pcre16_get_stringnumber(const pcre16 *, PCRE_SPTR16);
PCRE_EXP_DECL int pcre32_get_stringnumber(const pcre32 *, PCRE_SPTR32);
PCRE_EXP_DECL int pcre_get_stringtable_entries(const pcre *, const char *,
char **, char **);
PCRE_EXP_DECL int pcre16_get_stringtable_entries(const pcre16 *, PCRE_SPTR16,
PCRE_UCHAR16 **, PCRE_UCHAR16 **);
PCRE_EXP_DECL int pcre32_get_stringtable_entries(const pcre32 *, PCRE_SPTR32,
PCRE_UCHAR32 **, PCRE_UCHAR32 **);
PCRE_EXP_DECL int pcre_get_substring(const char *, int *, int, int,
const char **);
PCRE_EXP_DECL int pcre16_get_substring(PCRE_SPTR16, int *, int, int,
PCRE_SPTR16 *);
PCRE_EXP_DECL int pcre32_get_substring(PCRE_SPTR32, int *, int, int,
PCRE_SPTR32 *);
PCRE_EXP_DECL int pcre_get_substring_list(const char *, int *, int,
const char ***);
PCRE_EXP_DECL int pcre16_get_substring_list(PCRE_SPTR16, int *, int,
PCRE_SPTR16 **);
PCRE_EXP_DECL int pcre32_get_substring_list(PCRE_SPTR32, int *, int,
PCRE_SPTR32 **);
PCRE_EXP_DECL const unsigned char *pcre_maketables(void);
PCRE_EXP_DECL const unsigned char *pcre16_maketables(void);
PCRE_EXP_DECL const unsigned char *pcre32_maketables(void);
PCRE_EXP_DECL int pcre_refcount(pcre *, int);
PCRE_EXP_DECL int pcre16_refcount(pcre16 *, int);
PCRE_EXP_DECL int pcre32_refcount(pcre32 *, int);
PCRE_EXP_DECL pcre_extra *pcre_study(const pcre *, int, const char **);
PCRE_EXP_DECL pcre16_extra *pcre16_study(const pcre16 *, int, const char **);
PCRE_EXP_DECL pcre32_extra *pcre32_study(const pcre32 *, int, const char **);
PCRE_EXP_DECL void pcre_free_study(pcre_extra *);
PCRE_EXP_DECL void pcre16_free_study(pcre16_extra *);
PCRE_EXP_DECL void pcre32_free_study(pcre32_extra *);
PCRE_EXP_DECL const char *pcre_version(void);
PCRE_EXP_DECL const char *pcre16_version(void);
PCRE_EXP_DECL const char *pcre32_version(void);
/* Utility functions for byte order swaps. */
PCRE_EXP_DECL int pcre_pattern_to_host_byte_order(pcre *, pcre_extra *,
const unsigned char *);
PCRE_EXP_DECL int pcre16_pattern_to_host_byte_order(pcre16 *, pcre16_extra *,
const unsigned char *);
PCRE_EXP_DECL int pcre32_pattern_to_host_byte_order(pcre32 *, pcre32_extra *,
const unsigned char *);
PCRE_EXP_DECL int pcre16_utf16_to_host_byte_order(PCRE_UCHAR16 *,
PCRE_SPTR16, int, int *, int);
PCRE_EXP_DECL int pcre32_utf32_to_host_byte_order(PCRE_UCHAR32 *,
PCRE_SPTR32, int, int *, int);
/* JIT compiler related functions. */
PCRE_EXP_DECL pcre_jit_stack *pcre_jit_stack_alloc(int, int);
PCRE_EXP_DECL pcre16_jit_stack *pcre16_jit_stack_alloc(int, int);
PCRE_EXP_DECL pcre32_jit_stack *pcre32_jit_stack_alloc(int, int);
PCRE_EXP_DECL void pcre_jit_stack_free(pcre_jit_stack *);
PCRE_EXP_DECL void pcre16_jit_stack_free(pcre16_jit_stack *);
PCRE_EXP_DECL void pcre32_jit_stack_free(pcre32_jit_stack *);
PCRE_EXP_DECL void pcre_assign_jit_stack(pcre_extra *,
pcre_jit_callback, void *);
PCRE_EXP_DECL void pcre16_assign_jit_stack(pcre16_extra *,
pcre16_jit_callback, void *);
PCRE_EXP_DECL void pcre32_assign_jit_stack(pcre32_extra *,
pcre32_jit_callback, void *);
#ifdef __cplusplus
} /* extern "C" */

BIN
3rdparty/pcre/lib/Win32/pcre8.dll vendored Normal file

Binary file not shown.

BIN
3rdparty/pcre/lib/Win32/pcre8.lib vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
3rdparty/pcre/lib/x64/pcre8.dll vendored Normal file

Binary file not shown.

BIN
3rdparty/pcre/lib/x64/pcre8.lib vendored Normal file

Binary file not shown.

View File

@ -7,6 +7,8 @@
#ifndef ZCONF_H
#define ZCONF_H
/* #undef Z_PREFIX */
/* #undef Z_HAVE_UNISTD_H */
/*
* If you *really* need a unique prefix for all types and library functions,

BIN
3rdparty/zlib/lib/Win32/zlib.dll vendored Normal file

Binary file not shown.

BIN
3rdparty/zlib/lib/Win32/zlib.lib vendored Normal file

Binary file not shown.

BIN
3rdparty/zlib/lib/x64/zlib.dll vendored Normal file

Binary file not shown.

BIN
3rdparty/zlib/lib/x64/zlib.lib vendored Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,4 @@
image: Visual Studio 2015
image: Visual Studio 2013
# This is the default location, but we put it here for safety reasons, since we use it in our test script
clone_folder: c:\projects\rathena
# We do not need the git history for our integration tests
@ -8,32 +8,13 @@ pull_requests:
do_not_increment_build_number: true
environment:
matrix:
- VisualStudioVersion: 10.0
Solution: rAthena-10.sln
Defines: "\"BUILDBOT\""
- VisualStudioVersion: 11.0
Solution: rAthena-12.sln
Defines: "\"BUILDBOT\""
- VisualStudioVersion: 12.0
Solution: rAthena-13.sln
- VisualStudioVersion: 14.0
Defines: "\"BUILDBOT\""
- VisualStudioVersion: 14.0
Solution: rAthena-14.sln
Defines: "\"BUILDBOT\""
- VisualStudioVersion: 10.0
Solution: rAthena-10.sln
Defines: "\"BUILDBOT;PRERE\""
- VisualStudioVersion: 11.0
Solution: rAthena-12.sln
Defines: "\"BUILDBOT;PRERE\""
- VisualStudioVersion: 12.0
Solution: rAthena-13.sln
Defines: "\"BUILDBOT;PRERE\""
- VisualStudioVersion: 14.0
Solution: rAthena-14.sln
Defines: "\"BUILDBOT;PRERE\""
platform:
- Win32
- x64
configuration:
- Debug
# Disable Release for now, since do not want to have any optimization and have access to debug infos on crash
@ -41,7 +22,7 @@ configuration:
matrix:
fast_finish: true
build_script:
- cmd: msbuild %Solution% /p:DefineConstants=%Defines%
- cmd: msbuild rAthena.sln /p:DefineConstants=%Defines%
services: mysql
test_script:
- cmd: >-

Binary file not shown.

Binary file not shown.

BIN
pcre3.dll

Binary file not shown.

View File

@ -1,37 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "char-server", "vcproj-10\char-server.vcxproj", "{D356871D-58E1-450B-967A-E4E9646175AF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "login-server", "vcproj-10\login-server.vcxproj", "{D356871D-58E1-450B-967A-E5E9646175AF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "map-server", "vcproj-10\map-server.vcxproj", "{D356871D-58E1-450B-967A-E6E9646175AF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mapcache", "vcproj-10\mapcache.vcxproj", "{D356871D-58E1-450B-967A-E7E9646175AF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D356871D-58E1-450B-967A-E4E9646175AF}.Debug|Win32.ActiveCfg = Debug|Win32
{D356871D-58E1-450B-967A-E4E9646175AF}.Debug|Win32.Build.0 = Debug|Win32
{D356871D-58E1-450B-967A-E4E9646175AF}.Release|Win32.ActiveCfg = Release|Win32
{D356871D-58E1-450B-967A-E4E9646175AF}.Release|Win32.Build.0 = Release|Win32
{D356871D-58E1-450B-967A-E5E9646175AF}.Debug|Win32.ActiveCfg = Debug|Win32
{D356871D-58E1-450B-967A-E5E9646175AF}.Debug|Win32.Build.0 = Debug|Win32
{D356871D-58E1-450B-967A-E5E9646175AF}.Release|Win32.ActiveCfg = Release|Win32
{D356871D-58E1-450B-967A-E5E9646175AF}.Release|Win32.Build.0 = Release|Win32
{D356871D-58E1-450B-967A-E6E9646175AF}.Debug|Win32.ActiveCfg = Debug|Win32
{D356871D-58E1-450B-967A-E6E9646175AF}.Debug|Win32.Build.0 = Debug|Win32
{D356871D-58E1-450B-967A-E6E9646175AF}.Release|Win32.ActiveCfg = Release|Win32
{D356871D-58E1-450B-967A-E6E9646175AF}.Release|Win32.Build.0 = Release|Win32
{D356871D-58E1-450B-967A-E7E9646175AF}.Debug|Win32.ActiveCfg = Debug|Win32
{D356871D-58E1-450B-967A-E7E9646175AF}.Debug|Win32.Build.0 = Debug|Win32
{D356871D-58E1-450B-967A-E7E9646175AF}.Release|Win32.ActiveCfg = Release|Win32
{D356871D-58E1-450B-967A-E7E9646175AF}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,38 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "char-server", "vcproj-12\char-server.vcxproj", "{D356871D-58E1-450B-967A-E4E9646175AF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "login-server", "vcproj-12\login-server.vcxproj", "{D356871D-58E1-450B-967A-E5E9646175AF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "map-server", "vcproj-12\map-server.vcxproj", "{D356871D-58E1-450B-967A-E6E9646175AF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mapcache", "vcproj-12\mapcache.vcxproj", "{D356871D-58E1-450B-967A-E7E9646175AF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D356871D-58E1-450B-967A-E4E9646175AF}.Debug|Win32.ActiveCfg = Debug|Win32
{D356871D-58E1-450B-967A-E4E9646175AF}.Debug|Win32.Build.0 = Debug|Win32
{D356871D-58E1-450B-967A-E4E9646175AF}.Release|Win32.ActiveCfg = Release|Win32
{D356871D-58E1-450B-967A-E4E9646175AF}.Release|Win32.Build.0 = Release|Win32
{D356871D-58E1-450B-967A-E5E9646175AF}.Debug|Win32.ActiveCfg = Debug|Win32
{D356871D-58E1-450B-967A-E5E9646175AF}.Debug|Win32.Build.0 = Debug|Win32
{D356871D-58E1-450B-967A-E5E9646175AF}.Release|Win32.ActiveCfg = Release|Win32
{D356871D-58E1-450B-967A-E5E9646175AF}.Release|Win32.Build.0 = Release|Win32
{D356871D-58E1-450B-967A-E6E9646175AF}.Debug|Win32.ActiveCfg = Debug|Win32
{D356871D-58E1-450B-967A-E6E9646175AF}.Debug|Win32.Build.0 = Debug|Win32
{D356871D-58E1-450B-967A-E6E9646175AF}.Release|Win32.ActiveCfg = Release|Win32
{D356871D-58E1-450B-967A-E6E9646175AF}.Release|Win32.Build.0 = Release|Win32
{D356871D-58E1-450B-967A-E7E9646175AF}.Debug|Win32.ActiveCfg = Debug|Win32
{D356871D-58E1-450B-967A-E7E9646175AF}.Debug|Win32.Build.0 = Debug|Win32
{D356871D-58E1-450B-967A-E7E9646175AF}.Release|Win32.ActiveCfg = Release|Win32
{D356871D-58E1-450B-967A-E7E9646175AF}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,40 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "char-server", "vcproj-13\char-server.vcxproj", "{D356871D-58E1-450B-967A-E4E9646175AF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "login-server", "vcproj-13\login-server.vcxproj", "{D356871D-58E1-450B-967A-E5E9646175AF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "map-server", "vcproj-13\map-server.vcxproj", "{D356871D-58E1-450B-967A-E6E9646175AF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mapcache", "vcproj-13\mapcache.vcxproj", "{D356871D-58E1-450B-967A-E7E9646175AF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D356871D-58E1-450B-967A-E4E9646175AF}.Debug|Win32.ActiveCfg = Debug|Win32
{D356871D-58E1-450B-967A-E4E9646175AF}.Debug|Win32.Build.0 = Debug|Win32
{D356871D-58E1-450B-967A-E4E9646175AF}.Release|Win32.ActiveCfg = Release|Win32
{D356871D-58E1-450B-967A-E4E9646175AF}.Release|Win32.Build.0 = Release|Win32
{D356871D-58E1-450B-967A-E5E9646175AF}.Debug|Win32.ActiveCfg = Debug|Win32
{D356871D-58E1-450B-967A-E5E9646175AF}.Debug|Win32.Build.0 = Debug|Win32
{D356871D-58E1-450B-967A-E5E9646175AF}.Release|Win32.ActiveCfg = Release|Win32
{D356871D-58E1-450B-967A-E5E9646175AF}.Release|Win32.Build.0 = Release|Win32
{D356871D-58E1-450B-967A-E6E9646175AF}.Debug|Win32.ActiveCfg = Debug|Win32
{D356871D-58E1-450B-967A-E6E9646175AF}.Debug|Win32.Build.0 = Debug|Win32
{D356871D-58E1-450B-967A-E6E9646175AF}.Release|Win32.ActiveCfg = Release|Win32
{D356871D-58E1-450B-967A-E6E9646175AF}.Release|Win32.Build.0 = Release|Win32
{D356871D-58E1-450B-967A-E7E9646175AF}.Debug|Win32.ActiveCfg = Debug|Win32
{D356871D-58E1-450B-967A-E7E9646175AF}.Debug|Win32.Build.0 = Debug|Win32
{D356871D-58E1-450B-967A-E7E9646175AF}.Release|Win32.ActiveCfg = Release|Win32
{D356871D-58E1-450B-967A-E7E9646175AF}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Some files were not shown because too many files have changed in this diff Show More