diff --git a/.gitignore b/.gitignore index 4c391abc37..aaf03f305d 100644 --- a/.gitignore +++ b/.gitignore @@ -157,3 +157,8 @@ Thumbs.db /mapserv.bat /runserver.bat /serv.bat + +# dlls +/libmysql.dll +/pcre8.dll +/zlib.dll diff --git a/3rdparty/mysql/include/big_endian.h b/3rdparty/mysql/include/big_endian.h new file mode 100644 index 0000000000..59aa70b9d6 --- /dev/null +++ b/3rdparty/mysql/include/big_endian.h @@ -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 + +/* + 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)); +} diff --git a/3rdparty/mysql/include/binary_log_types.h b/3rdparty/mysql/include/binary_log_types.h new file mode 100644 index 0000000000..b20eacf61b --- /dev/null +++ b/3rdparty/mysql/include/binary_log_types.h @@ -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 */ diff --git a/3rdparty/mysql/include/byte_order_generic.h b/3rdparty/mysql/include/byte_order_generic.h new file mode 100644 index 0000000000..da84585c2a --- /dev/null +++ b/3rdparty/mysql/include/byte_order_generic.h @@ -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); +} diff --git a/3rdparty/mysql/include/byte_order_generic_x86.h b/3rdparty/mysql/include/byte_order_generic_x86.h new file mode 100644 index 0000000000..b3762b504c --- /dev/null +++ b/3rdparty/mysql/include/byte_order_generic_x86.h @@ -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; +} diff --git a/3rdparty/mysql/include/config-win.h b/3rdparty/mysql/include/config-win.h deleted file mode 100644 index b2e1c9831d..0000000000 --- a/3rdparty/mysql/include/config-win.h +++ /dev/null @@ -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 -#include -#include /* Because of rint() */ -#include -#include -#include - -#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 -#define my_const_cast(A) const_cast - - -/* MYSQL OPTIONS */ - -#ifdef _CUSTOMCONFIG_ -#include -#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 - diff --git a/3rdparty/mysql/include/decimal.h b/3rdparty/mysql/include/decimal.h new file mode 100644 index 0000000000..f963b6fd10 --- /dev/null +++ b/3rdparty/mysql/include/decimal.h @@ -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 diff --git a/3rdparty/mysql/include/errmsg.h b/3rdparty/mysql/include/errmsg.h new file mode 100644 index 0000000000..9c5327a98d --- /dev/null +++ b/3rdparty/mysql/include/errmsg.h @@ -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 */ diff --git a/3rdparty/mysql/include/keycache.h b/3rdparty/mysql/include/keycache.h new file mode 100644 index 0000000000..6119f2cbe9 --- /dev/null +++ b/3rdparty/mysql/include/keycache.h @@ -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 */ diff --git a/3rdparty/mysql/include/little_endian.h b/3rdparty/mysql/include/little_endian.h new file mode 100644 index 0000000000..fac4af084e --- /dev/null +++ b/3rdparty/mysql/include/little_endian.h @@ -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 + +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 */ diff --git a/3rdparty/mysql/include/m_ctype.h b/3rdparty/mysql/include/m_ctype.h index 7d058d89d7..dd6ee754e3 100644 --- a/3rdparty/mysql/include/m_ctype.h +++ b/3rdparty/mysql/include/m_ctype.h @@ -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 diff --git a/3rdparty/mysql/include/m_string.h b/3rdparty/mysql/include/m_string.h new file mode 100644 index 0000000000..d836bbc6a8 --- /dev/null +++ b/3rdparty/mysql/include/m_string.h @@ -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 + +#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 +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 diff --git a/3rdparty/mysql/include/my_alloc.h b/3rdparty/mysql/include/my_alloc.h index 1641b3acf3..b72a176923 100644 --- a/3rdparty/mysql/include/my_alloc.h +++ b/3rdparty/mysql/include/my_alloc.h @@ -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 diff --git a/3rdparty/mysql/include/my_byteorder.h b/3rdparty/mysql/include/my_byteorder.h new file mode 100644 index 0000000000..daedd6247e --- /dev/null +++ b/3rdparty/mysql/include/my_byteorder.h @@ -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(static_cast(pT))); +} + +static inline uint16 uint2korr(const char *pT) +{ + return uint2korr(static_cast(static_cast(pT))); +} + +static inline uint32 uint3korr(const char *pT) +{ + return uint3korr(static_cast(static_cast(pT))); +} + +static inline int32 sint3korr(const char *pT) +{ + return sint3korr(static_cast(static_cast(pT))); +} + +static inline uint32 uint4korr(const char *pT) +{ + return uint4korr(static_cast(static_cast(pT))); +} + +static inline int32 sint4korr(const char *pT) +{ + return sint4korr(static_cast(static_cast(pT))); +} + +static inline ulonglong uint6korr(const char *pT) +{ + return uint6korr(static_cast(static_cast(pT))); +} + +static inline ulonglong uint8korr(const char *pT) +{ + return uint8korr(static_cast(static_cast(pT))); +} + +static inline longlong sint8korr(const char *pT) +{ + return sint8korr(static_cast(static_cast(pT))); +} + + +static inline void int2store(char *pT, uint16 A) +{ + int2store(static_cast(static_cast(pT)), A); +} + +static inline void int3store(char *pT, uint A) +{ + int3store(static_cast(static_cast(pT)), A); +} + +static inline void int4store(char *pT, uint32 A) +{ + int4store(static_cast(static_cast(pT)), A); +} + +static inline void int5store(char *pT, ulonglong A) +{ + int5store(static_cast(static_cast(pT)), A); +} + +static inline void int6store(char *pT, ulonglong A) +{ + int6store(static_cast(static_cast(pT)), A); +} + +static inline void int8store(char *pT, ulonglong A) +{ + int8store(static_cast(static_cast(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(static_cast(V)), M); +} + +static inline void float8get(double *V, const char *M) +{ + float8get(V, static_cast(static_cast(M))); +} + +static inline void float8store(char *V, double M) +{ + float8store(static_cast(static_cast(V)), M); +} + +#endif /* __cplusplus */ + +#endif /* MY_BYTEORDER_INCLUDED */ diff --git a/3rdparty/mysql/include/my_command.h b/3rdparty/mysql/include/my_command.h new file mode 100644 index 0000000000..56adcffd74 --- /dev/null +++ b/3rdparty/mysql/include/my_command.h @@ -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 */ diff --git a/3rdparty/mysql/include/my_compiler.h b/3rdparty/mysql/include/my_compiler.h new file mode 100644 index 0000000000..2092537185 --- /dev/null +++ b/3rdparty/mysql/include/my_compiler.h @@ -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 /* 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 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 +struct my_aligned_storage +{ + union + { + char data[size]; + my_alignment_imp 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 */ diff --git a/3rdparty/mysql/include/my_config.h b/3rdparty/mysql/include/my_config.h new file mode 100644 index 0000000000..f6676818f7 --- /dev/null +++ b/3rdparty/mysql/include/my_config.h @@ -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 diff --git a/3rdparty/mysql/include/my_dbug.h b/3rdparty/mysql/include/my_dbug.h index b76a3fcc8c..2af2e66d57 100644 --- a/3rdparty/mysql/include/my_dbug.h +++ b/3rdparty/mysql/include/my_dbug.h @@ -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 +#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 + +/* + 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 */ diff --git a/3rdparty/mysql/include/my_dir.h b/3rdparty/mysql/include/my_dir.h new file mode 100644 index 0000000000..0b512cdca9 --- /dev/null +++ b/3rdparty/mysql/include/my_dir.h @@ -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 + +#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 */ + diff --git a/3rdparty/mysql/include/my_getopt.h b/3rdparty/mysql/include/my_getopt.h new file mode 100644 index 0000000000..7908297a00 --- /dev/null +++ b/3rdparty/mysql/include/my_getopt.h @@ -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 0255 no short option + is created, but a long option still + can be identified uniquely in the + my_get_one_option() callback. + If an opton needs neither special + treatment in the my_get_one_option() + nor one-letter short equivalent + use id=0. + 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 */ + diff --git a/3rdparty/mysql/include/my_global.h b/3rdparty/mysql/include/my_global.h index 2417477e2f..09eae6168f 100644 --- a/3rdparty/mysql/include/my_global.h +++ b/3rdparty/mysql/include/my_global.h @@ -1,9 +1,9 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* + Copyright (c) 2001, 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,54 +12,79 @@ You 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 is the include file that should be included 'first' in every C file. */ +#ifndef MY_GLOBAL_INCLUDED +#define MY_GLOBAL_INCLUDED -#ifndef _global_h -#define _global_h +/* + This include file should be included first in every header file. -#ifndef EMBEDDED_LIBRARY -#define HAVE_REPLICATION -#define HAVE_EXTERNAL_CLIENT + This makes sure my_config.h is included to get platform specific + symbols defined and it makes sure a lot of platform/compiler + differences are mitigated. +*/ + +#include "my_config.h" + +#define __STDC_LIMIT_MACROS /* Enable C99 limit macros */ +#define __STDC_FORMAT_MACROS /* Enable C99 printf format macros */ +#define _USE_MATH_DEFINES /* Get access to M_PI, M_E, etc. in math.h */ + +#ifdef _WIN32 +/* Include common headers.*/ +# include +# include /* SOCKET */ +# include /* access(), chmod() */ #endif -#if defined( __EMX__) && !defined( MYSQL_SERVER) -/* moved here to use below VOID macro redefinition */ -#define INCL_BASE -#define INCL_NOPMAPI -#include -#endif /* __EMX__ */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* Recommended by debian */ +#include -#ifdef __CYGWIN__ -/* We use a Unix API, so pretend it's not Windows */ -#undef WIN -#undef WIN32 -#undef _WIN -#undef _WIN32 -#undef _WIN64 -#undef __WIN__ -#undef __WIN32__ -#define HAVE_ERRNO_AS_DEFINE -#endif /* __CYGWIN__ */ - -#if defined(__QNXNTO__) && !defined(FD_SETSIZE) -#define FD_SETSIZE 1024 /* Max number of file descriptor bits in - fd_set, used when calling 'select' - Must be defined before including - "sys/select.h" and "sys/time.h" - */ +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#if !defined(_WIN32) +#include +#endif +#ifdef MY_MSCRT_DEBUG +#include #endif +/* + A lot of our programs uses asserts, so better to always include it + This also fixes a problem when people uses DBUG_ASSERT without including + assert.h +*/ +#include -/* to make command line shorter we'll define USE_PRAGMA_INTERFACE here */ -#ifdef USE_PRAGMA_IMPLEMENTATION -#define USE_PRAGMA_INTERFACE +/* Include standard definitions of operator new and delete. */ +#ifdef __cplusplus +# include #endif -#if defined(i386) && !defined(__i386__) -#define __i386__ -#endif +#include "my_compiler.h" + + +/* + InnoDB depends on some MySQL internals which other plugins should not + need. This is because of InnoDB's foreign key support, "safe" binlog + truncation, and other similar legacy features. + + We define accessors for these internals unconditionally, but do not + expose them in mysql/plugin.h. They are declared in ha_innodb.h for + InnoDB's use. +*/ +#define INNODB_COMPATIBILITY_HOOKS /* Macros to make switching between C and C++ mode easier */ #ifdef __cplusplus @@ -70,381 +95,95 @@ #define C_MODE_END #endif -#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32) -#include -#elif defined(OS2) -#include -#elif defined(__NETWARE__) -#include -#include -#if defined(__cplusplus) && defined(inline) -#undef inline /* fix configure problem */ -#endif +#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE +#define HAVE_PSI_INTERFACE +#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */ + +/* Make it easier to add conditional code in _expressions_ */ +#ifdef _WIN32 +#define IF_WIN(A,B) A #else -#include -#if defined(__cplusplus) && defined(inline) -#undef inline /* fix configure problem */ -#endif -#endif /* _WIN32... */ - -/* Some defines to avoid ifdefs in the code */ -#ifndef NETWARE_YIELD -#define NETWARE_YIELD -#define NETWARE_SET_SCREEN_MODE(A) +#define IF_WIN(A,B) B #endif -#include "../common/strlib.h" +#if defined (_WIN32) +/* + off_t is 32 bit long. We do not use C runtime functions + with off_t but native Win32 file IO APIs, that work with + 64 bit offsets. +*/ +#undef SIZEOF_OFF_T +#define SIZEOF_OFF_T 8 + +static inline void sleep(unsigned long seconds) +{ + Sleep(seconds * 1000); +} + +/* Define missing access() modes. */ +#define F_OK 0 +#define W_OK 2 +#define R_OK 4 /* Test for read permission. */ + +/* Define missing file locking constants. */ +#define F_RDLCK 1 +#define F_WRLCK 2 +#define F_UNLCK 3 +#define F_TO_EOF 0x3FFFFFFF + +#define O_NONBLOCK 1 /* For emulation of fcntl() */ /* - 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 + SHUT_RDWR is called SD_BOTH in windows and + is defined to 2 in winsock2.h + #define SD_BOTH 0x02 */ +#define SHUT_RDWR 0x02 -#if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) -#define __builtin_expect(x, expected_value) (x) -#endif +/* Shared memory and named pipe connections are supported. */ +#define shared_memory_buffer_length 16000 +#define default_shared_memory_base_name "MYSQL" +#endif /* _WIN32*/ -#define likely(x) __builtin_expect((x),1) -#define unlikely(x) __builtin_expect((x),0) +/** + Cast a member of a structure to the structure that contains it. - -/* Fix problem with S_ISLNK() on Linux */ -#if defined(TARGET_OS_LINUX) -#undef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -/* - Temporary solution to solve bug#7156. Include "sys/types.h" before - the thread headers, else the function madvise() will not be defined + @param ptr Pointer to the member. + @param type Type of the structure that contains the member. + @param member Name of the member within the structure. */ -#if defined(HAVE_SYS_TYPES_H) && ( defined(sun) || defined(__sun) ) -#include -#endif +#define my_container_of(ptr, type, member) \ + ((type *)((char *)ptr - offsetof(type, member))) -/* The client defines this to avoid all thread code */ -#if defined(UNDEF_THREADS_HACK) -#undef THREAD -#undef HAVE_mit_thread -#undef HAVE_LINUXTHREADS -#undef HAVE_NPTL -#undef HAVE_UNIXWARE7_THREADS -#endif - -#ifdef HAVE_THREADS_WITHOUT_SOCKETS -/* MIT pthreads does not work with unix sockets */ -#undef HAVE_SYS_UN_H -#endif - -#define __EXTENSIONS__ 1 /* We want some extension */ -#ifndef __STDC_EXT__ -#define __STDC_EXT__ 1 /* To get large file support on hpux */ -#endif - -/* - Solaris 9 include file refers to X/Open document - - System Interfaces and Headers, Issue 5 - - saying we should define _XOPEN_SOURCE=500 to get POSIX.1c prototypes, - but apparently other systems (namely FreeBSD) don't agree. - - On a newer Solaris 10, the above file recognizes also _XOPEN_SOURCE=600. - Furthermore, it tests that if a program requires older standard - (_XOPEN_SOURCE<600 or _POSIX_C_SOURCE<200112L) it cannot be - run on a new compiler (that defines _STDC_C99) and issues an #error. - It's also an #error if a program requires new standard (_XOPEN_SOURCE=600 - or _POSIX_C_SOURCE=200112L) and a compiler does not define _STDC_C99. - - To add more to this mess, Sun Studio C compiler defines _STDC_C99 while - C++ compiler does not! - - So, in a desperate attempt to get correct prototypes for both - C and C++ code, we define either _XOPEN_SOURCE=600 or _XOPEN_SOURCE=500 - depending on the compiler's announced C standard support. - - Cleaner solutions are welcome. -*/ -#ifdef __sun -#if __STDC_VERSION__ - 0 >= 199901L -#define _XOPEN_SOURCE 600 -#else -#define _XOPEN_SOURCE 500 -#endif -#endif - -#if defined(THREAD) && !defined(__WIN__) && !defined(OS2) -#ifndef _POSIX_PTHREAD_SEMANTICS -#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ -#endif - -#if !defined(SCO) -#define _REENTRANT 1 /* Some thread libraries require this */ -#endif -#if !defined(_THREAD_SAFE) && !defined(_AIX) -#define _THREAD_SAFE /* Required for OSF1 */ -#endif -#ifndef HAVE_mit_thread -#ifdef HAVE_UNIXWARE7_THREADS -#include -#else -#if defined(HPUX10) || defined(HPUX11) -C_MODE_START /* HPUX needs this, signal.h bug */ -#include -C_MODE_END -#else -#include /* AIX must have this included first */ -#endif -#endif /* HAVE_UNIXWARE7_THREADS */ -#endif /* HAVE_mit_thread */ -#if !defined(SCO) && !defined(_REENTRANT) -#define _REENTRANT 1 /* Threads requires reentrant code */ -#endif -#endif /* THREAD */ - -/* Go around some bugs in different OS and compilers */ -#ifdef _AIX /* By soren@t.dk */ -#define _H_STRINGS -#define _SYS_STREAM_H -/* #define _AIX32_CURSES */ /* XXX: this breaks AIX 4.3.3 (others?). */ -#define ulonglong2double(A) my_ulonglong2double(A) -#define my_off_t2double(A) my_ulonglong2double(A) -C_MODE_START -double my_ulonglong2double(unsigned long long A); -C_MODE_END -#endif /* _AIX */ - -#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */ -#undef HAVE_SNPRINTF -#endif -#ifdef HAVE_BROKEN_PREAD -/* - pread()/pwrite() are not 64 bit safe on HP-UX 11.0 without - installing the kernel patch PHKL_20349 or greater -*/ -#undef HAVE_PREAD -#undef HAVE_PWRITE -#endif -#if defined(HAVE_BROKEN_INLINE) && !defined(__cplusplus) -#undef inline -#define inline -#endif - -#ifdef UNDEF_HAVE_GETHOSTBYNAME_R /* For OSF4.x */ -#undef HAVE_GETHOSTBYNAME_R -#endif -#ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */ -#undef HAVE_INITGROUPS -#endif - -/* gcc/egcs issues */ - -#if defined(__GNUC) && defined(__EXCEPTIONS) -#error "Please add -fno-exceptions to CXXFLAGS and reconfigure/recompile" -#endif - - -/* Fix a bug in gcc 2.8.0 on IRIX 6.2 */ -#if SIZEOF_LONG == 4 && defined(__LONG_MAX__) && (__GNUC__ == 2 && __GNUC_MINOR__ == 8) -#undef __LONG_MAX__ /* Is a longlong value in gcc 2.8.0 ??? */ -#define __LONG_MAX__ 2147483647 -#endif - -/* egcs 1.1.2 has a problem with memcpy on Alpha */ -#if defined(__GNUC__) && defined(__alpha__) && ! (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) -#define BAD_MEMCPY -#endif - -#if defined(_lint) && !defined(lint) -#define lint -#endif -#if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG) -#define _LONG_LONG 1 /* For AIX string library */ -#endif - -#ifndef stdin -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STDDEF_H -#include -#endif - -#include -#ifdef HAVE_LIMITS_H -#include -#endif -#ifdef HAVE_FLOAT_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_SYS_TIMEB_H -#include /* Avoid warnings on SCO */ -#endif -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif /* TIME_WITH_SYS_TIME */ -#ifdef HAVE_UNISTD_H -#include -#endif -#if defined(__cplusplus) && defined(NO_CPLUSPLUS_ALLOCA) -#undef HAVE_ALLOCA -#undef HAVE_ALLOCA_H -#endif -#ifdef HAVE_ALLOCA_H -#include -#endif -#ifdef HAVE_ATOMIC_ADD -#define new my_arg_new -#define need_to_restore_new 1 -C_MODE_START -#include -C_MODE_END -#ifdef need_to_restore_new /* probably safer than #ifdef new */ -#undef new -#undef need_to_restore_new -#endif -#endif -#include /* Recommended by debian */ -/* We need the following to go around a problem with openssl on solaris */ -#if defined(HAVE_CRYPT_H) -#include -#endif - -/* - A lot of our programs uses asserts, so better to always include it - This also fixes a problem when people uses DBUG_ASSERT without including - assert.h -*/ -#include - -/* Go around some bugs in different OS and compilers */ -#if defined(_HPUX_SOURCE) && defined(HAVE_SYS_STREAM_H) -#include /* HPUX 10.20 defines ulong here. UGLY !!! */ -#define HAVE_ULONG -#endif -#ifdef DONT_USE_FINITE /* HPUX 11.x has is_finite() */ -#undef HAVE_FINITE -#endif -#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) && defined(THREAD) -/* Fix bug in setrlimit */ -#undef setrlimit -#define setrlimit cma_setrlimit64 -#endif -/* Declare madvise where it is not declared for C++, like Solaris */ -#if HAVE_MADVISE && !HAVE_DECL_MADVISE && defined(__cplusplus) -extern "C" int madvise(void *addr, size_t len, int behav); -#endif - -#ifdef __QNXNTO__ -/* This has to be after include limits.h */ -#define HAVE_ERRNO_AS_DEFINE -#define HAVE_FCNTL_LOCK -#undef HAVE_FINITE -#undef LONGLONG_MIN /* These get wrongly defined in QNX 6.2 */ -#undef LONGLONG_MAX /* standard system library 'limits.h' */ -#ifdef __cplusplus -#ifndef HAVE_RINT -#define HAVE_RINT -#endif /* rint() and isnan() functions are not */ -#define rint(a) std::rint(a) /* visible in C++ scope due to an error */ -#define isnan(a) std::isnan(a) /* in the usr/include/math.h on QNX */ -#endif -#endif - -/* We can not live without the following defines */ - -#define USE_MYFUNC 1 /* Must use syscall indirection */ -#define MASTER 1 /* Compile without unireg */ -#define ENGLISH 1 /* Messages in English */ -#define POSIX_MISTAKE 1 /* regexp: Fix stupid spec error */ -#define USE_REGEX 1 /* We want the use the regex library */ -/* Do not define for ultra sparcs */ -#ifndef OS2 -#define USE_BMOVE512 1 /* Use this unless system bmove is faster */ -#endif +/* an assert that works at compile-time. only for constant expression */ +#define compile_time_assert(X) \ + do \ + { \ + typedef char compile_time_assert[(X) ? 1 : -1] MY_ATTRIBUTE((unused)); \ + } while(0) #define QUOTE_ARG(x) #x /* Quote argument (before cpp) */ #define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */ -/* Paranoid settings. Define I_AM_PARANOID if you are paranoid */ -#ifdef I_AM_PARANOID -#define DONT_ALLOW_USER_CHANGE 1 -#define DONT_USE_MYSQL_PWD 1 -#endif - -/* Does the system remember a signal handler after a signal ? */ -#ifndef HAVE_BSD_SIGNALS -#define DONT_REMEMBER_SIGNAL -#endif - -/* Define void to stop lint from generating "null effekt" comments */ -#ifndef DONT_DEFINE_VOID -#ifdef _lint -int __void__; -#define VOID(X) (__void__ = (int) (X)) +#ifdef _WIN32 +#define SO_EXT ".dll" +#elif defined(__APPLE__) +#define SO_EXT ".dylib" #else -#undef VOID -#define VOID(X) (X) -#endif -#endif /* DONT_DEFINE_VOID */ - -#if defined(_lint) || defined(FORCE_INIT_OF_VARS) -#define LINT_INIT(var) var=0 /* No uninitialize-warning */ -#else -#define LINT_INIT(var) +#define SO_EXT ".so" #endif -#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_purify) -#define PURIFY_OR_LINT_INIT(var) var=0 -#else -#define PURIFY_OR_LINT_INIT(var) -#endif - -/* Define some useful general macros */ -#if !defined(max) -#define max(a, b) ((a) > (b) ? (a) : (b)) -#define min(a, b) ((a) < (b) ? (a) : (b)) -#endif - -#if defined(__EMX__) || !defined(HAVE_UINT) -#undef HAVE_UINT -#define HAVE_UINT +#if !defined(HAVE_UINT) typedef unsigned int uint; typedef unsigned short ushort; #endif -#define CMP_NUM(a,b) (((a) < (b)) ? -1 : ((a) == (b)) ? 0 : 1) -#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0) -#define swap_variables(t, a, b) { register t dummy; dummy= a; a= b; b= dummy; } -#define test(a) ((a) ? 1 : 0) +#define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; } +#define MY_TEST(a) ((a) ? 1 : 0) #define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0) #define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0) #define test_all_bits(a,b) (((a) & (b)) == (b)) -#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1)) #define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0]))) -#ifndef HAVE_RINT -#define rint(A) floor((A)+(((A) < 0)? -0.5 : 0.5)) -#endif /* Define some general constants */ #ifndef TRUE @@ -452,102 +191,38 @@ typedef unsigned short ushort; #define FALSE (0) /* Logical false */ #endif -#if defined(__GNUC__) -#define function_volatile volatile -#define my_reinterpret_cast(A) reinterpret_cast -#define my_const_cast(A) const_cast -#elif !defined(my_reinterpret_cast) -#define my_reinterpret_cast(A) (A) -#define my_const_cast(A) (A) -#endif -#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8) -#define __attribute__(A) -#endif - -/* - Wen using the embedded library, users might run into link problems, - dupicate declaration of __cxa_pure_virtual, solved by declaring it a - weak symbol. -*/ -#ifdef USE_MYSYS_NEW -C_MODE_START -int __cxa_pure_virtual () __attribute__ ((weak)); -C_MODE_END -#endif - -/* From old s-system.h */ - -/* - Support macros for non ansi & other old compilers. Since such - things are no longer supported we do nothing. We keep then since - some of our code may still be needed to upgrade old customers. -*/ -#define _VARARGS(X) X -#define _STATIC_VARARGS(X) X -#define _PC(X) X - -#if defined(DBUG_ON) && defined(DBUG_OFF) -#undef DBUG_OFF -#endif - -#if defined(_lint) && !defined(DBUG_OFF) -#define DBUG_OFF -#endif - -#include - -#define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/ -#define ASCII_BITS_USED 8 /* Bit char used */ -#define NEAR_F /* No near function handling */ - /* Some types that is different between systems */ typedef int File; /* File descriptor */ -#ifndef Socket_defined +#ifdef _WIN32 +typedef SOCKET my_socket; +#else typedef int my_socket; /* File descriptor for sockets */ #define INVALID_SOCKET -1 #endif -/* Type for fuctions that handles signals */ -#define sig_handler RETSIGTYPE C_MODE_START typedef void (*sig_return)();/* Returns type from signal */ C_MODE_END -#if defined(__GNUC__) && !defined(_lint) +#if defined(__GNUC__) typedef char pchar; /* Mixed prototypes can take char */ -typedef char puchar; /* Mixed prototypes can take char */ typedef char pbool; /* Mixed prototypes can take char */ -typedef short pshort; /* Mixed prototypes can take short int */ -typedef float pfloat; /* Mixed prototypes can take float */ #else typedef int pchar; /* Mixed prototypes can't take char */ -typedef uint puchar; /* Mixed prototypes can't take char */ typedef int pbool; /* Mixed prototypes can't take char */ -typedef int pshort; /* Mixed prototypes can't take short int */ -typedef double pfloat; /* Mixed prototypes can't take float */ #endif C_MODE_START typedef int (*qsort_cmp)(const void *,const void *); -typedef int (*qsort_cmp2)(void*, const void *,const void *); +typedef int (*qsort_cmp2)(const void*, const void *,const void *); C_MODE_END -#ifdef HAVE_mit_thread -#define qsort_t void -#undef QSORT_TYPE_IS_VOID -#define QSORT_TYPE_IS_VOID +#ifdef _WIN32 +typedef int socket_len_t; +typedef int sigset_t; +typedef int mode_t; +typedef SSIZE_T ssize_t; #else -#define qsort_t RETQSORTTYPE /* Broken GCC cant handle typedef !!!! */ -#endif -#ifdef HAVE_mit_thread -#define size_socket socklen_t /* Type of last arg to accept */ -#else -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -typedef SOCKET_SIZE_TYPE size_socket; -#endif - -#ifndef SOCKOPT_OPTLEN_TYPE -#define SOCKOPT_OPTLEN_TYPE size_socket +typedef socklen_t socket_len_t; #endif +typedef socket_len_t SOCKET_SIZE_TYPE; /* Used by NDB */ /* file create flags */ @@ -576,50 +251,78 @@ typedef SOCKET_SIZE_TYPE size_socket; #endif /* additional file share flags for win32 */ -#ifdef __WIN__ +#ifdef _WIN32 #define _SH_DENYRWD 0x110 /* deny read/write mode & delete */ #define _SH_DENYWRD 0x120 /* deny write mode & delete */ #define _SH_DENYRDD 0x130 /* deny read mode & delete */ #define _SH_DENYDEL 0x140 /* deny delete only */ -#endif /* __WIN__ */ +#endif /* _WIN32 */ -/* #define USE_RECORD_LOCK */ - - /* Unsigned types supported by the compiler */ -#define UNSINT8 /* unsigned int8 (char) */ -#define UNSINT16 /* unsigned int16 */ -#define UNSINT32 /* unsigned int32 */ - - /* General constants */ -#define SC_MAXWIDTH 256 /* Max width of screen (for error messages) */ +/* General constants */ #define FN_LEN 256 /* Max file name len */ #define FN_HEADLEN 253 /* Max length of filepart of file name */ #define FN_EXTLEN 20 /* Max length of extension (part of FN_LEN) */ #define FN_REFLEN 512 /* Max length of full path-name */ +#define FN_REFLEN_SE 4000 /* Max length of full path-name in SE */ #define FN_EXTCHAR '.' #define FN_HOMELIB '~' /* ~/ is used as abbrev for home dir */ #define FN_CURLIB '.' /* ./ is used as abbrev for current dir */ #define FN_PARENTDIR ".." /* Parent directory; Must be a string */ -#define FN_DEVCHAR ':' -#ifndef FN_LIBCHAR -#ifdef __EMX__ +#ifdef _WIN32 #define FN_LIBCHAR '\\' +#define FN_LIBCHAR2 '/' +#define FN_DIRSEP "/\\" /* Valid directory separators */ +#define FN_EXEEXT ".exe" +#define FN_SOEXT ".dll" #define FN_ROOTDIR "\\" +#define FN_DEVCHAR ':' +#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */ #else #define FN_LIBCHAR '/' +#define FN_LIBCHAR2 '/' +#define FN_DIRSEP "/" /* Valid directory separators */ +#define FN_EXEEXT "" +#define FN_SOEXT ".so" #define FN_ROOTDIR "/" #endif -#endif -#define MY_NFILE 64 /* This is only used to save filenames */ -#ifndef OS_FILE_LIMIT -#define OS_FILE_LIMIT 65535 + +/* + MY_FILE_MIN is Windows speciality and is used to quickly detect + the mismatch of CRT and mysys file IO usage on Windows at runtime. + CRT file descriptors can be in the range 0-2047, whereas descriptors returned + by my_open() will start with 2048. If a file descriptor with value less then + MY_FILE_MIN is passed to mysys IO function, chances are it stemms from + open()/fileno() and not my_open()/my_fileno. + + For Posix, mysys functions are light wrappers around libc, and MY_FILE_MIN + is logically 0. +*/ + +#ifdef _WIN32 +#define MY_FILE_MIN 2048 +#else +#define MY_FILE_MIN 0 #endif -/* #define EXT_IN_LIBNAME */ -/* #define FN_NO_CASE_SENCE */ -/* #define FN_UPPER_CASE TRUE */ +/* + MY_NFILE is the default size of my_file_info array. + + It is larger on Windows, because it all file handles are stored in my_file_info + Default size is 16384 and this should be enough for most cases.If it is not + enough, --max-open-files with larger value can be used. + + For Posix , my_file_info array is only used to store filenames for + error reporting and its size is not a limitation for number of open files. +*/ +#ifdef _WIN32 +#define MY_NFILE (16384 + MY_FILE_MIN) +#else +#define MY_NFILE 64 +#endif + +#define OS_FILE_LIMIT UINT_MAX /* Io buffer size; Must be a power of 2 and a multiple of 512. May be @@ -631,91 +334,53 @@ typedef SOCKET_SIZE_TYPE size_socket; How much overhead does malloc have. The code often allocates something like 1024-MALLOC_OVERHEAD bytes */ -#ifdef SAFEMALLOC -#define MALLOC_OVERHEAD (8+24+4) -#else #define MALLOC_OVERHEAD 8 -#endif + /* get memory in huncs */ #define ONCE_ALLOC_INIT (uint) (4096-MALLOC_OVERHEAD) /* Typical record cash */ #define RECORD_CACHE_SIZE (uint) (64*1024-MALLOC_OVERHEAD) /* Typical key cash */ -#define KEY_CACHE_SIZE (uint) (8*1024*1024-MALLOC_OVERHEAD) +#define KEY_CACHE_SIZE (uint) (8*1024*1024) /* Default size of a key cache block */ #define KEY_CACHE_BLOCK_SIZE (uint) 1024 - /* Some things that this system doesn't have */ - -#define NO_HASH /* Not needed anymore */ -#ifdef __WIN__ -#define NO_DIR_LIBRARY /* Not standar dir-library */ -#define USE_MY_STAT_STRUCT /* For my_lib */ -#endif - /* Some defines of functions for portability */ -#undef remove /* Crashes MySQL on SCO 5.0.0 */ -#ifndef __WIN__ -#ifdef OS2 -#define closesocket(A) soclose(A) -#else -#define closesocket(A) close(A) -#endif +#if (_WIN32) +#if !defined(_WIN64) +inline double my_ulonglong2double(unsigned long long value) +{ + long long nr=(long long) value; + if (nr >= 0) + return (double) nr; + return (18446744073709551616.0 + (double) nr); +} +#define ulonglong2double my_ulonglong2double +#define my_off_t2double my_ulonglong2double +#endif /* _WIN64 */ +inline unsigned long long my_double2ulonglong(double d) +{ + double t= d - (double) 0x8000000000000000ULL; + + if (t >= 0) + return ((unsigned long long) t) + 0x8000000000000000ULL; + return (unsigned long long) d; +} +#define double2ulonglong my_double2ulonglong +#endif /* _WIN32 */ + #ifndef ulonglong2double #define ulonglong2double(A) ((double) (ulonglong) (A)) #define my_off_t2double(A) ((double) (my_off_t) (A)) #endif +#ifndef double2ulonglong +#define double2ulonglong(A) ((ulonglong) (double) (A)) #endif -#ifndef offsetof -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif -#define ulong_to_double(X) ((double) (ulong) (X)) -#define SET_STACK_SIZE(X) /* Not needed on real machines */ - -#if !defined(HAVE_mit_thread) && !defined(HAVE_STRTOK_R) -#define strtok_r(A,B,C) strtok((A),(B)) -#endif - -/* Remove some things that mit_thread break or doesn't support */ -#if defined(HAVE_mit_thread) && defined(THREAD) -#undef HAVE_PREAD -#undef HAVE_REALPATH -#undef HAVE_MLOCK -#undef HAVE_TEMPNAM /* Use ours */ -#undef HAVE_PTHREAD_SETPRIO -#undef HAVE_FTRUNCATE -#undef HAVE_READLINK -#endif - -/* This is from the old m-machine.h file */ - -#if SIZEOF_LONG_LONG > 4 -#define HAVE_LONG_LONG 1 -#endif - -/* - Some pre-ANSI-C99 systems like AIX 5.1 and Linux/GCC 2.95 define - ULONGLONG_MAX, LONGLONG_MIN, LONGLONG_MAX; we use them if they're defined. - Also on Windows we define these constants by hand in config-win.h. -*/ - -#if defined(HAVE_LONG_LONG) && !defined(LONGLONG_MIN) -#define LONGLONG_MIN ((long long) 0x8000000000000000LL) -#define LONGLONG_MAX ((long long) 0x7FFFFFFFFFFFFFFFLL) -#endif - -#if defined(HAVE_LONG_LONG) && !defined(ULONGLONG_MAX) -/* First check for ANSI C99 definition: */ -#ifdef ULLONG_MAX -#define ULONGLONG_MAX ULLONG_MAX -#else -#define ULONGLONG_MAX ((unsigned long long)(~0ULL)) -#endif -#endif /* defined (HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)*/ - +#define INT_MIN64 (~0x7FFFFFFFFFFFFFFFLL) +#define INT_MAX64 0x7FFFFFFFFFFFFFFFLL #define INT_MIN32 (~0x7FFFFFFFL) #define INT_MAX32 0x7FFFFFFFL #define UINT_MAX32 0xFFFFFFFFL @@ -729,30 +394,37 @@ typedef SOCKET_SIZE_TYPE size_socket; #define INT_MAX8 0x7F #define UINT_MAX8 0xFF -/* From limits.h instead */ -#ifndef DBL_MIN -#define DBL_MIN 4.94065645841246544e-324 -#define FLT_MIN ((float)1.40129846432481707e-45) -#endif -#ifndef DBL_MAX -#define DBL_MAX 1.79769313486231470e+308 -#define FLT_MAX ((float)3.40282346638528860e+38) +#ifndef SIZE_T_MAX +#define SIZE_T_MAX (~((size_t) 0)) #endif -#if !defined(HAVE_ISINF) && !defined(isinf) -#define isinf(X) 0 +// Our ifdef trickery for my_isfinite does not work with gcc/solaris unless we: +#ifdef HAVE_IEEEFP_H +#include #endif -/* Define missing math constants. */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif -#ifndef M_E -#define M_E 2.7182818284590452354 -#endif -#ifndef M_LN2 -#define M_LN2 0.69314718055994530942 -#endif +#if (__cplusplus >= 201103L) + /* For C++11 use the new std functions rather than C99 macros. */ + #include + #define my_isfinite(X) std::isfinite(X) + #define my_isnan(X) std::isnan(X) + #define my_isinf(X) std::isinf(X) +#else + #ifdef HAVE_LLVM_LIBCPP /* finite is deprecated in libc++ */ + #define my_isfinite(X) isfinite(X) + #elif defined _WIN32 + #define my_isfinite(X) _finite(X) + #else + #define my_isfinite(X) finite(X) + #endif + #define my_isnan(X) isnan(X) + #ifdef HAVE_ISINF + /* System-provided isinf() is available and safe to use */ + #define my_isinf(X) isinf(X) + #else /* !HAVE_ISINF */ + #define my_isinf(X) (!my_isfinite(X) && !my_isnan(X)) + #endif +#endif /* __cplusplus >= 201103L */ /* Max size that must be added to a so that we know Size to make @@ -767,531 +439,134 @@ typedef long long my_ptrdiff_t; #define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1)) #define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double)) /* Size to make adressable obj. */ -#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t))) - /* Offset of field f in structure t */ -#define OFFSET(t, f) ((size_t)(char *)&((t *)0)->f) -#define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size) -#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B)) +#define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size) +#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B)) + +/* + Custom version of standard offsetof() macro which can be used to get + offsets of members in class for non-POD types (according to the current + version of C++ standard offsetof() macro can't be used in such cases and + attempt to do so causes warnings to be emitted, OTOH in many cases it is + still OK to assume that all instances of the class has the same offsets + for the same members). + + This is temporary solution which should be removed once File_parser class + and related routines are refactored. +*/ + +#define my_offsetof(TYPE, MEMBER) \ + ((size_t)((char *)&(((TYPE *)0x10)->MEMBER) - (char*)0x10)) #define NullS (char *) 0 -/* Nowdays we do not support MessyDos */ -#ifndef NEAR -#define NEAR /* Who needs segments ? */ -#define FAR /* On a good machine */ -#ifndef HUGE_PTR -#define HUGE_PTR -#endif -#endif -#if defined(__IBMC__) || defined(__IBMCPP__) -/* This was _System _Export but caused a lot of warnings on _AIX43 */ -#define STDCALL -#elif !defined( STDCALL) + +#ifdef _WIN32 +#define STDCALL __stdcall +#else #define STDCALL #endif /* Typdefs for easyier portability */ -#if defined(VOIDTYPE) -typedef void *gptr; /* Generic pointer */ -#else -typedef char *gptr; /* Generic pointer */ -#endif -#ifndef HAVE_INT_8_16_32 -typedef signed char int8; /* Signed integer >= 8 bits */ -typedef short int16; /* Signed integer >= 16 bits */ -#endif -#ifndef HAVE_UCHAR typedef unsigned char uchar; /* Short for unsigned char */ -#endif -typedef unsigned char uint8; /* Short for unsigned integer >= 8 bits */ -typedef unsigned short uint16; /* Short for unsigned integer >= 16 bits */ - +typedef signed char int8; /* Signed integer >= 8 bits */ +typedef unsigned char uint8; /* Unsigned integer >= 8 bits */ +typedef short int16; +typedef unsigned short uint16; #if SIZEOF_INT == 4 -#ifndef HAVE_INT_8_16_32 -typedef int int32; -#endif -typedef unsigned int uint32; /* Short for unsigned integer >= 32 bits */ +typedef int int32; +typedef unsigned int uint32; #elif SIZEOF_LONG == 4 -#ifndef HAVE_INT_8_16_32 -typedef long int32; -#endif -typedef unsigned long uint32; /* Short for unsigned integer >= 32 bits */ +typedef long int32; +typedef unsigned long uint32; #else -#error "Neither int or long is of 4 bytes width" +#error Neither int or long is of 4 bytes width #endif -#if !defined(HAVE_ULONG) && !defined(TARGET_OS_LINUX) && !defined(__USE_MISC) +#if !defined(HAVE_ULONG) typedef unsigned long ulong; /* Short for unsigned long */ #endif -#ifndef longlong_defined -#if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8 +/* + Using [unsigned] long long is preferable as [u]longlong because we use + [unsigned] long long unconditionally in many places, + for example in constants with [U]LL suffix. +*/ typedef unsigned long long int ulonglong; /* ulong or unsigned long long */ typedef long long int longlong; -#else -typedef unsigned long ulonglong; /* ulong or unsigned long long */ -typedef long longlong; -#endif -#endif +typedef longlong int64; +typedef ulonglong uint64; -#if defined(NO_CLIENT_LONG_LONG) -typedef unsigned long my_ulonglong; -#elif defined (__WIN__) +#if defined (_WIN32) typedef unsigned __int64 my_ulonglong; #else typedef unsigned long long my_ulonglong; #endif -#ifdef USE_RAID -/* - The following is done with a if to not get problems with pre-processors - with late define evaluation -*/ -#if SIZEOF_OFF_T == 4 -#define SYSTEM_SIZEOF_OFF_T 4 +#if SIZEOF_CHARP == SIZEOF_INT +typedef int intptr; +#elif SIZEOF_CHARP == SIZEOF_LONG +typedef long intptr; +#elif SIZEOF_CHARP == SIZEOF_LONG_LONG +typedef long long intptr; #else -#define SYSTEM_SIZEOF_OFF_T 8 +#error sizeof(void *) is neither sizeof(int) nor sizeof(long) nor sizeof(long long) #endif -#undef SIZEOF_OFF_T -#define SIZEOF_OFF_T 8 -#else -#define SYSTEM_SIZEOF_OFF_T SIZEOF_OFF_T -#endif /* USE_RAID */ +#define MY_ERRPTR ((void*)(intptr)1) + +#if defined(_WIN32) +typedef unsigned long long my_off_t; +typedef unsigned long long os_off_t; +#else +typedef off_t os_off_t; #if SIZEOF_OFF_T > 4 typedef ulonglong my_off_t; #else typedef unsigned long my_off_t; #endif +#endif /*_WIN32*/ #define MY_FILEPOS_ERROR (~(my_off_t) 0) -#if !defined(__WIN__) && !defined(OS2) -typedef off_t os_off_t; -#endif -#if defined(__WIN__) +/* + TODO Convert these to use Bitmap class. + */ +typedef ulonglong table_map; /* Used for table bits in join */ +typedef ulonglong nesting_map; /* Used for flags of nesting constructs */ + +#if defined(_WIN32) #define socket_errno WSAGetLastError() #define SOCKET_EINTR WSAEINTR #define SOCKET_EAGAIN WSAEINPROGRESS -#define SOCKET_ETIMEDOUT WSAETIMEDOUT #define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK #define SOCKET_EADDRINUSE WSAEADDRINUSE +#define SOCKET_ETIMEDOUT WSAETIMEDOUT +#define SOCKET_ECONNRESET WSAECONNRESET #define SOCKET_ENFILE ENFILE #define SOCKET_EMFILE EMFILE -#elif defined(OS2) -#define socket_errno sock_errno() -#define SOCKET_EINTR SOCEINTR -#define SOCKET_EAGAIN SOCEINPROGRESS -#define SOCKET_ETIMEDOUT SOCKET_EINTR -#define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK -#define SOCKET_EADDRINUSE SOCEADDRINUSE -#define SOCKET_ENFILE SOCENFILE -#define SOCKET_EMFILE SOCEMFILE -#define closesocket(A) soclose(A) #else /* Unix */ #define socket_errno errno #define closesocket(A) close(A) #define SOCKET_EINTR EINTR #define SOCKET_EAGAIN EAGAIN -#define SOCKET_ETIMEDOUT SOCKET_EINTR #define SOCKET_EWOULDBLOCK EWOULDBLOCK #define SOCKET_EADDRINUSE EADDRINUSE +#define SOCKET_ETIMEDOUT ETIMEDOUT +#define SOCKET_ECONNRESET ECONNRESET #define SOCKET_ENFILE ENFILE #define SOCKET_EMFILE EMFILE #endif -typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */ -typedef short int15; /* Most effective integer 0 <= x <= 32767 */ -typedef char *my_string; /* String of characters */ -typedef unsigned long size_s; /* Size of strings (In string-funcs) */ typedef int myf; /* Type of MyFlags in my_funcs */ -#ifndef byte_defined -typedef char byte; /* Smallest addressable unit */ -#endif typedef char my_bool; /* Small bool */ -#if !defined(bool) && !defined(bool_defined) && (!defined(HAVE_BOOL) || !defined(__cplusplus)) -typedef char bool; /* Ordinary boolean values 0 1 */ -#endif - /* Macros for converting *constants* to the right type */ -#define INT8(v) (int8) (v) -#define INT16(v) (int16) (v) -#define INT32(v) (int32) (v) + +/* Macros for converting *constants* to the right type */ #define MYF(v) (myf) (v) -#ifndef LL -#ifdef HAVE_LONG_LONG -#define LL(A) A ## LL -#else -#define LL(A) A ## L -#endif -#endif +/* Some helper macros */ +#define YESNO(X) ((X) ? "yes" : "no") -#ifndef ULL -#ifdef HAVE_LONG_LONG -#define ULL(A) A ## ULL -#else -#define ULL(A) A ## UL -#endif -#endif - -/* - Defines to make it possible to prioritize register assignments. No - longer that important with modern compilers. -*/ -#ifndef USING_X -#define reg1 register -#define reg2 register -#define reg3 register -#define reg4 register -#define reg5 register -#define reg6 register -#define reg7 register -#define reg8 register -#define reg9 register -#define reg10 register -#define reg11 register -#define reg12 register -#define reg13 register -#define reg14 register -#define reg15 register -#define reg16 register -#endif - -/* - Sometimes we want to make sure that the variable is not put into - a register in debugging mode so we can see its value in the core -*/ - -#ifndef DBUG_OFF -#define dbug_volatile volatile -#else -#define dbug_volatile -#endif - -/* Defines for time function */ -#define SCALE_SEC 100 -#define SCALE_USEC 10000 -#define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */ #define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */ -#ifdef HAVE_TIMESPEC_TS_SEC -#ifndef set_timespec -#define set_timespec(ABSTIME,SEC) \ -{ \ - (ABSTIME).ts_sec=time(0) + (time_t) (SEC); \ - (ABSTIME).ts_nsec=0; \ -} -#endif /* !set_timespec */ -#ifndef set_timespec_nsec -#define set_timespec_nsec(ABSTIME,NSEC) \ -{ \ - ulonglong now= my_getsystime() + (NSEC/100); \ - (ABSTIME).ts_sec= (now / ULL(10000000)); \ - (ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \ -} -#endif /* !set_timespec_nsec */ -#else -#ifndef set_timespec -#define set_timespec(ABSTIME,SEC) \ -{\ - struct timeval tv;\ - gettimeofday(&tv,0);\ - (ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\ - (ABSTIME).tv_nsec=tv.tv_usec*1000;\ -} -#endif /* !set_timespec */ -#ifndef set_timespec_nsec -#define set_timespec_nsec(ABSTIME,NSEC) \ -{\ - ulonglong now= my_getsystime() + (NSEC/100); \ - (ABSTIME).tv_sec= (now / ULL(10000000)); \ - (ABSTIME).tv_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \ -} -#endif /* !set_timespec_nsec */ -#endif /* HAVE_TIMESPEC_TS_SEC */ - -/* - Define-funktions for reading and storing in machine independent format - (low byte first) -*/ - -/* Optimized store functions for Intel x86 */ -#if defined(__i386__) && !defined(_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))) -#ifdef HAVE_purify -#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16)) -#else -/* - 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) -#endif -#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) do { *(T)= (uchar) ((A));\ - *(T+1)=(uchar) (((uint) (A) >> 8));\ - *(T+2)=(uchar) (((A) >> 16)); } while (0) -#define int4store(T,A) *((long *) (T))= (long) (A) -#define int5store(T,A) do { *(T)= (uchar)((A));\ - *((T)+1)=(uchar) (((A) >> 8));\ - *((T)+2)=(uchar) (((A) >> 16));\ - *((T)+3)=(uchar) (((A) >> 24)); \ - *((T)+4)=(uchar) (((A) >> 32)); } while(0) -#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A) - -typedef union { - double v; - long m[2]; -} doubleget_union; -#define doubleget(V,M) \ -do { doubleget_union _tmp; \ - _tmp.m[0] = *((long*)(M)); \ - _tmp.m[1] = *(((long*) (M))+1); \ - (V) = _tmp.v; } while(0) -#define doublestore(T,V) do { *((long *) T) = ((doubleget_union *)&V)->m[0]; \ - *(((long *) T)+1) = ((doubleget_union *)&V)->m[1]; \ - } while (0) -#define float4get(V,M) do { *((long *) &(V)) = *((long*) (M)); } while(0) -#define float8get(V,M) doubleget((V),(M)) -#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float)) -#define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V),sizeof(float)) -#define floatget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(float)) -#define float8store(V,M) doublestore((V),(M)) -#endif /* __i386__ */ - -#ifndef sint2korr -/* - We're here if it's not a IA-32 architecture (Win32 and UNIX IA-32 defines - were done before) -*/ -#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\ - ((int16) ((int16) (A)[1]) << 8)) -#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \ - (((uint32) 255L << 24) | \ - (((uint32) (uchar) (A)[2]) << 16) |\ - (((uint32) (uchar) (A)[1]) << 8) | \ - ((uint32) (uchar) (A)[0])) : \ - (((uint32) (uchar) (A)[2]) << 16) |\ - (((uint32) (uchar) (A)[1]) << 8) | \ - ((uint32) (uchar) (A)[0]))) -#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) +\ - (((int32) ((uchar) (A)[1]) << 8)) +\ - (((int32) ((uchar) (A)[2]) << 16)) +\ - (((int32) ((int16) (A)[3]) << 24))) -#define sint8korr(A) (longlong) uint8korr(A) -#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) +\ - ((uint16) ((uchar) (A)[1]) << 8)) -#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16)) -#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16) +\ - (((uint32) ((uchar) (A)[3])) << 24)) -#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16) +\ - (((uint32) ((uchar) (A)[3])) << 24)) +\ - (((ulonglong) ((uchar) (A)[4])) << 32)) -#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16) +\ - (((uint32) ((uchar) (A)[3])) << 24)) +\ - (((ulonglong) (((uint32) ((uchar) (A)[4])) +\ - (((uint32) ((uchar) (A)[5])) << 8) +\ - (((uint32) ((uchar) (A)[6])) << 16) +\ - (((uint32) ((uchar) (A)[7])) << 24))) <<\ - 32)) -#define int2store(T,A) do { uint def_temp= (uint) (A) ;\ - *((uchar*) (T))= (uchar)(def_temp); \ - *((uchar*) (T)+1)=(uchar)((def_temp >> 8)); \ - } while(0) -#define int3store(T,A) do { /*lint -save -e734 */\ - *((uchar*)(T))=(uchar) ((A));\ - *((uchar*) (T)+1)=(uchar) (((A) >> 8));\ - *((uchar*)(T)+2)=(uchar) (((A) >> 16)); \ - /*lint -restore */} while(0) -#define int4store(T,A) do { *((char *)(T))=(char) ((A));\ - *(((char *)(T))+1)=(char) (((A) >> 8));\ - *(((char *)(T))+2)=(char) (((A) >> 16));\ - *(((char *)(T))+3)=(char) (((A) >> 24)); } while(0) -#define int5store(T,A) do { *((char *)(T))=((A));\ - *(((char *)(T))+1)=(((A) >> 8));\ - *(((char *)(T))+2)=(((A) >> 16));\ - *(((char *)(T))+3)=(((A) >> 24)); \ - *(((char *)(T))+4)=(((A) >> 32)); } while(0) -#define int8store(T,A) do { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \ - int4store((T),def_temp); \ - int4store((T+4),def_temp2); } while(0) -#ifdef WORDS_BIGENDIAN -#define float4store(T,A) do { *(T)= ((byte *) &A)[3];\ - *((T)+1)=(char) ((byte *) &A)[2];\ - *((T)+2)=(char) ((byte *) &A)[1];\ - *((T)+3)=(char) ((byte *) &A)[0]; } while(0) - -#define float4get(V,M) do { float def_temp;\ - ((byte*) &def_temp)[0]=(M)[3];\ - ((byte*) &def_temp)[1]=(M)[2];\ - ((byte*) &def_temp)[2]=(M)[1];\ - ((byte*) &def_temp)[3]=(M)[0];\ - (V)=def_temp; } while(0) -#define float8store(T,V) do { *(T)= ((byte *) &V)[7];\ - *((T)+1)=(char) ((byte *) &V)[6];\ - *((T)+2)=(char) ((byte *) &V)[5];\ - *((T)+3)=(char) ((byte *) &V)[4];\ - *((T)+4)=(char) ((byte *) &V)[3];\ - *((T)+5)=(char) ((byte *) &V)[2];\ - *((T)+6)=(char) ((byte *) &V)[1];\ - *((T)+7)=(char) ((byte *) &V)[0]; } while(0) - -#define float8get(V,M) do { double def_temp;\ - ((byte*) &def_temp)[0]=(M)[7];\ - ((byte*) &def_temp)[1]=(M)[6];\ - ((byte*) &def_temp)[2]=(M)[5];\ - ((byte*) &def_temp)[3]=(M)[4];\ - ((byte*) &def_temp)[4]=(M)[3];\ - ((byte*) &def_temp)[5]=(M)[2];\ - ((byte*) &def_temp)[6]=(M)[1];\ - ((byte*) &def_temp)[7]=(M)[0];\ - (V) = def_temp; } while(0) -#else -#define float4get(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float)) -#define float4store(V,M) memcpy_fixed((byte*) V,(byte*) (&M),sizeof(float)) - -#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN) -#define doublestore(T,V) do { *(((char*)T)+0)=(char) ((byte *) &V)[4];\ - *(((char*)T)+1)=(char) ((byte *) &V)[5];\ - *(((char*)T)+2)=(char) ((byte *) &V)[6];\ - *(((char*)T)+3)=(char) ((byte *) &V)[7];\ - *(((char*)T)+4)=(char) ((byte *) &V)[0];\ - *(((char*)T)+5)=(char) ((byte *) &V)[1];\ - *(((char*)T)+6)=(char) ((byte *) &V)[2];\ - *(((char*)T)+7)=(char) ((byte *) &V)[3]; }\ - while(0) -#define doubleget(V,M) do { double def_temp;\ - ((byte*) &def_temp)[0]=(M)[4];\ - ((byte*) &def_temp)[1]=(M)[5];\ - ((byte*) &def_temp)[2]=(M)[6];\ - ((byte*) &def_temp)[3]=(M)[7];\ - ((byte*) &def_temp)[4]=(M)[0];\ - ((byte*) &def_temp)[5]=(M)[1];\ - ((byte*) &def_temp)[6]=(M)[2];\ - ((byte*) &def_temp)[7]=(M)[3];\ - (V) = def_temp; } while(0) -#endif /* __FLOAT_WORD_ORDER */ - -#define float8get(V,M) doubleget((V),(M)) -#define float8store(V,M) doublestore((V),(M)) -#endif /* WORDS_BIGENDIAN */ - -#endif /* sint2korr */ - -/* - Macro for reading 32-bit integer from network byte order (big-endian) - from unaligned memory location. -*/ -#define int4net(A) (int32) (((uint32) ((uchar) (A)[3])) |\ - (((uint32) ((uchar) (A)[2])) << 8) |\ - (((uint32) ((uchar) (A)[1])) << 16) |\ - (((uint32) ((uchar) (A)[0])) << 24)) -/* - Define-funktions for reading and storing in machine format from/to - short/long to/from some place in memory V should be a (not - register) variable, M is a pointer to byte -*/ - -#ifdef WORDS_BIGENDIAN - -#define ushortget(V,M) do { V = (uint16) (((uint16) ((uchar) (M)[1]))+\ - ((uint16) ((uint16) (M)[0]) << 8)); } while(0) -#define shortget(V,M) do { V = (short) (((short) ((uchar) (M)[1]))+\ - ((short) ((short) (M)[0]) << 8)); } while(0) -#define longget(V,M) do { int32 def_temp;\ - ((byte*) &def_temp)[0]=(M)[0];\ - ((byte*) &def_temp)[1]=(M)[1];\ - ((byte*) &def_temp)[2]=(M)[2];\ - ((byte*) &def_temp)[3]=(M)[3];\ - (V)=def_temp; } while(0) -#define ulongget(V,M) do { uint32 def_temp;\ - ((byte*) &def_temp)[0]=(M)[0];\ - ((byte*) &def_temp)[1]=(M)[1];\ - ((byte*) &def_temp)[2]=(M)[2];\ - ((byte*) &def_temp)[3]=(M)[3];\ - (V)=def_temp; } while(0) -#define shortstore(T,A) do { uint def_temp=(uint) (A) ;\ - *(((char*)T)+1)=(char)(def_temp); \ - *(((char*)T)+0)=(char)(def_temp >> 8); } while(0) -#define longstore(T,A) do { *(((char*)T)+3)=((A));\ - *(((char*)T)+2)=(((A) >> 8));\ - *(((char*)T)+1)=(((A) >> 16));\ - *(((char*)T)+0)=(((A) >> 24)); } while(0) - -#define floatget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(float)) -#define floatstore(T,V) memcpy_fixed((byte*) (T),(byte*)(&V),sizeof(float)) -#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double)) -#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double)) -#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong)) -#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong)) - -#else - -#define ushortget(V,M) do { V = uint2korr(M); } while(0) -#define shortget(V,M) do { V = sint2korr(M); } while(0) -#define longget(V,M) do { V = sint4korr(M); } while(0) -#define ulongget(V,M) do { V = uint4korr(M); } while(0) -#define shortstore(T,V) int2store(T,V) -#define longstore(T,V) int4store(T,V) -#ifndef floatstore -#define floatstore(T,V) memcpy_fixed((byte*) (T),(byte*) (&V),sizeof(float)) -#define floatget(V,M) memcpy_fixed((byte*) &V, (byte*) (M), sizeof(float)) -#endif -#ifndef doubleget -#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double)) -#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double)) -#endif /* doubleget */ -#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong)) -#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong)) - -#endif /* WORDS_BIGENDIAN */ - -/* sprintf does not always return the number of bytes :- */ -#ifdef SPRINTF_RETURNS_INT -#define my_sprintf(buff,args) sprintf args -#else -#ifdef SPRINTF_RETURNS_PTR -#define my_sprintf(buff,args) ((int)(sprintf args - buff)) -#else -#define my_sprintf(buff,args) ((ulong) sprintf args, (ulong) strlen(buff)) -#endif -#endif - -#ifndef THREAD -#define thread_safe_increment(V,L) (V)++ -#define thread_safe_add(V,C,L) (V)+=(C) -#define thread_safe_sub(V,C,L) (V)-=(C) -#define statistic_increment(V,L) (V)++ -#define statistic_add(V,C,L) (V)+=(C) -#endif +#include #ifdef HAVE_CHARSET_utf8 #define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8" @@ -1299,8 +574,208 @@ do { doubleget_union _tmp; \ #define MYSQL_UNIVERSAL_CLIENT_CHARSET MYSQL_DEFAULT_CHARSET_NAME #endif -#if defined(EMBEDDED_LIBRARY) && !defined(HAVE_EMBEDDED_PRIVILEGE_CONTROL) -#define NO_EMBEDDED_ACCESS_CHECKS +#if defined(_WIN32) +#define dlsym(lib, name) (void*)GetProcAddress((HMODULE)lib, name) +#define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0) +#define dlclose(lib) FreeLibrary((HMODULE)lib) +#ifndef HAVE_DLOPEN +#define HAVE_DLOPEN +#endif +#define DLERROR_GENERATE(errmsg, error_number) \ + char win_errormsg[2048]; \ + if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, \ + 0, error_number, 0, win_errormsg, 2048, NULL)) \ + { \ + char *ptr; \ + for (ptr= &win_errormsg[0] + strlen(win_errormsg) - 1; \ + ptr >= &win_errormsg[0] && strchr("\r\n\t\0x20", *ptr); \ + ptr--) \ + *ptr= 0; \ + errmsg= win_errormsg; \ + } \ + else \ + errmsg= "" +#define dlerror() "" +#define dlopen_errno GetLastError() + +#else /* _WIN32 */ +#define DLERROR_GENERATE(errmsg, error_number) errmsg= dlerror() +#define dlopen_errno errno +#endif /* _WIN32 */ + +/* Length of decimal number represented by INT32. */ +#define MY_INT32_NUM_DECIMAL_DIGITS 11U + +/* Length of decimal number represented by INT64. */ +#define MY_INT64_NUM_DECIMAL_DIGITS 21U + +/* Define some useful general macros (should be done after all headers). */ +#define MY_MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MY_MIN(a, b) ((a) < (b) ? (a) : (b)) + +#if !defined(__cplusplus) && !defined(bool) +#define bool In_C_you_should_use_my_bool_instead() #endif -#endif /* my_global_h */ +/* + MYSQL_PLUGIN_IMPORT macro is used to export mysqld data + (i.e variables) for usage in storage engine loadable plugins. + Outside of Windows, it is dummy. +*/ +#if (defined(_WIN32) && defined(MYSQL_DYNAMIC_PLUGIN)) +#define MYSQL_PLUGIN_IMPORT __declspec(dllimport) +#else +#define MYSQL_PLUGIN_IMPORT +#endif + +#include + +#ifdef EMBEDDED_LIBRARY +#define NO_EMBEDDED_ACCESS_CHECKS +/* Things we don't need in the embedded version of MySQL */ +#undef HAVE_OPENSSL +#endif /* EMBEDDED_LIBRARY */ + + +enum loglevel { + ERROR_LEVEL= 0, + WARNING_LEVEL= 1, + INFORMATION_LEVEL= 2 +}; + + +#ifdef _WIN32 +/**************************************************************************** +** Replacements for localtime_r and gmtime_r +****************************************************************************/ + +static inline struct tm *localtime_r(const time_t *timep, struct tm *tmp) +{ + localtime_s(tmp, timep); + return tmp; +} + +static inline struct tm *gmtime_r(const time_t *clock, struct tm *res) +{ + gmtime_s(res, clock); + return res; +} +#endif /* _WIN32 */ + +#ifndef HAVE_STRUCT_TIMESPEC /* Windows before VS2015 */ +/* + Declare a union to make sure FILETIME is properly aligned + so it can be used directly as a 64 bit value. The value + stored is in 100ns units. +*/ +union ft64 { + FILETIME ft; + __int64 i64; + }; + +struct timespec { + union ft64 tv; + /* The max timeout value in millisecond for native_cond_timedwait */ + long max_timeout_msec; +}; + +#endif /* !HAVE_STRUCT_TIMESPEC */ + +C_MODE_START +extern ulonglong my_getsystime(void); +C_MODE_END + +static inline void set_timespec_nsec(struct timespec *abstime, ulonglong nsec) +{ +#ifdef HAVE_STRUCT_TIMESPEC + ulonglong now= my_getsystime() + (nsec / 100); + ulonglong tv_sec= now / 10000000ULL; +#if SIZEOF_TIME_T < SIZEOF_LONG_LONG + /* Ensure that the number of seconds don't overflow. */ + tv_sec= MY_MIN(tv_sec, ((ulonglong)INT_MAX32)); +#endif + abstime->tv_sec= (time_t)tv_sec; + abstime->tv_nsec= (now % 10000000ULL) * 100 + (nsec % 100); +#else /* !HAVE_STRUCT_TIMESPEC */ + ulonglong max_timeout_msec= (nsec / 1000000); + union ft64 tv; + GetSystemTimeAsFileTime(&tv.ft); + abstime->tv.i64= tv.i64 + (__int64)(nsec / 100); +#if SIZEOF_LONG < SIZEOF_LONG_LONG + /* Ensure that the msec value doesn't overflow. */ + max_timeout_msec= MY_MIN(max_timeout_msec, ((ulonglong)INT_MAX32)); +#endif + abstime->max_timeout_msec= (long)max_timeout_msec; +#endif /* !HAVE_STRUCT_TIMESPEC */ +} + +static inline void set_timespec(struct timespec *abstime, ulonglong sec) +{ + set_timespec_nsec(abstime, sec * 1000000000ULL); +} + +/** + Compare two timespec structs. + + @retval 1 If ts1 ends after ts2. + @retval -1 If ts1 ends before ts2. + @retval 0 If ts1 is equal to ts2. +*/ +static inline int cmp_timespec(struct timespec *ts1, struct timespec *ts2) +{ +#ifdef HAVE_STRUCT_TIMESPEC + if (ts1->tv_sec > ts2->tv_sec || + (ts1->tv_sec == ts2->tv_sec && ts1->tv_nsec > ts2->tv_nsec)) + return 1; + if (ts1->tv_sec < ts2->tv_sec || + (ts1->tv_sec == ts2->tv_sec && ts1->tv_nsec < ts2->tv_nsec)) + return -1; +#else + if (ts1->tv.i64 > ts2->tv.i64) + return 1; + if (ts1->tv.i64 < ts2->tv.i64) + return -1; +#endif + return 0; +} + +static inline ulonglong diff_timespec(struct timespec *ts1, struct timespec *ts2) +{ +#ifdef HAVE_STRUCT_TIMESPEC + return (ts1->tv_sec - ts2->tv_sec) * 1000000000ULL + + ts1->tv_nsec - ts2->tv_nsec; +#else + return (ts1->tv.i64 - ts2->tv.i64) * 100; +#endif +} + +#ifdef _WIN32 +typedef int MY_MODE; +#else +typedef mode_t MY_MODE; +#endif /* _WIN32 */ + +/* File permissions */ +#define USER_READ (1L << 0) +#define USER_WRITE (1L << 1) +#define USER_EXECUTE (1L << 2) +#define GROUP_READ (1L << 3) +#define GROUP_WRITE (1L << 4) +#define GROUP_EXECUTE (1L << 5) +#define OTHERS_READ (1L << 6) +#define OTHERS_WRITE (1L << 7) +#define OTHERS_EXECUTE (1L << 8) +#define USER_RWX USER_READ | USER_WRITE | USER_EXECUTE +#define GROUP_RWX GROUP_READ | GROUP_WRITE | GROUP_EXECUTE +#define OTHERS_RWX OTHERS_READ | OTHERS_WRITE | OTHERS_EXECUTE + +/* Defaults */ +#define DEFAULT_SSL_CA_CERT "ca.pem" +#define DEFAULT_SSL_CA_KEY "ca-key.pem" +#define DEFAULT_SSL_SERVER_CERT "server-cert.pem" +#define DEFAULT_SSL_SERVER_KEY "server-key.pem" + +#if defined(_WIN32) || defined(_WIN64) + #define strcasecmp _stricmp +#endif +#endif // MY_GLOBAL_INCLUDED diff --git a/3rdparty/mysql/include/my_list.h b/3rdparty/mysql/include/my_list.h index 92598696fc..294be663d0 100644 --- a/3rdparty/mysql/include/my_list.h +++ b/3rdparty/mysql/include/my_list.h @@ -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 } diff --git a/3rdparty/mysql/include/my_pthread.h b/3rdparty/mysql/include/my_pthread.h deleted file mode 100644 index 202e047dc4..0000000000 --- a/3rdparty/mysql/include/my_pthread.h +++ /dev/null @@ -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 -#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 -#include - -#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 -#undef sigwait -#endif -#include -#ifndef _REENTRANT -#define _REENTRANT -#endif -#ifdef HAVE_THR_SETCONCURRENCY -#include /* Probably solaris */ -#endif -#ifdef HAVE_SCHED_H -#include -#endif -#ifdef HAVE_SYNCH_H -#include -#endif -#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 */ diff --git a/3rdparty/mysql/include/my_sys.h b/3rdparty/mysql/include/my_sys.h index 44fe383bf4..29a1f34019 100644 --- a/3rdparty/mysql/include/my_sys.h +++ b/3rdparty/mysql/include/my_sys.h @@ -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,40 +11,65 @@ You 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 _my_sys_h #define _my_sys_h + +#include "my_global.h" /* C_MODE_START, C_MODE_END */ +#include "m_ctype.h" /* for CHARSET_INFO */ + +#include "my_thread.h" /* Needed for psi.h */ +#include "mysql/psi/psi.h" +#include "mysql/service_mysql_alloc.h" +#include "mysql/psi/mysql_memory.h" +#include "mysql/psi/mysql_thread.h" + +#ifdef HAVE_ALLOCA_H +#include +#endif +#ifdef _WIN32 +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + C_MODE_START -#ifdef HAVE_AIOWAIT -#include /* Used by record-cache */ -typedef struct my_aio_result { - aio_result_t result; - int pending; -} my_aio_result; -#endif +#ifdef HAVE_VALGRIND +# include +# define MEM_MALLOCLIKE_BLOCK(p1, p2, p3, p4) VALGRIND_MALLOCLIKE_BLOCK(p1, p2, p3, p4) +# define MEM_FREELIKE_BLOCK(p1, p2) VALGRIND_FREELIKE_BLOCK(p1, p2) +# include +# define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len) +# define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len) +# define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len) +#else /* HAVE_VALGRIND */ +# define MEM_MALLOCLIKE_BLOCK(p1, p2, p3, p4) do {} while (0) +# define MEM_FREELIKE_BLOCK(p1, p2) do {} while (0) +# define MEM_UNDEFINED(a,len) ((void) 0) +# define MEM_NOACCESS(a,len) ((void) 0) +# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0) +#endif /* HAVE_VALGRIND */ -#ifndef THREAD -extern int NEAR my_errno; /* Last error in mysys */ -#else -#include -#endif - -#ifndef _m_ctype_h -#include /* for CHARSET_INFO */ -#endif - -#include #include -#define MYSYS_PROGRAM_USES_CURSES() { error_handler_hook = my_message_curses; mysys_uses_curses=1; } -#define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;} -#define MY_INIT(name); { my_progname= name; my_init(); } +#define MY_INIT(name) { my_progname= name; my_init(); } -#define ERRMSGSIZE (SC_MAXWIDTH) /* Max length of a error message */ -#define NRERRBUFFS (2) /* Buffers for parameters */ -#define MY_FILE_ERROR ((uint) ~0) +/** + Max length of an error message generated by mysys utilities. + Some mysys functions produce error messages. These mostly go + to stderr. + This constant defines the size of the buffer used to format + the message. It should be kept in sync with MYSQL_ERRMSG_SIZE, + since sometimes mysys errors are stored in the server diagnostics + area, and we would like to avoid unexpected truncation. +*/ +#define MYSYS_ERRMSG_SIZE (512) +#define MYSYS_STRERROR_SIZE (128) + +#define MY_FILE_ERROR ((size_t) -1) /* General bitmaps for my_func's */ #define MY_FFNF 1 /* Fatal if file not found */ @@ -55,7 +79,8 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_WME 16 /* Write message on error */ #define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */ #define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */ -#define MY_RAID 64 /* Support for RAID */ +#define MY_SYNC_DIR 8192 /* my_create/delete/rename: sync directory */ +#define MY_UNUSED 64 /* Unused (was support for RAID) */ #define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */ #define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ #define MY_LINK_WARNING 32 /* my_redel() gives warning if links */ @@ -64,30 +89,27 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */ #define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */ #define MY_REDEL_MAKE_BACKUP 256 +#define MY_REDEL_NO_COPY_STAT 512 /* my_redel() doesn't call my_copystat() */ #define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */ #define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */ #define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */ #define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */ #define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ -#define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */ #define MY_DONT_OVERWRITE_FILE 1024 /* my_copy: Don't overwrite file */ +#define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ +#define MY_SYNC 4096 /* my_copy(): sync dst file */ + +#define MYF_RW MYF(MY_WME+MY_NABP) /* For my_read & my_write */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ +#define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */ -#define ME_HIGHBYTE 8 /* Shift for colours */ -#define ME_NOCUR 1 /* Don't use curses message */ -#define ME_OLDWIN 2 /* Use old window */ -#define ME_BELL 4 /* Ring bell then printing message */ -#define ME_HOLDTANG 8 /* Don't delete last keys */ -#define ME_WAITTOT 16 /* Wait for errtime secs of for a action */ -#define ME_WAITTANG 32 /* Wait for a user action */ -#define ME_NOREFRESH 64 /* Dont refresh screen */ -#define ME_NOINPUT 128 /* Dont use the input libary */ -#define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */ -#define ME_COLOUR2 ((2 << ME_HIGHBYTE)) -#define ME_COLOUR3 ((3 << ME_HIGHBYTE)) +/* Flags for my_error() */ +#define ME_BELL 4 /* DEPRECATED: Ring bell then printing message */ +#define ME_ERRORLOG 64 /* Write the error message to error log */ +#define ME_FATALERROR 1024 /* Fatal statement error */ /* Bits in last argument to fn_format */ #define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */ @@ -98,6 +120,8 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_RETURN_REAL_PATH 32 /* return full path for file */ #define MY_SAFE_PATH 64 /* Return NULL if too long path */ #define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */ +#define MY_APPEND_EXT 256 /* add 'ext' as additional extension*/ + /* My seek flags */ #define MY_SEEK_SET 0 @@ -126,158 +150,121 @@ extern int NEAR my_errno; /* Last error in mysys */ #define GETDATE_FIXEDLENGTH 16 /* defines when allocating data */ -#ifdef SAFEMALLOC -#define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG ) -#define my_malloc_ci(SZ,FLAG) _mymalloc((SZ), sFile, uLine, FLAG ) -#define my_realloc(PTR,SZ,FLAG) _myrealloc((PTR), (SZ), __FILE__, __LINE__, FLAG ) -#define my_checkmalloc() _sanity( __FILE__, __LINE__ ) -#define my_free(PTR,FLAG) _myfree((PTR), __FILE__, __LINE__,FLAG) -#define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C) -#define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C) -#define my_strdup_with_length(A,B,C) _my_strdup_with_length((A),(B),__FILE__,__LINE__,C) -#define TRASH(A,B) bfill(A, B, 0x8F) -#define QUICK_SAFEMALLOC sf_malloc_quick=1 -#define NORMAL_SAFEMALLOC sf_malloc_quick=0 -extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick; -extern ulonglong sf_malloc_mem_limit; +extern void *my_multi_malloc(PSI_memory_key key, myf flags, ...); -#define CALLER_INFO_PROTO , const char *sFile, uint uLine -#define CALLER_INFO , __FILE__, __LINE__ -#define ORIG_CALLER_INFO , sFile, uLine +/* + Switch to my_malloc() if the memory block to be allocated is bigger than + max_alloca_sz. +*/ +extern PSI_memory_key key_memory_max_alloca; +#define my_safe_alloca(size, max_alloca_sz) ((size <= max_alloca_sz) ? \ + my_alloca(size) : \ + my_malloc(key_memory_max_alloca, size, MYF(0))) +#define my_safe_afree(ptr, size, max_alloca_sz) if (size > max_alloca_sz) \ + my_free(ptr) + +#if !defined(DBUG_OFF) || defined(HAVE_VALGRIND) +/** + Put bad content in memory to be sure it will segfault if dereferenced. + With Valgrind, verify that memory is addressable, and mark it undefined. + We cache value of B because if B is expression which depends on A, memset() + trashes value of B. +*/ +#define TRASH(A,B) do { \ + const size_t l= (B); \ + MEM_CHECK_ADDRESSABLE(A, l); \ + memset(A, 0x8F, l); \ + MEM_UNDEFINED(A, l); \ + } while (0) #else -#define my_checkmalloc() -#undef TERMINATE -#define TERMINATE(A) {} -#define QUICK_SAFEMALLOC -#define NORMAL_SAFEMALLOC -extern gptr my_malloc(uint Size,myf MyFlags); -#define my_malloc_ci(SZ,FLAG) my_malloc( SZ, FLAG ) -extern gptr my_realloc(gptr oldpoint,uint Size,myf MyFlags); -extern void my_no_flags_free(gptr ptr); -extern gptr my_memdup(const byte *from,uint length,myf MyFlags); -extern char *my_strdup(const char *from,myf MyFlags); -extern char *my_strdup_with_length(const byte *from, uint length, - myf MyFlags); -/* we do use FG (as a no-op) in below so that a typo on FG is caught */ -#define my_free(PTR,FG) ((void)FG,my_no_flags_free(PTR)) -#define CALLER_INFO_PROTO /* nothing */ -#define CALLER_INFO /* nothing */ -#define ORIG_CALLER_INFO /* nothing */ -#define TRASH(A,B) /* nothing */ +#define TRASH(A,B) do {} while(0) #endif +#if defined(ENABLED_DEBUG_SYNC) +extern void (*debug_sync_C_callback_ptr)(const char *, size_t); +#define DEBUG_SYNC_C(_sync_point_name_) do { \ + if (debug_sync_C_callback_ptr != NULL) \ + (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); } \ + while(0) +#define DEBUG_SYNC_C_IF_THD(thd, _sync_point_name_) do { \ + if (debug_sync_C_callback_ptr != NULL && thd) \ + (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); } \ + while(0) +#else +#define DEBUG_SYNC_C(_sync_point_name_) +#define DEBUG_SYNC_C_IF_THD(thd, _sync_point_name_) +#endif /* defined(ENABLED_DEBUG_SYNC) */ -#ifdef HAVE_LARGE_PAGES +#ifdef HAVE_LINUX_LARGE_PAGES extern uint my_get_large_page_size(void); -extern gptr my_large_malloc(uint size, myf my_flags); -extern void my_large_free(gptr ptr, myf my_flags); -#else -#define my_get_large_page_size() (0) -#define my_large_malloc(A,B) my_malloc_lock((A),(B)) -#define my_large_free(A,B) my_free_lock((A),(B)) -#endif /* HAVE_LARGE_PAGES */ - -#ifdef HAVE_ALLOCA -#if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43) -#pragma alloca -#endif /* _AIX */ -#if defined(__MWERKS__) -#undef alloca -#define alloca _alloca -#endif /* __MWERKS__ */ -#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca) -#define alloca __builtin_alloca -#endif /* GNUC */ -#define my_alloca(SZ) alloca((size_t) (SZ)) -#define my_afree(PTR) {} -#else -#define my_alloca(SZ) my_malloc(SZ,MYF(0)) -#define my_afree(PTR) my_free(PTR,MYF(MY_WME)) -#endif /* HAVE_ALLOCA */ - -#ifdef MSDOS -#ifdef __ZTC__ -void * __CDECL halloc(long count,size_t length); -void __CDECL hfree(void *ptr); -#endif -#if defined(USE_HALLOC) -#if defined(_VCM_) || defined(M_IC80386) -#undef USE_HALLOC -#endif -#endif -#ifdef USE_HALLOC -#define malloc(a) halloc((long) (a),1) -#define free(a) hfree(a) -#endif -#endif /* MSDOS */ - -#ifndef errno /* did we already get it? */ -#ifdef HAVE_ERRNO_AS_DEFINE -#include /* errno is a define */ -#else -extern int errno; /* declare errno */ -#endif -#endif /* #ifndef errno */ -extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE]; -extern char *home_dir; /* Home directory for user */ -extern const char *my_progname; /* program-name (printed in errors) */ -extern char NEAR curr_dir[]; /* Current directory for user */ -extern int (*error_handler_hook)(uint my_err, const char *str,myf MyFlags); -extern int (*fatal_error_handler_hook)(uint my_err, const char *str, - myf MyFlags); -extern uint my_file_limit; - -#ifdef HAVE_LARGE_PAGES +extern uchar * my_large_malloc(PSI_memory_key key, size_t size, myf my_flags); +extern void my_large_free(uchar *ptr); extern my_bool my_use_large_pages; extern uint my_large_page_size; -#endif +#else +#define my_get_large_page_size() (0) +#define my_large_malloc(A,B,C) my_malloc((A),(B),(C)) +#define my_large_free(A) my_free((A)) +#endif /* HAVE_LINUX_LARGE_PAGES */ + +#define my_alloca(SZ) alloca((size_t) (SZ)) + +#include /* errno is a define */ + +extern char *home_dir; /* Home directory for user */ +extern const char *my_progname; /* program-name (printed in errors) */ +extern char curr_dir[]; /* Current directory for user */ +extern void (*error_handler_hook)(uint my_err, const char *str,myf MyFlags); +extern void (*fatal_error_handler_hook)(uint my_err, const char *str, + myf MyFlags); +extern void (*local_message_hook)(enum loglevel ll, + const char *format, va_list args); +extern uint my_file_limit; +extern MYSQL_PLUGIN_IMPORT ulong my_thread_stack_size; + +/* + Hooks for reporting execution stage information. The server implementation + of these will also set THD::current_cond/current_mutex. + By having hooks, we avoid direct dependencies on server code. +*/ +extern void (*enter_cond_hook)(void *opaque_thd, + mysql_cond_t *cond, + mysql_mutex_t *mutex, + const PSI_stage_info *stage, + PSI_stage_info *old_stage, + const char *src_function, + const char *src_file, + int src_line); + +extern void (*exit_cond_hook)(void *opaque_thd, + const PSI_stage_info *stage, + const char *src_function, + const char *src_file, + int src_line); + +/* + Hook for checking if the thread has been killed. +*/ +extern int (*is_killed_hook)(const void *opaque_thd); /* charsets */ -extern CHARSET_INFO *default_charset_info; -extern CHARSET_INFO *all_charsets[256]; +#define MY_ALL_CHARSETS_SIZE 2048 +extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info; +extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[MY_ALL_CHARSETS_SIZE]; extern CHARSET_INFO compiled_charsets[]; /* statistics */ extern ulong my_file_opened,my_stream_opened, my_tmp_file_created; -extern uint mysys_usage_id; +extern ulong my_file_total_opened; extern my_bool my_init_done; - /* Point to current my_message() */ -extern void (*my_sigtstp_cleanup)(void), - /* Executed before jump to shell */ - (*my_sigtstp_restart)(void), - (*my_abort_hook)(int); - /* Executed when comming from shell */ -extern int NEAR my_umask, /* Default creation mask */ - NEAR my_umask_dir, - NEAR my_recived_signals, /* Signals we have got */ - NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ - NEAR my_dont_interrupt; /* call remember_intr when set */ -extern my_bool NEAR mysys_uses_curses, my_use_symdir; -extern ulong sf_malloc_cur_memory, sf_malloc_max_memory; +extern MYSQL_PLUGIN_IMPORT int my_umask; /* Default creation mask */ +extern int my_umask_dir; extern ulong my_default_record_cache_size; -extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io, - NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks; +extern my_bool my_disable_locking, + my_enable_symlinks; extern char wild_many,wild_one,wild_prefix; extern const char *charsets_dir; -extern char *defaults_extra_file; -extern const char *defaults_group_suffix; -extern const char *defaults_file; - -extern my_bool timed_mutexes; - -typedef struct wild_file_pack /* Struct to hold info when selecting files */ -{ - uint wilds; /* How many wildcards */ - uint not_pos; /* Start of not-theese-files */ - my_string *wild; /* Pointer to wildcards */ -} WF_PACK; - -enum loglevel { - ERROR_LEVEL, - WARNING_LEVEL, - INFORMATION_LEVEL -}; enum cache_type { @@ -287,23 +274,16 @@ enum cache_type enum flush_type { - FLUSH_KEEP, FLUSH_RELEASE, FLUSH_IGNORE_CHANGED, FLUSH_FORCE_WRITE + FLUSH_KEEP, /* flush block and keep it in the cache */ + FLUSH_RELEASE, /* flush block and remove it from the cache */ + FLUSH_IGNORE_CHANGED, /* remove block from the cache */ + /* + As my_disable_flush_pagecache_blocks is always 0, the following option + is strictly equivalent to FLUSH_KEEP + */ + FLUSH_FORCE_WRITE }; -typedef struct st_record_cache /* Used when cacheing records */ -{ - File file; - int rc_seek,error,inited; - uint rc_length,read_length,reclength; - my_off_t rc_record_pos,end_of_file; - byte *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos; -#ifdef HAVE_AIOWAIT - int use_async_io; - my_aio_result aio_result; -#endif - enum cache_type type; -} RECORD_CACHE; - enum file_type { UNOPEN = 0, FILE_BY_OPEN, FILE_BY_CREATE, STREAM_BY_FOPEN, STREAM_BY_FDOPEN, @@ -312,60 +292,66 @@ enum file_type struct st_my_file_info { - my_string name; - enum file_type type; -#if defined(THREAD) && !defined(HAVE_PREAD) - pthread_mutex_t mutex; + char *name; +#ifdef _WIN32 + HANDLE fhandle; /* win32 file handle */ + int oflag; /* open flags, e.g O_APPEND */ #endif + enum file_type type; }; extern struct st_my_file_info *my_file_info; +/* needed for client-only build */ +#ifndef PSI_FILE_KEY_DEFINED +typedef unsigned int PSI_file_key; +#define PSI_FILE_KEY_DEFINED +#endif + +typedef struct st_dynamic_array +{ + uchar *buffer; + uint elements,max_element; + uint alloc_increment; + uint size_of_element; + PSI_memory_key m_psi_key; +} DYNAMIC_ARRAY; + typedef struct st_my_tmpdir { char **list; uint cur, max; -#ifdef THREAD - pthread_mutex_t mutex; -#endif + mysql_mutex_t mutex; } MY_TMPDIR; -typedef struct st_dynamic_array -{ - char *buffer; - uint elements,max_element; - uint alloc_increment; - uint size_of_element; -} DYNAMIC_ARRAY; - typedef struct st_dynamic_string { char *str; - uint length,max_length,alloc_increment; + size_t length,max_length,alloc_increment; } DYNAMIC_STRING; struct st_io_cache; typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*); -#ifdef THREAD typedef struct st_io_cache_share { - /* to sync on reads into buffer */ - pthread_mutex_t mutex; - pthread_cond_t cond; - int count, total; - /* actual IO_CACHE that filled the buffer */ - struct st_io_cache *active; -#ifdef NOT_YET_IMPLEMENTED - /* whether the structure should be free'd */ - my_bool alloced; -#endif + mysql_mutex_t mutex; /* To sync on reads into buffer. */ + mysql_cond_t cond; /* To wait for signals. */ + mysql_cond_t cond_writer; /* For a synchronized writer. */ + /* Offset in file corresponding to the first byte of buffer. */ + my_off_t pos_in_file; + /* If a synchronized write cache is the source of the data. */ + struct st_io_cache *source_cache; + uchar *buffer; /* The read buffer. */ + uchar *read_end; /* Behind last valid byte of buffer. */ + int running_threads; /* threads not in lock. */ + int total_threads; /* threads sharing the cache. */ + int error; /* Last error. */ } IO_CACHE_SHARE; -#endif typedef struct st_io_cache /* Used when cacheing files */ { - /* Offset in file corresponding to the first byte of byte* buffer. */ + /* Offset in file corresponding to the first byte of uchar* buffer. */ my_off_t pos_in_file; /* The offset of end of file for READ_CACHE and WRITE_CACHE. @@ -374,26 +360,26 @@ typedef struct st_io_cache /* Used when cacheing files */ */ my_off_t end_of_file; /* Points to current read position in the buffer */ - byte *read_pos; + uchar *read_pos; /* the non-inclusive boundary in the buffer for the currently valid read */ - byte *read_end; - byte *buffer; /* The read buffer */ + uchar *read_end; + uchar *buffer; /* The read buffer */ /* Used in ASYNC_IO */ - byte *request_pos; + uchar *request_pos; /* Only used in WRITE caches and in SEQ_READ_APPEND to buffer writes */ - byte *write_buffer; + uchar *write_buffer; /* Only used in SEQ_READ_APPEND, and points to the current read position in the write buffer. Note that reads in SEQ_READ_APPEND caches can - happen from both read buffer (byte* buffer) and write buffer - (byte* write_buffer). + happen from both read buffer (uchar* buffer) and write buffer + (uchar* write_buffer). */ - byte *append_read_pos; + uchar *append_read_pos; /* Points to current write position in the write buffer */ - byte *write_pos; + uchar *write_pos; /* The non-inclusive boundary of the valid write area */ - byte *write_end; + uchar *write_end; /* Current_pos and current_end are convenience variables used by @@ -401,13 +387,13 @@ typedef struct st_io_cache /* Used when cacheing files */ current_pos points to &write_pos, and current_end to &write_end in a WRITE_CACHE, and &read_pos and &read_end respectively otherwise */ - byte **current_pos, **current_end; -#ifdef THREAD + uchar **current_pos, **current_end; + /* The lock is for append buffer used in SEQ_READ_APPEND cache need mutex copying from append buffer to read buffer. */ - pthread_mutex_t append_buffer_lock; + mysql_mutex_t append_buffer_lock; /* The following is used when several threads are reading the same file in parallel. They are synchronized on disk @@ -416,7 +402,7 @@ typedef struct st_io_cache /* Used when cacheing files */ READ_CACHE mode is supported. */ IO_CACHE_SHARE *share; -#endif + /* A caller will use my_b_read() macro to read from the cache if the data is already in cache, it will be simply copied with @@ -425,12 +411,12 @@ typedef struct st_io_cache /* Used when cacheing files */ my_b_read() will call read_function to fetch the data. read_function must never be invoked directly. */ - int (*read_function)(struct st_io_cache *,byte *,uint); + int (*read_function)(struct st_io_cache *,uchar *,size_t); /* Same idea as in the case of read_function, except my_b_write() needs to be replaced with my_b_append() for a SEQ_READ_APPEND cache */ - int (*write_function)(struct st_io_cache *,const byte *,uint); + int (*write_function)(struct st_io_cache *,const uchar *,size_t); /* Specifies the type of the cache. Depending on the type of the cache certain operations might not be available and yield unpredicatable @@ -449,13 +435,16 @@ typedef struct st_io_cache /* Used when cacheing files */ IO_CACHE_CALLBACK pre_close; /* Counts the number of times, when we were forced to use disk. We use it to - increase the binlog_cache_disk_use status variable. + increase the binlog_cache_disk_use and binlog_stmt_cache_disk_use status + variables. */ ulong disk_writes; void* arg; /* for use by pre/post_read */ char *file_name; /* if used with 'open_cached_file' */ char *dir,*prefix; File file; /* file descriptor */ + PSI_file_key file_key; /* instrumented file key */ + /* seek_not_done is set by my_b_seek() to inform the upcoming read/write operation that a seek needs to be preformed prior to the actual I/O @@ -465,9 +454,9 @@ typedef struct st_io_cache /* Used when cacheing files */ */ int seek_not_done,error; /* buffer_length is memory size allocated for buffer or write_buffer */ - uint buffer_length; + size_t buffer_length; /* read_length is the same as buffer_length except when we use async io */ - uint read_length; + size_t read_length; myf myflags; /* Flags used to my_read/my_write */ /* alloced_buffer is 1 if the buffer was allocated by init_io_cache() and @@ -476,22 +465,19 @@ typedef struct st_io_cache /* Used when cacheing files */ somewhere else */ my_bool alloced_buffer; -#ifdef HAVE_AIOWAIT - /* - As inidicated by ifdef, this is for async I/O, which is not currently - used (because it's not reliable on all systems) - */ - uint inited; - my_off_t aio_read_pos; - my_aio_result aio_result; -#endif } IO_CACHE; typedef int (*qsort2_cmp)(const void *, const void *, const void *); - /* defines for mf_iocache */ +typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...) + MY_ATTRIBUTE((format(printf, 2, 3))); - /* Test if buffer is inited */ +extern my_error_reporter my_charset_error_reporter; + +/* defines for mf_iocache */ +extern PSI_file_key key_file_io_cache; + +/* Test if buffer is inited */ #define my_b_clear(info) (info)->buffer=0 #define my_b_inited(info) (info)->buffer #define my_b_EOF INT_MIN @@ -506,62 +492,55 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *); ((info)->write_pos + (Count) <=(info)->write_end ?\ (memcpy((info)->write_pos, (Buffer), (size_t)(Count)),\ ((info)->write_pos+=(Count)),0) : \ - (*(info)->write_function)((info),(Buffer),(Count))) + (*(info)->write_function)((info),(uchar *)(Buffer),(Count))) #define my_b_get(info) \ ((info)->read_pos != (info)->read_end ?\ ((info)->read_pos++, (int) (uchar) (info)->read_pos[-1]) :\ _my_b_get(info)) - /* my_b_write_byte dosn't have any err-check */ -#define my_b_write_byte(info,chr) \ - (((info)->write_pos < (info)->write_end) ?\ - ((*(info)->write_pos++)=(chr)) :\ - (_my_b_write(info,0,0) , ((*(info)->write_pos++)=(chr)))) - -#define my_b_fill_cache(info) \ - (((info)->read_end=(info)->read_pos),(*(info)->read_function)(info,0,0)) - #define my_b_tell(info) ((info)->pos_in_file + \ - (uint) (*(info)->current_pos - (info)->request_pos)) + (size_t) (*(info)->current_pos - (info)->request_pos)) + +#define my_b_get_buffer_start(info) (info)->request_pos +#define my_b_get_bytes_in_buffer(info) (char*) (info)->read_end - \ + (char*) my_b_get_buffer_start(info) +#define my_b_get_pos_in_file(info) (info)->pos_in_file /* tell write offset in the SEQ_APPEND cache */ +int my_b_copy_to_file(IO_CACHE *cache, FILE *file); my_off_t my_b_append_tell(IO_CACHE* info); my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */ -#define my_b_bytes_in_cache(info) (uint) (*(info)->current_end - \ +#define my_b_bytes_in_cache(info) (size_t) (*(info)->current_end - \ *(info)->current_pos) typedef uint32 ha_checksum; -/* Define the type of function to be passed to process_default_option_files */ -typedef int (*Process_option_func)(void *ctx, const char *group_name, - const char *option); - #include + /* Prototypes for mysys and my_func functions */ extern int my_copy(const char *from,const char *to,myf MyFlags); -extern int my_append(const char *from,const char *to,myf MyFlags); extern int my_delete(const char *name,myf MyFlags); -extern int my_getwd(my_string buf,uint size,myf MyFlags); +extern int my_getwd(char * buf,size_t size,myf MyFlags); extern int my_setwd(const char *dir,myf MyFlags); extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags); -extern gptr my_once_alloc(uint Size,myf MyFlags); +extern void *my_once_alloc(size_t Size,myf MyFlags); extern void my_once_free(void); extern char *my_once_strdup(const char *src,myf myflags); -extern char *my_once_memdup(const char *src, uint len, myf myflags); +extern void *my_once_memdup(const void *src, size_t len, myf myflags); extern File my_open(const char *FileName,int Flags,myf MyFlags); extern File my_register_filename(File fd, const char *FileName, enum file_type type_of_file, uint error_message_number, myf MyFlags); extern File my_create(const char *FileName,int CreateFlags, - int AccsesFlags, myf MyFlags); + int AccessFlags, myf MyFlags); extern int my_close(File Filedes,myf MyFlags); -extern File my_dup(File file, myf MyFlags); extern int my_mkdir(const char *dir, int Flags, myf MyFlags); extern int my_readlink(char *to, const char *filename, myf MyFlags); +extern int my_is_symlink(const char *filename); extern int my_realpath(char *to, const char *filename, myf MyFlags); extern File my_create_with_symlink(const char *linkname, const char *filename, int createflags, int access_flags, @@ -569,250 +548,303 @@ extern File my_create_with_symlink(const char *linkname, const char *filename, extern int my_delete_with_symlink(const char *name, myf MyFlags); extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags); extern int my_symlink(const char *content, const char *linkname, myf MyFlags); -extern uint my_read(File Filedes,byte *Buffer,uint Count,myf MyFlags); -extern uint my_pread(File Filedes,byte *Buffer,uint Count,my_off_t offset, +extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags); +extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset, myf MyFlags); extern int my_rename(const char *from,const char *to,myf MyFlags); extern my_off_t my_seek(File fd,my_off_t pos,int whence,myf MyFlags); extern my_off_t my_tell(File fd,myf MyFlags); -extern uint my_write(File Filedes,const byte *Buffer,uint Count, +extern size_t my_write(File Filedes,const uchar *Buffer,size_t Count, myf MyFlags); -extern uint my_pwrite(File Filedes,const byte *Buffer,uint Count, +extern size_t my_pwrite(File Filedes,const uchar *Buffer,size_t Count, my_off_t offset,myf MyFlags); -extern uint my_fread(FILE *stream,byte *Buffer,uint Count,myf MyFlags); -extern uint my_fwrite(FILE *stream,const byte *Buffer,uint Count, +extern size_t my_fread(FILE *stream,uchar *Buffer,size_t Count,myf MyFlags); +extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count, myf MyFlags); extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags); extern my_off_t my_ftell(FILE *stream,myf MyFlags); -extern gptr _mymalloc(uint uSize,const char *sFile, - uint uLine, myf MyFlag); -extern gptr _myrealloc(gptr pPtr,uint uSize,const char *sFile, - uint uLine, myf MyFlag); -extern gptr my_multi_malloc _VARARGS((myf MyFlags, ...)); -extern void _myfree(gptr pPtr,const char *sFile,uint uLine, myf MyFlag); -extern int _sanity(const char *sFile,unsigned int uLine); -extern gptr _my_memdup(const byte *from,uint length, - const char *sFile, uint uLine,myf MyFlag); -extern my_string _my_strdup(const char *from, const char *sFile, uint uLine, - myf MyFlag); -extern char *_my_strdup_with_length(const byte *from, uint length, - const char *sFile, uint uLine, - myf MyFlag); -#ifdef __WIN__ -extern int my_access(const char *path, int amode); -extern File my_sopen(const char *path, int oflag, int shflag, int pmode); +/* implemented in my_syslog.c */ + +// Maximum size of message that will be logged. +#define MAX_SYSLOG_MESSAGE_SIZE 1024 + +/* Platform-independent SysLog support */ + +/* facilities on unixoid syslog. harmless on systemd / Win platforms. */ +typedef struct st_syslog_facility { int id; const char *name; } SYSLOG_FACILITY; +extern SYSLOG_FACILITY syslog_facility[]; + +enum my_syslog_options { MY_SYSLOG_PIDS= 1 }; + +int my_openlog(const char *eventSourceName, int option, int facility); +int my_closelog(); +int my_syslog(const CHARSET_INFO *cs, enum loglevel level, const char *msg); + +/* implemented in my_memmem.c */ +extern void *my_memmem(const void *haystack, size_t haystacklen, + const void *needle, size_t needlelen); + + +#ifdef _WIN32 +extern int my_access(const char *path, int amode); #else #define my_access access #endif -extern int check_if_legal_filename(const char *path); -#ifndef TERMINATE -extern void TERMINATE(FILE *file); +extern int check_if_legal_filename(const char *path); +extern int check_if_legal_tablename(const char *path); + +#ifdef _WIN32 +extern my_bool is_filename_allowed(const char *name, size_t length, + my_bool allow_current_dir); +#else /* _WIN32 */ +# define is_filename_allowed(name, length, allow_cwd) (TRUE) +#endif /* _WIN32 */ + +#ifdef _WIN32 +extern int nt_share_delete(const char *name,myf MyFlags); +#define my_delete_allow_opened(fname,flags) nt_share_delete((fname),(flags)) +#else +#define my_delete_allow_opened(fname,flags) my_delete((fname),(flags)) #endif -extern void init_glob_errs(void); + +#ifdef _WIN32 +/* Windows-only functions (CRT equivalents)*/ +extern HANDLE my_get_osfhandle(File fd); +extern void my_osmaperr(unsigned long last_error); +#endif + +extern const char* get_global_errmsg(int nr); +extern void wait_for_free_space(const char *filename, int errors); extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags); extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags); +extern FILE *my_freopen(const char *path, const char *mode, FILE *stream); extern int my_fclose(FILE *fd,myf MyFlags); +extern File my_fileno(FILE *fd); extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); +extern void thr_set_sync_wait_callback(void (*before_sync)(void), + void (*after_sync)(void)); extern int my_sync(File fd, myf my_flags); -extern int my_error _VARARGS((int nr,myf MyFlags, ...)); -extern int my_printf_error _VARARGS((uint my_err, const char *format, - myf MyFlags, ...) - __attribute__ ((format (printf, 2, 4)))); -extern int my_error_register(const char **errmsgs, int first, int last); -extern const char **my_error_unregister(int first, int last); -extern int my_message(uint my_err, const char *str,myf MyFlags); -extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags); -extern int my_message_curses(uint my_err, const char *str,myf MyFlags); +extern int my_sync_dir(const char *dir_name, myf my_flags); +extern int my_sync_dir_by_file(const char *file_name, myf my_flags); +extern char *my_strerror(char *buf, size_t len, int errnum); +extern const char *my_get_err_msg(int nr); +extern void my_error(int nr,myf MyFlags, ...); +extern void my_printf_error(uint my_err, const char *format, + myf MyFlags, ...) + MY_ATTRIBUTE((format(printf, 2, 4))); +extern void my_printv_error(uint error, const char *format, myf MyFlags, + va_list ap); +extern int my_error_register(const char* (*get_errmsg) (int), + int first, int last); +extern my_bool my_error_unregister(int first, int last); +extern void my_message(uint my_err, const char *str,myf MyFlags); +extern void my_message_stderr(uint my_err, const char *str, myf MyFlags); +void my_message_local_stderr(enum loglevel ll, + const char *format, va_list args); +extern void my_message_local(enum loglevel ll, const char *format, ...); extern my_bool my_init(void); extern void my_end(int infoflag); extern int my_redel(const char *from, const char *to, int MyFlags); extern int my_copystat(const char *from, const char *to, int MyFlags); -extern my_string my_filename(File fd); +extern char * my_filename(File fd); +extern MY_MODE get_file_perm(ulong perm_flags); +extern my_bool my_chmod(const char *filename, ulong perm_flags, myf my_flags); -#ifndef THREAD -extern void dont_break(void); -extern void allow_break(void); +#ifdef EXTRA_DEBUG +void my_print_open_files(void); #else -#define dont_break() -#define allow_break() +#define my_print_open_files() #endif extern my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist); extern char *my_tmpdir(MY_TMPDIR *tmpdir); extern void free_tmpdir(MY_TMPDIR *tmpdir); -extern void my_remember_signal(int signal_number,sig_handler (*func)(int)); -extern uint dirname_part(my_string to,const char *name); -extern uint dirname_length(const char *name); +extern size_t dirname_part(char * to,const char *name, size_t *to_res_length); +extern size_t dirname_length(const char *name); #define base_name(A) (A+dirname_length(A)) extern int test_if_hard_path(const char *dir_name); extern my_bool has_path(const char *name); extern char *convert_dirname(char *to, const char *from, const char *from_end); -extern void to_unix_path(my_string name); -extern my_string fn_ext(const char *name); -extern my_string fn_same(my_string toname,const char *name,int flag); -extern my_string fn_format(my_string to,const char *name,const char *dir, +extern void to_unix_path(char * name); +extern char * fn_ext(const char *name); +extern char * fn_same(char * toname,const char *name,int flag); +extern char * fn_format(char * to,const char *name,const char *dir, const char *form, uint flag); -extern size_s strlength(const char *str); -extern void pack_dirname(my_string to,const char *from); -extern uint unpack_dirname(my_string to,const char *from); -extern uint cleanup_dirname(my_string to,const char *from); -extern uint system_filename(my_string to,const char *from); -extern uint unpack_filename(my_string to,const char *from); -extern my_string intern_filename(my_string to,const char *from); -extern my_string directory_file_name(my_string dst, const char *src); -extern int pack_filename(my_string to, const char *name, size_s max_length); -extern my_string my_path(my_string to,const char *progname, +extern size_t strlength(const char *str); +extern void pack_dirname(char * to,const char *from); +extern size_t normalize_dirname(char * to, const char *from); +extern size_t unpack_dirname(char * to,const char *from); +extern size_t cleanup_dirname(char * to,const char *from); +extern size_t system_filename(char * to,const char *from); +extern size_t unpack_filename(char * to,const char *from); +extern char * intern_filename(char * to,const char *from); +extern char * directory_file_name(char * dst, const char *src); +extern int pack_filename(char * to, const char *name, size_t max_length); +extern char * my_path(char * to,const char *progname, const char *own_pathname_part); -extern my_string my_load_path(my_string to, const char *path, +extern char * my_load_path(char * to, const char *path, const char *own_path_prefix); -extern int wild_compare(const char *str,const char *wildstr,pbool str_is_pattern); -extern WF_PACK *wf_comp(my_string str); -extern int wf_test(struct wild_file_pack *wf_pack,const char *name); -extern void wf_end(struct wild_file_pack *buffer); -extern size_s strip_sp(my_string str); -extern void get_date(my_string to,int timeflag,time_t use_time); -extern void soundex(CHARSET_INFO *, my_string out_pntr, my_string in_pntr,pbool remove_garbage); -extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file, - uint reclength,enum cache_type type, - pbool use_async_io); -extern int read_cache_record(RECORD_CACHE *info,byte *to); -extern int end_record_cache(RECORD_CACHE *info); -extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos, - const byte *record,uint length); -extern int flush_write_cache(RECORD_CACHE *info); -extern long my_clock(void); -extern sig_handler sigtstp_handler(int signal_number); -extern void handle_recived_signals(void); +extern int wild_compare(const char *str,const char *wildstr, + pbool str_is_pattern); +extern my_bool array_append_string_unique(const char *str, + const char **array, size_t size); +extern void get_date(char * to,int timeflag,time_t use_time); +extern void soundex(CHARSET_INFO *, char * out_pntr, char * in_pntr, + pbool remove_garbage); -extern sig_handler my_set_alarm_variable(int signo); -extern void my_string_ptr_sort(void *base,uint items,size_s size); +extern my_bool radixsort_is_appliccable(uint n_items, size_t size_of_element); extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements, - size_s size_of_element,uchar *buffer[]); -extern qsort_t qsort2(void *base_ptr, size_t total_elems, size_t size, - qsort2_cmp cmp, void *cmp_argument); -extern qsort2_cmp get_ptr_compare(uint); -void my_store_ptr(byte *buff, uint pack_length, my_off_t pos); -my_off_t my_get_ptr(byte *ptr, uint pack_length); -extern int init_io_cache(IO_CACHE *info,File file,uint cachesize, - enum cache_type type,my_off_t seek_offset, - pbool use_async_io, myf cache_myflags); + size_t size_of_element,uchar *buffer[]); +extern void my_qsort(void *base_ptr, size_t total_elems, size_t size, + qsort_cmp cmp); +extern void my_qsort2(void *base_ptr, size_t total_elems, size_t size, + qsort2_cmp cmp, const void *cmp_argument); +void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos); +my_off_t my_get_ptr(uchar *ptr, size_t pack_length); +extern int init_io_cache_ext(IO_CACHE *info,File file,size_t cachesize, + enum cache_type type,my_off_t seek_offset, + pbool use_async_io, myf cache_myflags, + PSI_file_key file_key); +extern int init_io_cache(IO_CACHE *info,File file,size_t cachesize, + enum cache_type type,my_off_t seek_offset, + pbool use_async_io, myf cache_myflags); extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type, - my_off_t seek_offset,pbool use_async_io, - pbool clear_cache); + my_off_t seek_offset,pbool use_async_io, + pbool clear_cache); extern void setup_io_cache(IO_CACHE* info); -extern int _my_b_read(IO_CACHE *info,byte *Buffer,uint Count); -#ifdef THREAD -extern int _my_b_read_r(IO_CACHE *info,byte *Buffer,uint Count); -extern void init_io_cache_share(IO_CACHE *info, - IO_CACHE_SHARE *s, uint num_threads); +extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count); +extern int _my_b_read_r(IO_CACHE *info,uchar *Buffer,size_t Count); +extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare, + IO_CACHE *write_cache, uint num_threads); extern void remove_io_thread(IO_CACHE *info); -#endif -extern int _my_b_seq_read(IO_CACHE *info,byte *Buffer,uint Count); -extern int _my_b_net_read(IO_CACHE *info,byte *Buffer,uint Count); +extern int _my_b_seq_read(IO_CACHE *info,uchar *Buffer,size_t Count); +extern int _my_b_net_read(IO_CACHE *info,uchar *Buffer,size_t Count); extern int _my_b_get(IO_CACHE *info); -extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count); -extern int _my_b_write(IO_CACHE *info,const byte *Buffer,uint Count); -extern int my_b_append(IO_CACHE *info,const byte *Buffer,uint Count); -extern int my_b_safe_write(IO_CACHE *info,const byte *Buffer,uint Count); +extern int _my_b_write(IO_CACHE *info,const uchar *Buffer,size_t Count); +extern int my_b_append(IO_CACHE *info,const uchar *Buffer,size_t Count); +extern int my_b_safe_write(IO_CACHE *info,const uchar *Buffer,size_t Count); -extern int my_block_write(IO_CACHE *info, const byte *Buffer, - uint Count, my_off_t pos); +extern int my_block_write(IO_CACHE *info, const uchar *Buffer, + size_t Count, my_off_t pos); extern int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock); #define flush_io_cache(info) my_b_flush_io_cache((info),1) extern int end_io_cache(IO_CACHE *info); -extern uint my_b_fill(IO_CACHE *info); +extern size_t my_b_fill(IO_CACHE *info); extern void my_b_seek(IO_CACHE *info,my_off_t pos); -extern uint my_b_gets(IO_CACHE *info, char *to, uint max_length); +extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length); extern my_off_t my_b_filelength(IO_CACHE *info); -extern uint my_b_printf(IO_CACHE *info, const char* fmt, ...); -extern uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap); +extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...) + MY_ATTRIBUTE((format(printf, 2, 3))); +extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap); extern my_bool open_cached_file(IO_CACHE *cache,const char *dir, - const char *prefix, uint cache_size, + const char *prefix, size_t cache_size, myf cache_myflags); extern my_bool real_open_cached_file(IO_CACHE *cache); extern void close_cached_file(IO_CACHE *cache); File create_temp_file(char *to, const char *dir, const char *pfx, int mode, myf MyFlags); -#define my_init_dynamic_array(A,B,C,D) init_dynamic_array(A,B,C,D CALLER_INFO) -#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array(A,B,C,D ORIG_CALLER_INFO) -extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size, - uint init_alloc,uint alloc_increment - CALLER_INFO_PROTO); -extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,gptr element); -extern byte *alloc_dynamic(DYNAMIC_ARRAY *array); -extern byte *pop_dynamic(DYNAMIC_ARRAY*); -extern my_bool set_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index); -extern void get_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index); + +// Use Prealloced_array or std::vector or something similar in C++ +#if defined(__cplusplus) + +#define init_dynamic_array please_use_an_appropriately_typed_container +#define my_init_dynamic_array please_use_an_appropriately_typed_container + +#else + +extern my_bool my_init_dynamic_array(DYNAMIC_ARRAY *array, + PSI_memory_key key, + uint element_size, + void *init_buffer, + uint init_alloc, + uint alloc_increment); +/* init_dynamic_array() function is deprecated */ +extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size, + uint init_alloc, uint alloc_increment); +#define dynamic_element(array,array_index,type) \ + ((type)((array)->buffer) +(array_index)) + +#endif /* __cplusplus */ + +/* Some functions are still in use in C++, because HASH uses DYNAMIC_ARRAY */ +extern my_bool insert_dynamic(DYNAMIC_ARRAY *array, const void *element); +extern void *alloc_dynamic(DYNAMIC_ARRAY *array); +extern void *pop_dynamic(DYNAMIC_ARRAY*); +extern void get_dynamic(DYNAMIC_ARRAY *array, void *element, uint array_index); +extern void claim_dynamic(DYNAMIC_ARRAY *array); extern void delete_dynamic(DYNAMIC_ARRAY *array); -extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index); extern void freeze_size(DYNAMIC_ARRAY *array); -#define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element) -#define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index)) -#define push_dynamic(A,B) insert_dynamic(A,B) -#define reset_dynamic(array) ((array)->elements= 0) +static inline void reset_dynamic(DYNAMIC_ARRAY *array) +{ + array->elements= 0; +} extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, - uint init_alloc,uint alloc_increment); + size_t init_alloc,size_t alloc_increment); extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append); my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, - uint length); + size_t length); +extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, + ...); extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str); -extern my_bool dynstr_realloc(DYNAMIC_STRING *str, ulong additional_size); +extern my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size); +extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n); extern void dynstr_free(DYNAMIC_STRING *str); -#ifdef HAVE_MLOCK -extern byte *my_malloc_lock(uint length,myf flags); -extern void my_free_lock(byte *ptr,myf flags); -#else -#define my_malloc_lock(A,B) my_malloc((A),(B)) -#define my_free_lock(A,B) my_free((A),(B)) -#endif #define alloc_root_inited(A) ((A)->min_malloc != 0) #define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8) #define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0) -extern void init_alloc_root(MEM_ROOT *mem_root, uint block_size, - uint pre_alloc_size); -extern gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size); -extern gptr multi_alloc_root(MEM_ROOT *mem_root, ...); +extern void init_alloc_root(PSI_memory_key key, + MEM_ROOT *mem_root, size_t block_size, + size_t pre_alloc_size); +extern void *alloc_root(MEM_ROOT *mem_root, size_t Size); +extern void *multi_alloc_root(MEM_ROOT *mem_root, ...); +extern void claim_root(MEM_ROOT *root); extern void free_root(MEM_ROOT *root, myf MyFLAGS); -extern void set_prealloc_root(MEM_ROOT *root, char *ptr); -extern void reset_root_defaults(MEM_ROOT *mem_root, uint block_size, - uint prealloc_size); +extern void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size, + size_t prealloc_size); extern char *strdup_root(MEM_ROOT *root,const char *str); -extern char *strmake_root(MEM_ROOT *root,const char *str,uint len); -extern char *memdup_root(MEM_ROOT *root,const char *str,uint len); -extern int get_defaults_options(int argc, char **argv, - char **defaults, char **extra_defaults, - char **group_suffix); -extern int load_defaults(const char *conf_file, const char **groups, - int *argc, char ***argv); -extern int modify_defaults_file(const char *file_location, const char *option, - const char *option_value, - const char *section_name, int remove_option); -extern int my_search_option_files(const char *conf_file, int *argc, - char ***argv, uint *args_used, - Process_option_func func, void *func_ctx); -extern void free_defaults(char **argv); -extern void my_print_default_files(const char *conf_file); -extern void print_defaults(const char *conf_file, const char **groups); -extern my_bool my_compress(byte *, ulong *, ulong *); -extern my_bool my_uncompress(byte *, ulong *, ulong *); -extern byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen); -extern ha_checksum my_checksum(ha_checksum crc, const byte *mem, uint count); -extern uint my_bit_log2(ulong value); -extern uint my_count_bits(ulonglong v); -extern uint my_count_bits_ushort(ushort v); -extern void my_sleep(ulong m_seconds); +static inline char *safe_strdup_root(MEM_ROOT *root, const char *str) +{ + return str ? strdup_root(root, str) : 0; +} +extern char *strmake_root(MEM_ROOT *root,const char *str,size_t len); +extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len); +extern my_bool my_compress(uchar *, size_t *, size_t *); +extern my_bool my_uncompress(uchar *, size_t , size_t *); +extern uchar *my_compress_alloc(const uchar *packet, size_t *len, + size_t *complen); +extern int packfrm(uchar *, size_t, uchar **, size_t *); +extern int unpackfrm(uchar **, size_t *, const uchar *); + +extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem, + size_t count); + +/* Wait a given number of microseconds */ +static inline void my_sleep(time_t m_seconds) +{ +#if defined(_WIN32) + Sleep((DWORD)m_seconds/1000+1); /* Sleep() has millisecond arg */ +#else + struct timeval t; + t.tv_sec= m_seconds / 1000000L; + t.tv_usec= m_seconds % 1000000L; + select(0,0,0,0,&t); /* sleep */ +#endif +} + extern ulong crc32(ulong crc, const uchar *buf, uint len); extern uint my_set_max_open_files(uint files); void my_free_open_file_info(void); -ulonglong my_getsystime(void); -my_bool my_gethwaddr(uchar *to); +extern time_t my_time(myf flags); +extern ulonglong my_getsystime(void); +extern ulonglong my_micro_time(); +extern my_bool my_gethwaddr(uchar *to); #ifdef HAVE_SYS_MMAN_H #include @@ -821,12 +853,10 @@ my_bool my_gethwaddr(uchar *to); #define MAP_NOSYNC 0 #endif -#define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f) -#ifdef HAVE_GETPAGESIZE -#define my_getpagesize() getpagesize() +#ifdef HAVE_MMAP64 +#define my_mmap(a,b,c,d,e,f) mmap64(a,b,c,d,e,f) #else -/* qnx ? */ -#define my_getpagesize() 8192 +#define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f) #endif #define my_munmap(a,b) munmap((a),(b)) @@ -834,53 +864,69 @@ my_bool my_gethwaddr(uchar *to); /* not a complete set of mmap() flags, but only those that nesessary */ #define PROT_READ 1 #define PROT_WRITE 2 +#define MAP_NORESERVE 0 #define MAP_SHARED 0x0001 +#define MAP_PRIVATE 0x0002 #define MAP_NOSYNC 0x0800 #define MAP_FAILED ((void *)-1) #define MS_SYNC 0x0000 -#ifndef __NETWARE__ -#define HAVE_MMAP -#endif - -int my_getpagesize(void); void *my_mmap(void *, size_t, int, int, int, my_off_t); int my_munmap(void *, size_t); #endif +/* my_getpagesize */ +static inline int my_getpagesize() +{ +#ifndef _WIN32 + return getpagesize(); +#else + SYSTEM_INFO si; + GetSystemInfo(&si); + return (int)si.dwPageSize; +#endif +} + int my_msync(int, void *, size_t, int); /* character sets */ +extern void my_charset_loader_init_mysys(MY_CHARSET_LOADER *loader); extern uint get_charset_number(const char *cs_name, uint cs_flags); extern uint get_collation_number(const char *name); extern const char *get_charset_name(uint cs_number); extern CHARSET_INFO *get_charset(uint cs_number, myf flags); extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags); +extern CHARSET_INFO *my_collation_get_by_name(MY_CHARSET_LOADER *loader, + const char *name, myf flags); extern CHARSET_INFO *get_charset_by_csname(const char *cs_name, uint cs_flags, myf my_flags); +extern CHARSET_INFO *my_charset_get_by_name(MY_CHARSET_LOADER *loader, + const char *name, + uint cs_flags, myf my_flags); +extern my_bool resolve_charset(const char *cs_name, + const CHARSET_INFO *default_cs, + const CHARSET_INFO **cs); +extern my_bool resolve_collation(const char *cl_name, + const CHARSET_INFO *default_cl, + const CHARSET_INFO **cl); extern void free_charsets(void); extern char *get_charsets_dir(char *buf); -extern my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2); +extern my_bool my_charset_same(const CHARSET_INFO *cs1, + const CHARSET_INFO *cs2); extern my_bool init_compiled_charsets(myf flags); extern void add_compiled_collation(CHARSET_INFO *cs); -extern ulong escape_string_for_mysql(CHARSET_INFO *charset_info, - char *to, ulong to_length, - const char *from, ulong length); -#ifdef __WIN__ -#define BACKSLASH_MBTAIL +extern size_t escape_string_for_mysql(const CHARSET_INFO *charset_info, + char *to, size_t to_length, + const char *from, size_t length); +#ifdef _WIN32 /* File system character set */ extern CHARSET_INFO *fs_character_set(void); #endif -extern ulong escape_quotes_for_mysql(CHARSET_INFO *charset_info, - char *to, ulong to_length, - const char *from, ulong length); - -extern void thd_increment_bytes_sent(ulong length); -extern void thd_increment_bytes_received(ulong length); -extern void thd_increment_net_big_packet_count(ulong length); - -#ifdef __WIN__ +extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info, + char *to, size_t to_length, + const char *from, size_t length, char quote); +#ifdef _WIN32 extern my_bool have_tcpip; /* Is set if tcpip is used */ /* implemented in my_windac.c */ @@ -891,14 +937,24 @@ int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror, void my_security_attr_free(SECURITY_ATTRIBUTES *sa); /* implemented in my_conio.c */ -char* my_cgets(char *string, unsigned long clen, unsigned long* plen); +my_bool my_win_is_console(FILE *file); +char *my_win_console_readline(const CHARSET_INFO *cs, char *mbbuf, size_t mbbufsize, + size_t *nread); +void my_win_console_write(const CHARSET_INFO *cs, const char *data, size_t datalen); +void my_win_console_fputs(const CHARSET_INFO *cs, const char *data); +void my_win_console_putc(const CHARSET_INFO *cs, int c); +void my_win_console_vfprintf(const CHARSET_INFO *cs, const char *fmt, va_list args); +int my_win_translate_command_line_args(const CHARSET_INFO *cs, int *ac, char ***av); +#endif /* _WIN32 */ +#ifdef HAVE_PSI_INTERFACE +extern MYSQL_PLUGIN_IMPORT struct PSI_bootstrap *PSI_hook; +extern void set_psi_server(PSI *psi); +void my_init_mysys_psi_keys(void); #endif -#ifdef __NETWARE__ -void netware_reg_user(const char *ip, const char *user, - const char *application); -#endif + +struct st_mysql_file; +extern struct st_mysql_file *mysql_stdin; C_MODE_END -#include "raid.h" #endif /* _my_sys_h */ diff --git a/3rdparty/mysql/include/my_thread.h b/3rdparty/mysql/include/my_thread.h new file mode 100644 index 0000000000..fbdd164bad --- /dev/null +++ b/3rdparty/mysql/include/my_thread.h @@ -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 +#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 */ diff --git a/3rdparty/mysql/include/my_thread_local.h b/3rdparty/mysql/include/my_thread_local.h new file mode 100644 index 0000000000..fabd71a4c1 --- /dev/null +++ b/3rdparty/mysql/include/my_thread_local.h @@ -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 +#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 diff --git a/3rdparty/mysql/include/my_xml.h b/3rdparty/mysql/include/my_xml.h new file mode 100644 index 0000000000..639fdc7da4 --- /dev/null +++ b/3rdparty/mysql/include/my_xml.h @@ -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 */ diff --git a/3rdparty/mysql/include/mysql.h b/3rdparty/mysql/include/mysql.h index 925a452537..a3e59288cb 100644 --- a/3rdparty/mysql/include/mysql.h +++ b/3rdparty/mysql/include/mysql.h @@ -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 -#ifdef __LCC__ -#include /* 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 +#ifdef WIN32_LEAN_AND_MEAN +#include +#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 diff --git a/3rdparty/mysql/include/mysql/client_authentication.h b/3rdparty/mysql/include/mysql/client_authentication.h new file mode 100644 index 0000000000..894357934d --- /dev/null +++ b/3rdparty/mysql/include/mysql/client_authentication.h @@ -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 +#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 + diff --git a/3rdparty/mysql/include/mysql/client_plugin.h b/3rdparty/mysql/include/mysql/client_plugin.h new file mode 100644 index 0000000000..d6471dbcd0 --- /dev/null +++ b/3rdparty/mysql/include/mysql/client_plugin.h @@ -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 +#include +#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 + diff --git a/3rdparty/mysql/include/mysql/client_plugin.h.pp b/3rdparty/mysql/include/mysql/client_plugin.h.pp new file mode 100644 index 0000000000..47e760ad94 --- /dev/null +++ b/3rdparty/mysql/include/mysql/client_plugin.h.pp @@ -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); diff --git a/3rdparty/mysql/include/mysql/get_password.h b/3rdparty/mysql/include/mysql/get_password.h new file mode 100644 index 0000000000..a633c58c46 --- /dev/null +++ b/3rdparty/mysql/include/mysql/get_password.h @@ -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 */ diff --git a/3rdparty/mysql/include/mysql/mysql_lex_string.h b/3rdparty/mysql/include/mysql/mysql_lex_string.h new file mode 100644 index 0000000000..ce3b6e47d3 --- /dev/null +++ b/3rdparty/mysql/include/mysql/mysql_lex_string.h @@ -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 diff --git a/3rdparty/mysql/include/mysql/plugin_auth_common.h b/3rdparty/mysql/include/mysql/plugin_auth_common.h new file mode 100644 index 0000000000..a0033a09b5 --- /dev/null +++ b/3rdparty/mysql/include/mysql/plugin_auth_common.h @@ -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 +#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 + diff --git a/3rdparty/mysql/include/mysql/plugin_trace.h b/3rdparty/mysql/include/mysql/plugin_trace.h new file mode 100644 index 0000000000..71ac0b1070 --- /dev/null +++ b/3rdparty/mysql/include/mysql/plugin_trace.h @@ -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 + +#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 diff --git a/3rdparty/mysql/include/mysql/psi/mysql_file.h b/3rdparty/mysql/include/mysql/psi/mysql_file.h new file mode 100644 index 0000000000..fd28886d7b --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/mysql_file.h @@ -0,0 +1,1433 @@ +/* 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_FILE_H +#define MYSQL_FILE_H + +#include + +/* For strlen() */ +#include +/* For MY_STAT */ +#include +/* For my_chsize */ +#include + +/** + @file mysql/psi/mysql_file.h + Instrumentation helpers for mysys file io. + This header file provides the necessary declarations + to use the mysys file API with the performance schema instrumentation. + In some compilers (SunStudio), 'static inline' functions, when declared + but not used, are not optimized away (because they are unused) by default, + so that including a static inline function from a header file does + create unwanted dependencies, causing unresolved symbols at link time. + Other compilers, like gcc, optimize these dependencies by default. + + Since the instrumented APIs declared here are wrapper on top + of mysys file io APIs, including mysql/psi/mysql_file.h assumes that + the dependency on my_sys already exists. +*/ + +#include "mysql/psi/psi.h" + +#ifndef PSI_FILE_CALL +#define PSI_FILE_CALL(M) PSI_DYNAMIC_CALL(M) +#endif + +/** + @defgroup File_instrumentation File Instrumentation + @ingroup Instrumentation_interface + @{ +*/ + +/** + @def mysql_file_register(P1, P2, P3) + File registration. +*/ +#define mysql_file_register(P1, P2, P3) \ + inline_mysql_file_register(P1, P2, P3) + +/** + @def mysql_file_fgets(P1, P2, F) + Instrumented fgets. + @c mysql_file_fgets is a replacement for @c fgets. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_fgets(P1, P2, F) \ + inline_mysql_file_fgets(__FILE__, __LINE__, P1, P2, F) +#else + #define mysql_file_fgets(P1, P2, F) \ + inline_mysql_file_fgets(P1, P2, F) +#endif + +/** + @def mysql_file_fgetc(F) + Instrumented fgetc. + @c mysql_file_fgetc is a replacement for @c fgetc. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_fgetc(F) inline_mysql_file_fgetc(__FILE__, __LINE__, F) +#else + #define mysql_file_fgetc(F) inline_mysql_file_fgetc(F) +#endif + +/** + @def mysql_file_fputs(P1, F) + Instrumented fputs. + @c mysql_file_fputs is a replacement for @c fputs. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_fputs(P1, F) \ + inline_mysql_file_fputs(__FILE__, __LINE__, P1, F) +#else + #define mysql_file_fputs(P1, F)\ + inline_mysql_file_fputs(P1, F) +#endif + +/** + @def mysql_file_fputc(P1, F) + Instrumented fputc. + @c mysql_file_fputc is a replacement for @c fputc. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_fputc(P1, F) \ + inline_mysql_file_fputc(__FILE__, __LINE__, P1, F) +#else + #define mysql_file_fputc(P1, F) \ + inline_mysql_file_fputc(P1, F) +#endif + +/** + @def mysql_file_fprintf + Instrumented fprintf. + @c mysql_file_fprintf is a replacement for @c fprintf. +*/ +#define mysql_file_fprintf inline_mysql_file_fprintf + +/** + @def mysql_file_vfprintf(F, P1, P2) + Instrumented vfprintf. + @c mysql_file_vfprintf is a replacement for @c vfprintf. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_vfprintf(F, P1, P2) \ + inline_mysql_file_vfprintf(__FILE__, __LINE__, F, P1, P2) +#else + #define mysql_file_vfprintf(F, P1, P2) \ + inline_mysql_file_vfprintf(F, P1, P2) +#endif + +/** + @def mysql_file_fflush(F, P1, P2) + Instrumented fflush. + @c mysql_file_fflush is a replacement for @c fflush. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_fflush(F) \ + inline_mysql_file_fflush(__FILE__, __LINE__, F) +#else + #define mysql_file_fflush(F) \ + inline_mysql_file_fflush(F) +#endif + +/** + @def mysql_file_feof(F) + Instrumented feof. + @c mysql_file_feof is a replacement for @c feof. +*/ +#define mysql_file_feof(F) inline_mysql_file_feof(F) + +/** + @def mysql_file_fstat(FN, S, FL) + Instrumented fstat. + @c mysql_file_fstat is a replacement for @c my_fstat. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_fstat(FN, S, FL) \ + inline_mysql_file_fstat(__FILE__, __LINE__, FN, S, FL) +#else + #define mysql_file_fstat(FN, S, FL) \ + inline_mysql_file_fstat(FN, S, FL) +#endif + +/** + @def mysql_file_stat(K, FN, S, FL) + Instrumented stat. + @c mysql_file_stat is a replacement for @c my_stat. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_stat(K, FN, S, FL) \ + inline_mysql_file_stat(K, __FILE__, __LINE__, FN, S, FL) +#else + #define mysql_file_stat(K, FN, S, FL) \ + inline_mysql_file_stat(FN, S, FL) +#endif + +/** + @def mysql_file_chsize(F, P1, P2, P3) + Instrumented chsize. + @c mysql_file_chsize is a replacement for @c my_chsize. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_chsize(F, P1, P2, P3) \ + inline_mysql_file_chsize(__FILE__, __LINE__, F, P1, P2, P3) +#else + #define mysql_file_chsize(F, P1, P2, P3) \ + inline_mysql_file_chsize(F, P1, P2, P3) +#endif + +/** + @def mysql_file_fopen(K, N, F1, F2) + Instrumented fopen. + @c mysql_file_fopen is a replacement for @c my_fopen. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_fopen(K, N, F1, F2) \ + inline_mysql_file_fopen(K, __FILE__, __LINE__, N, F1, F2) +#else + #define mysql_file_fopen(K, N, F1, F2) \ + inline_mysql_file_fopen(N, F1, F2) +#endif + +/** + @def mysql_file_fclose(FD, FL) + Instrumented fclose. + @c mysql_file_fclose is a replacement for @c my_fclose. + Without the instrumentation, this call will have the same behavior as the + undocumented and possibly platform specific my_fclose(NULL, ...) behavior. + With the instrumentation, mysql_fclose(NULL, ...) will safely return 0, + which is an extension compared to my_fclose and is therefore compliant. + mysql_fclose is on purpose *not* implementing + @code DBUG_ASSERT(file != NULL) @endcode, + since doing so could introduce regressions. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_fclose(FD, FL) \ + inline_mysql_file_fclose(__FILE__, __LINE__, FD, FL) +#else + #define mysql_file_fclose(FD, FL) \ + inline_mysql_file_fclose(FD, FL) +#endif + +/** + @def mysql_file_fread(FD, P1, P2, P3) + Instrumented fread. + @c mysql_file_fread is a replacement for @c my_fread. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_fread(FD, P1, P2, P3) \ + inline_mysql_file_fread(__FILE__, __LINE__, FD, P1, P2, P3) +#else + #define mysql_file_fread(FD, P1, P2, P3) \ + inline_mysql_file_fread(FD, P1, P2, P3) +#endif + +/** + @def mysql_file_fwrite(FD, P1, P2, P3) + Instrumented fwrite. + @c mysql_file_fwrite is a replacement for @c my_fwrite. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_fwrite(FD, P1, P2, P3) \ + inline_mysql_file_fwrite(__FILE__, __LINE__, FD, P1, P2, P3) +#else + #define mysql_file_fwrite(FD, P1, P2, P3) \ + inline_mysql_file_fwrite(FD, P1, P2, P3) +#endif + +/** + @def mysql_file_fseek(FD, P, W, F) + Instrumented fseek. + @c mysql_file_fseek is a replacement for @c my_fseek. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_fseek(FD, P, W, F) \ + inline_mysql_file_fseek(__FILE__, __LINE__, FD, P, W, F) +#else + #define mysql_file_fseek(FD, P, W, F) \ + inline_mysql_file_fseek(FD, P, W, F) +#endif + +/** + @def mysql_file_ftell(FD, F) + Instrumented ftell. + @c mysql_file_ftell is a replacement for @c my_ftell. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_ftell(FD, F) \ + inline_mysql_file_ftell(__FILE__, __LINE__, FD, F) +#else + #define mysql_file_ftell(FD, F) \ + inline_mysql_file_ftell(FD, F) +#endif + +/** + @def mysql_file_create(K, N, F1, F2, F3) + Instrumented create. + @c mysql_file_create is a replacement for @c my_create. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_create(K, N, F1, F2, F3) \ + inline_mysql_file_create(K, __FILE__, __LINE__, N, F1, F2, F3) +#else + #define mysql_file_create(K, N, F1, F2, F3) \ + inline_mysql_file_create(N, F1, F2, F3) +#endif + +/** + @def mysql_file_create_temp(K, T, D, P, M, F) + Instrumented create_temp_file. + @c mysql_file_create_temp is a replacement for @c create_temp_file. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_create_temp(K, T, D, P, M, F) \ + inline_mysql_file_create_temp(K, __FILE__, __LINE__, T, D, P, M, F) +#else + #define mysql_file_create_temp(K, T, D, P, M, F) \ + inline_mysql_file_create_temp(T, D, P, M, F) +#endif + +/** + @def mysql_file_open(K, N, F1, F2) + Instrumented open. + @c mysql_file_open is a replacement for @c my_open. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_open(K, N, F1, F2) \ + inline_mysql_file_open(K, __FILE__, __LINE__, N, F1, F2) +#else + #define mysql_file_open(K, N, F1, F2) \ + inline_mysql_file_open(N, F1, F2) +#endif + +/** + @def mysql_file_close(FD, F) + Instrumented close. + @c mysql_file_close is a replacement for @c my_close. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_close(FD, F) \ + inline_mysql_file_close(__FILE__, __LINE__, FD, F) +#else + #define mysql_file_close(FD, F) \ + inline_mysql_file_close(FD, F) +#endif + +/** + @def mysql_file_read(FD, B, S, F) + Instrumented read. + @c mysql_read is a replacement for @c my_read. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_read(FD, B, S, F) \ + inline_mysql_file_read(__FILE__, __LINE__, FD, B, S, F) +#else + #define mysql_file_read(FD, B, S, F) \ + inline_mysql_file_read(FD, B, S, F) +#endif + +/** + @def mysql_file_write(FD, B, S, F) + Instrumented write. + @c mysql_file_write is a replacement for @c my_write. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_write(FD, B, S, F) \ + inline_mysql_file_write(__FILE__, __LINE__, FD, B, S, F) +#else + #define mysql_file_write(FD, B, S, F) \ + inline_mysql_file_write(FD, B, S, F) +#endif + +/** + @def mysql_file_pread(FD, B, S, O, F) + Instrumented pread. + @c mysql_pread is a replacement for @c my_pread. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_pread(FD, B, S, O, F) \ + inline_mysql_file_pread(__FILE__, __LINE__, FD, B, S, O, F) +#else + #define mysql_file_pread(FD, B, S, O, F) \ + inline_mysql_file_pread(FD, B, S, O, F) +#endif + +/** + @def mysql_file_pwrite(FD, B, S, O, F) + Instrumented pwrite. + @c mysql_file_pwrite is a replacement for @c my_pwrite. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_pwrite(FD, B, S, O, F) \ + inline_mysql_file_pwrite(__FILE__, __LINE__, FD, B, S, O, F) +#else + #define mysql_file_pwrite(FD, B, S, O, F) \ + inline_mysql_file_pwrite(FD, B, S, O, F) +#endif + +/** + @def mysql_file_seek(FD, P, W, F) + Instrumented seek. + @c mysql_file_seek is a replacement for @c my_seek. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_seek(FD, P, W, F) \ + inline_mysql_file_seek(__FILE__, __LINE__, FD, P, W, F) +#else + #define mysql_file_seek(FD, P, W, F) \ + inline_mysql_file_seek(FD, P, W, F) +#endif + +/** + @def mysql_file_tell(FD, F) + Instrumented tell. + @c mysql_file_tell is a replacement for @c my_tell. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_tell(FD, F) \ + inline_mysql_file_tell(__FILE__, __LINE__, FD, F) +#else + #define mysql_file_tell(FD, F) \ + inline_mysql_file_tell(FD, F) +#endif + +/** + @def mysql_file_delete(K, P1, P2) + Instrumented delete. + @c mysql_file_delete is a replacement for @c my_delete. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_delete(K, P1, P2) \ + inline_mysql_file_delete(K, __FILE__, __LINE__, P1, P2) +#else + #define mysql_file_delete(K, P1, P2) \ + inline_mysql_file_delete(P1, P2) +#endif + +/** + @def mysql_file_rename(K, P1, P2, P3) + Instrumented rename. + @c mysql_file_rename is a replacement for @c my_rename. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_rename(K, P1, P2, P3) \ + inline_mysql_file_rename(K, __FILE__, __LINE__, P1, P2, P3) +#else + #define mysql_file_rename(K, P1, P2, P3) \ + inline_mysql_file_rename(P1, P2, P3) +#endif + +/** + @def mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) + Instrumented create with symbolic link. + @c mysql_file_create_with_symlink is a replacement + for @c my_create_with_symlink. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) \ + inline_mysql_file_create_with_symlink(K, __FILE__, __LINE__, \ + P1, P2, P3, P4, P5) +#else + #define mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) \ + inline_mysql_file_create_with_symlink(P1, P2, P3, P4, P5) +#endif + +/** + @def mysql_file_delete_with_symlink(K, P1, P2) + Instrumented delete with symbolic link. + @c mysql_file_delete_with_symlink is a replacement + for @c my_delete_with_symlink. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_delete_with_symlink(K, P1, P2) \ + inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2) +#else + #define mysql_file_delete_with_symlink(K, P1, P2) \ + inline_mysql_file_delete_with_symlink(P1, P2) +#endif + +/** + @def mysql_file_rename_with_symlink(K, P1, P2, P3) + Instrumented rename with symbolic link. + @c mysql_file_rename_with_symlink is a replacement + for @c my_rename_with_symlink. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_rename_with_symlink(K, P1, P2, P3) \ + inline_mysql_file_rename_with_symlink(K, __FILE__, __LINE__, P1, P2, P3) +#else + #define mysql_file_rename_with_symlink(K, P1, P2, P3) \ + inline_mysql_file_rename_with_symlink(P1, P2, P3) +#endif + +/** + @def mysql_file_sync(P1, P2) + Instrumented file sync. + @c mysql_file_sync is a replacement for @c my_sync. +*/ +#ifdef HAVE_PSI_FILE_INTERFACE + #define mysql_file_sync(P1, P2) \ + inline_mysql_file_sync(__FILE__, __LINE__, P1, P2) +#else + #define mysql_file_sync(P1, P2) \ + inline_mysql_file_sync(P1, P2) +#endif + +/** + An instrumented FILE structure. + @sa MYSQL_FILE +*/ +struct st_mysql_file +{ + /** The real file. */ + FILE *m_file; + /** + The instrumentation hook. + Note that this hook is not conditionally defined, + for binary compatibility of the @c MYSQL_FILE interface. + */ + struct PSI_file *m_psi; +}; + +/** + Type of an instrumented file. + @c MYSQL_FILE is a drop-in replacement for @c FILE. + @sa mysql_file_open +*/ +typedef struct st_mysql_file MYSQL_FILE; + +static inline void inline_mysql_file_register( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *category, + PSI_file_info *info, + int count +#else + const char *category MY_ATTRIBUTE ((unused)), + void *info MY_ATTRIBUTE ((unused)), + int count MY_ATTRIBUTE ((unused)) +#endif +) +{ +#ifdef HAVE_PSI_FILE_INTERFACE + PSI_FILE_CALL(register_file)(category, info, count); +#endif +} + +static inline char * +inline_mysql_file_fgets( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + char *str, int size, MYSQL_FILE *file) +{ + char *result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_stream_locker) + (&state, file->m_psi, PSI_FILE_READ); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) size, src_file, src_line); + result= fgets(str, size, file->m_file); + PSI_FILE_CALL(end_file_wait)(locker, result ? strlen(result) : 0); + return result; + } +#endif + + result= fgets(str, size, file->m_file); + return result; +} + +static inline int +inline_mysql_file_fgetc( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_FILE *file) +{ + int result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_stream_locker) + (&state, file->m_psi, PSI_FILE_READ); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line); + result= fgetc(file->m_file); + PSI_FILE_CALL(end_file_wait)(locker, (size_t) 1); + return result; + } +#endif + + result= fgetc(file->m_file); + return result; +} + +static inline int +inline_mysql_file_fputs( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + const char *str, MYSQL_FILE *file) +{ + int result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + size_t bytes; + locker= PSI_FILE_CALL(get_thread_file_stream_locker) + (&state, file->m_psi, PSI_FILE_WRITE); + if (likely(locker != NULL)) + { + bytes= str ? strlen(str) : 0; + PSI_FILE_CALL(start_file_wait)(locker, bytes, src_file, src_line); + result= fputs(str, file->m_file); + PSI_FILE_CALL(end_file_wait)(locker, bytes); + return result; + } +#endif + + result= fputs(str, file->m_file); + return result; +} + +static inline int +inline_mysql_file_fputc( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + char c, MYSQL_FILE *file) +{ + int result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_stream_locker) + (&state, file->m_psi, PSI_FILE_WRITE); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line); + result= fputc(c, file->m_file); + PSI_FILE_CALL(end_file_wait)(locker, (size_t) 1); + return result; + } +#endif + + result= fputc(c, file->m_file); + return result; +} + +static inline int +inline_mysql_file_fprintf(MYSQL_FILE *file, const char *format, ...) +{ + /* + TODO: figure out how to pass src_file and src_line from the caller. + */ + int result; + va_list args; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_stream_locker) + (&state, file->m_psi, PSI_FILE_WRITE); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, __FILE__, __LINE__); + va_start(args, format); + result= vfprintf(file->m_file, format, args); + va_end(args); + PSI_FILE_CALL(end_file_wait)(locker, (size_t) result); + return result; + } +#endif + + va_start(args, format); + result= vfprintf(file->m_file, format, args); + va_end(args); + return result; +} + +static inline int +inline_mysql_file_vfprintf( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_FILE *file, const char *format, va_list args) +{ + int result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_stream_locker) + (&state, file->m_psi, PSI_FILE_WRITE); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); + result= vfprintf(file->m_file, format, args); + PSI_FILE_CALL(end_file_wait)(locker, (size_t) result); + return result; + } +#endif + + result= vfprintf(file->m_file, format, args); + return result; +} + +static inline int +inline_mysql_file_fflush( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_FILE *file) +{ + int result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_stream_locker) + (&state, file->m_psi, PSI_FILE_FLUSH); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); + result= fflush(file->m_file); + PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); + return result; + } +#endif + + result= fflush(file->m_file); + return result; +} + +static inline int inline_mysql_file_feof(MYSQL_FILE *file) +{ + /* Not instrumented, there is no wait involved */ + return feof(file->m_file); +} + +static inline int +inline_mysql_file_fstat( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + int filenr, MY_STAT *stat_area, myf flags) +{ + int result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) + (&state, filenr, PSI_FILE_FSTAT); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); + result= my_fstat(filenr, stat_area, flags); + PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); + return result; + } +#endif + + result= my_fstat(filenr, stat_area, flags); + return result; +} + +static inline MY_STAT * +inline_mysql_file_stat( +#ifdef HAVE_PSI_FILE_INTERFACE + PSI_file_key key, const char *src_file, uint src_line, +#endif + const char *path, MY_STAT *stat_area, myf flags) +{ + MY_STAT *result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_name_locker) + (&state, key, PSI_FILE_STAT, path, &locker); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); + result= my_stat(path, stat_area, flags); + PSI_FILE_CALL(end_file_open_wait)(locker, result); + return result; + } +#endif + + result= my_stat(path, stat_area, flags); + return result; +} + +static inline int +inline_mysql_file_chsize( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + File file, my_off_t newlength, int filler, myf flags) +{ + int result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) + (&state, file, PSI_FILE_CHSIZE); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) newlength, src_file, + src_line); + result= my_chsize(file, newlength, filler, flags); + PSI_FILE_CALL(end_file_wait)(locker, (size_t) newlength); + return result; + } +#endif + + result= my_chsize(file, newlength, filler, flags); + return result; +} + +static inline MYSQL_FILE* +inline_mysql_file_fopen( +#ifdef HAVE_PSI_FILE_INTERFACE + PSI_file_key key, const char *src_file, uint src_line, +#endif + const char *filename, int flags, myf myFlags) +{ + MYSQL_FILE *that; + that= (MYSQL_FILE*) my_malloc(PSI_NOT_INSTRUMENTED, + sizeof(MYSQL_FILE), MYF(MY_WME)); + if (likely(that != NULL)) + { +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_name_locker) + (&state, key, PSI_FILE_STREAM_OPEN, filename, that); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_open_wait) + (locker, src_file, src_line); + that->m_file= my_fopen(filename, flags, myFlags); + that->m_psi= PSI_FILE_CALL(end_file_open_wait)(locker, that->m_file); + if (unlikely(that->m_file == NULL)) + { + my_free(that); + return NULL; + } + return that; + } +#endif + + that->m_psi= NULL; + that->m_file= my_fopen(filename, flags, myFlags); + if (unlikely(that->m_file == NULL)) + { + my_free(that); + return NULL; + } + } + return that; +} + +static inline int +inline_mysql_file_fclose( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_FILE *file, myf flags) +{ + int result= 0; + if (likely(file != NULL)) + { +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_stream_locker) + (&state, file->m_psi, PSI_FILE_STREAM_CLOSE); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line); + result= my_fclose(file->m_file, flags); + PSI_FILE_CALL(end_file_close_wait)(locker, result); + my_free(file); + return result; + } +#endif + + result= my_fclose(file->m_file, flags); + my_free(file); + } + return result; +} + +static inline size_t +inline_mysql_file_fread( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_FILE *file, uchar *buffer, size_t count, myf flags) +{ + size_t result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + size_t bytes_read; + locker= PSI_FILE_CALL(get_thread_file_stream_locker) + (&state, file->m_psi, PSI_FILE_READ); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); + result= my_fread(file->m_file, buffer, count, flags); + if (flags & (MY_NABP | MY_FNABP)) + bytes_read= (result == 0) ? count : 0; + else + bytes_read= (result != MY_FILE_ERROR) ? result : 0; + PSI_FILE_CALL(end_file_wait)(locker, bytes_read); + return result; + } +#endif + + result= my_fread(file->m_file, buffer, count, flags); + return result; +} + +static inline size_t +inline_mysql_file_fwrite( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_FILE *file, const uchar *buffer, size_t count, myf flags) +{ + size_t result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + size_t bytes_written; + locker= PSI_FILE_CALL(get_thread_file_stream_locker) + (&state, file->m_psi, PSI_FILE_WRITE); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); + result= my_fwrite(file->m_file, buffer, count, flags); + if (flags & (MY_NABP | MY_FNABP)) + bytes_written= (result == 0) ? count : 0; + else + bytes_written= (result != MY_FILE_ERROR) ? result : 0; + PSI_FILE_CALL(end_file_wait)(locker, bytes_written); + return result; + } +#endif + + result= my_fwrite(file->m_file, buffer, count, flags); + return result; +} + +static inline my_off_t +inline_mysql_file_fseek( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_FILE *file, my_off_t pos, int whence, myf flags) +{ + my_off_t result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_stream_locker) + (&state, file->m_psi, PSI_FILE_SEEK); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); + result= my_fseek(file->m_file, pos, whence, flags); + PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); + return result; + } +#endif + + result= my_fseek(file->m_file, pos, whence, flags); + return result; +} + +static inline my_off_t +inline_mysql_file_ftell( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_FILE *file, myf flags) +{ + my_off_t result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_stream_locker) + (&state, file->m_psi, PSI_FILE_TELL); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); + result= my_ftell(file->m_file, flags); + PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); + return result; + } +#endif + + result= my_ftell(file->m_file, flags); + return result; +} + +static inline File +inline_mysql_file_create( +#ifdef HAVE_PSI_FILE_INTERFACE + PSI_file_key key, const char *src_file, uint src_line, +#endif + const char *filename, int create_flags, int access_flags, myf myFlags) +{ + File file; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_name_locker) + (&state, key, PSI_FILE_CREATE, filename, &locker); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); + file= my_create(filename, create_flags, access_flags, myFlags); + PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file); + return file; + } +#endif + + file= my_create(filename, create_flags, access_flags, myFlags); + return file; +} + +static inline File +inline_mysql_file_create_temp( +#ifdef HAVE_PSI_FILE_INTERFACE + PSI_file_key key, const char *src_file, uint src_line, +#endif + char *to, const char *dir, const char *pfx, int mode, myf myFlags) +{ + File file; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_name_locker) + (&state, key, PSI_FILE_CREATE, NULL, &locker); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); + /* The file name is generated by create_temp_file(). */ + file= create_temp_file(to, dir, pfx, mode, myFlags); + PSI_FILE_CALL(end_temp_file_open_wait_and_bind_to_descriptor)(locker, file, (const char*)to); + return file; + } +#endif + + file= create_temp_file(to, dir, pfx, mode, myFlags); + return file; +} + +static inline File +inline_mysql_file_open( +#ifdef HAVE_PSI_FILE_INTERFACE + PSI_file_key key, const char *src_file, uint src_line, +#endif + const char *filename, int flags, myf myFlags) +{ + File file; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_name_locker) + (&state, key, PSI_FILE_OPEN, filename, &locker); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); + file= my_open(filename, flags, myFlags); + PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file); + return file; + } +#endif + + file= my_open(filename, flags, myFlags); + return file; +} + +static inline int +inline_mysql_file_close( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + File file, myf flags) +{ + int result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) + (&state, file, PSI_FILE_CLOSE); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line); + result= my_close(file, flags); + PSI_FILE_CALL(end_file_close_wait)(locker, result); + return result; + } +#endif + + result= my_close(file, flags); + return result; +} + +static inline size_t +inline_mysql_file_read( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + File file, uchar *buffer, size_t count, myf flags) +{ + size_t result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + size_t bytes_read; + locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) + (&state, file, PSI_FILE_READ); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); + result= my_read(file, buffer, count, flags); + if (flags & (MY_NABP | MY_FNABP)) + bytes_read= (result == 0) ? count : 0; + else + bytes_read= (result != MY_FILE_ERROR) ? result : 0; + PSI_FILE_CALL(end_file_wait)(locker, bytes_read); + return result; + } +#endif + + result= my_read(file, buffer, count, flags); + return result; +} + +static inline size_t +inline_mysql_file_write( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + File file, const uchar *buffer, size_t count, myf flags) +{ + size_t result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + size_t bytes_written; + locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) + (&state, file, PSI_FILE_WRITE); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); + result= my_write(file, buffer, count, flags); + if (flags & (MY_NABP | MY_FNABP)) + bytes_written= (result == 0) ? count : 0; + else + bytes_written= (result != MY_FILE_ERROR) ? result : 0; + PSI_FILE_CALL(end_file_wait)(locker, bytes_written); + return result; + } +#endif + + result= my_write(file, buffer, count, flags); + return result; +} + +static inline size_t +inline_mysql_file_pread( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + File file, uchar *buffer, size_t count, my_off_t offset, myf flags) +{ + size_t result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + size_t bytes_read; + locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) + (&state, file, PSI_FILE_READ); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); + result= my_pread(file, buffer, count, offset, flags); + if (flags & (MY_NABP | MY_FNABP)) + bytes_read= (result == 0) ? count : 0; + else + bytes_read= (result != MY_FILE_ERROR) ? result : 0; + PSI_FILE_CALL(end_file_wait)(locker, bytes_read); + return result; + } +#endif + + result= my_pread(file, buffer, count, offset, flags); + return result; +} + +static inline size_t +inline_mysql_file_pwrite( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + File file, const uchar *buffer, size_t count, my_off_t offset, myf flags) +{ + size_t result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + size_t bytes_written; + locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) + (&state, file, PSI_FILE_WRITE); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line); + result= my_pwrite(file, buffer, count, offset, flags); + if (flags & (MY_NABP | MY_FNABP)) + bytes_written= (result == 0) ? count : 0; + else + bytes_written= (result != MY_FILE_ERROR) ? result : 0; + PSI_FILE_CALL(end_file_wait)(locker, bytes_written); + return result; + } +#endif + + result= my_pwrite(file, buffer, count, offset, flags); + return result; +} + +static inline my_off_t +inline_mysql_file_seek( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + File file, my_off_t pos, int whence, myf flags) +{ + my_off_t result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) + (&state, file, PSI_FILE_SEEK); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); + result= my_seek(file, pos, whence, flags); + PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); + return result; + } +#endif + + result= my_seek(file, pos, whence, flags); + return result; +} + +static inline my_off_t +inline_mysql_file_tell( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + File file, myf flags) +{ + my_off_t result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) + (&state, file, PSI_FILE_TELL); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); + result= my_tell(file, flags); + PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); + return result; + } +#endif + + result= my_tell(file, flags); + return result; +} + +static inline int +inline_mysql_file_delete( +#ifdef HAVE_PSI_FILE_INTERFACE + PSI_file_key key, const char *src_file, uint src_line, +#endif + const char *name, myf flags) +{ + int result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_name_locker) + (&state, key, PSI_FILE_DELETE, name, &locker); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line); + result= my_delete(name, flags); + PSI_FILE_CALL(end_file_close_wait)(locker, result); + return result; + } +#endif + + result= my_delete(name, flags); + return result; +} + +static inline int +inline_mysql_file_rename( +#ifdef HAVE_PSI_FILE_INTERFACE + PSI_file_key key, const char *src_file, uint src_line, +#endif + const char *from, const char *to, myf flags) +{ + int result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_name_locker) + (&state, key, PSI_FILE_RENAME, to, &locker); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); + result= my_rename(from, to, flags); + PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); + return result; + } +#endif + + result= my_rename(from, to, flags); + return result; +} + +static inline File +inline_mysql_file_create_with_symlink( +#ifdef HAVE_PSI_FILE_INTERFACE + PSI_file_key key, const char *src_file, uint src_line, +#endif + const char *linkname, const char *filename, int create_flags, + int access_flags, myf flags) +{ + File file; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_name_locker) + (&state, key, PSI_FILE_CREATE, filename, &locker); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line); + file= my_create_with_symlink(linkname, filename, create_flags, access_flags, + flags); + PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file); + return file; + } +#endif + + file= my_create_with_symlink(linkname, filename, create_flags, access_flags, + flags); + return file; +} + +static inline int +inline_mysql_file_delete_with_symlink( +#ifdef HAVE_PSI_FILE_INTERFACE + PSI_file_key key, const char *src_file, uint src_line, +#endif + const char *name, myf flags) +{ + int result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_name_locker) + (&state, key, PSI_FILE_DELETE, name, &locker); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line); + result= my_delete_with_symlink(name, flags); + PSI_FILE_CALL(end_file_close_wait)(locker, result); + return result; + } +#endif + + result= my_delete_with_symlink(name, flags); + return result; +} + +static inline int +inline_mysql_file_rename_with_symlink( +#ifdef HAVE_PSI_FILE_INTERFACE + PSI_file_key key, const char *src_file, uint src_line, +#endif + const char *from, const char *to, myf flags) +{ + int result; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_name_locker) + (&state, key, PSI_FILE_RENAME, to, &locker); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); + result= my_rename_with_symlink(from, to, flags); + PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); + return result; + } +#endif + + result= my_rename_with_symlink(from, to, flags); + return result; +} + +static inline int +inline_mysql_file_sync( +#ifdef HAVE_PSI_FILE_INTERFACE + const char *src_file, uint src_line, +#endif + File fd, myf flags) +{ + int result= 0; +#ifdef HAVE_PSI_FILE_INTERFACE + struct PSI_file_locker *locker; + PSI_file_locker_state state; + locker= PSI_FILE_CALL(get_thread_file_descriptor_locker) + (&state, fd, PSI_FILE_SYNC); + if (likely(locker != NULL)) + { + PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line); + result= my_sync(fd, flags); + PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0); + return result; + } +#endif + + result= my_sync(fd, flags); + return result; +} + +/** @} (end of group File_instrumentation) */ + +#endif + diff --git a/3rdparty/mysql/include/mysql/psi/mysql_idle.h b/3rdparty/mysql/include/mysql/psi/mysql_idle.h new file mode 100644 index 0000000000..102304aa33 --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/mysql_idle.h @@ -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 + diff --git a/3rdparty/mysql/include/mysql/psi/mysql_mdl.h b/3rdparty/mysql/include/mysql/psi/mysql_mdl.h new file mode 100644 index 0000000000..bb2b76c151 --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/mysql_mdl.h @@ -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 (mdl_type), + static_cast (mdl_duration), + static_cast (mdl_status), + src_file, src_line); + + return result; +} + +static inline void inline_mysql_mdl_set_status( + PSI_metadata_lock *psi, + MDL_ticket::enum_psi_status mdl_status) +{ + if (psi != NULL) + PSI_METADATA_CALL(set_metadata_lock_status)(psi, mdl_status); +} + +static inline void inline_mysql_mdl_destroy( + PSI_metadata_lock *psi, + const char *src_file, uint src_line) +{ + if (psi != NULL) + PSI_METADATA_CALL(destroy_metadata_lock)(psi); +} +#endif /* HAVE_PSI_METADATA_INTERFACE */ + +/** @} (end of group Metadata_instrumentation) */ + +#endif + diff --git a/3rdparty/mysql/include/mysql/psi/mysql_memory.h b/3rdparty/mysql/include/mysql/psi/mysql_memory.h new file mode 100644 index 0000000000..55dd8184b1 --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/mysql_memory.h @@ -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 + diff --git a/3rdparty/mysql/include/mysql/psi/mysql_ps.h b/3rdparty/mysql/include/mysql/psi/mysql_ps.h new file mode 100644 index 0000000000..485e1fbedf --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/mysql_ps.h @@ -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 diff --git a/3rdparty/mysql/include/mysql/psi/mysql_socket.h b/3rdparty/mysql/include/mysql/psi/mysql_socket.h new file mode 100644 index 0000000000..ad76e318b3 --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/mysql_socket.h @@ -0,0 +1,1255 @@ +/* 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 +*/ + +#ifndef MYSQL_SOCKET_H +#define MYSQL_SOCKET_H + +/* For strlen() */ +#include +/* For MY_STAT */ +#include +/* For my_chsize */ +#include +/* For socket api */ +#ifdef _WIN32 + #include + #include + #include + #define SOCKBUF_T char +#else + #include + #define SOCKBUF_T void +#endif +/** + @file mysql/psi/mysql_socket.h +[...] +*/ + +#include "mysql/psi/psi.h" + +#ifndef PSI_SOCKET_CALL +#define PSI_SOCKET_CALL(M) PSI_DYNAMIC_CALL(M) +#endif + +/** + @defgroup Socket_instrumentation Socket Instrumentation + @ingroup Instrumentation_interface + @{ +*/ + +/** + @def mysql_socket_register(P1, P2, P3) + Socket registration. +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_register(P1, P2, P3) \ + inline_mysql_socket_register(P1, P2, P3) +#else + #define mysql_socket_register(P1, P2, P3) \ + do {} while (0) +#endif + +/** An instrumented socket. */ +struct st_mysql_socket +{ + /** The real socket descriptor. */ + my_socket fd; + + /** + The instrumentation hook. + Note that this hook is not conditionally defined, + for binary compatibility of the @c MYSQL_SOCKET interface. + */ + struct PSI_socket *m_psi; +}; + +/** + An instrumented socket. + @c MYSQL_SOCKET is a replacement for @c my_socket. +*/ +typedef struct st_mysql_socket MYSQL_SOCKET; + + +/** + @def MYSQL_INVALID_SOCKET + MYSQL_SOCKET initial value. +*/ +//MYSQL_SOCKET MYSQL_INVALID_SOCKET= {INVALID_SOCKET, NULL}; +#define MYSQL_INVALID_SOCKET mysql_socket_invalid() + +/** + MYSQL_SOCKET helper. Initialize instrumented socket. + @sa mysql_socket_getfd + @sa mysql_socket_setfd +*/ +static inline MYSQL_SOCKET +mysql_socket_invalid() +{ + MYSQL_SOCKET mysql_socket= {INVALID_SOCKET, NULL}; + return mysql_socket; +} + +/** + Set socket descriptor and address. + @param socket nstrumented socket + @param addr unformatted socket address + @param addr_len length of socket addres +*/ + +static inline void +mysql_socket_set_address( +#ifdef HAVE_PSI_SOCKET_INTERFACE + MYSQL_SOCKET socket, + const struct sockaddr *addr, + socklen_t addr_len +#else + MYSQL_SOCKET socket MY_ATTRIBUTE ((unused)), + const struct sockaddr *addr MY_ATTRIBUTE ((unused)), + socklen_t addr_len MY_ATTRIBUTE ((unused)) +#endif +) +{ +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (socket.m_psi != NULL) + PSI_SOCKET_CALL(set_socket_info)(socket.m_psi, NULL, addr, addr_len); +#endif +} + +/** + Set socket descriptor and address. + @param socket instrumented socket +*/ +static inline void +mysql_socket_set_thread_owner( +#ifdef HAVE_PSI_SOCKET_INTERFACE +MYSQL_SOCKET socket +#else +MYSQL_SOCKET socket MY_ATTRIBUTE ((unused)) +#endif +) +{ +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (socket.m_psi != NULL) + PSI_SOCKET_CALL(set_socket_thread_owner)(socket.m_psi); +#endif +} + +/** + MYSQL_SOCKET helper. Get socket descriptor. + @param mysql_socket Instrumented socket + @sa mysql_socket_setfd +*/ +static inline my_socket +mysql_socket_getfd(MYSQL_SOCKET mysql_socket) +{ + return mysql_socket.fd; +} + +/** + MYSQL_SOCKET helper. Set socket descriptor. + @param mysql_socket Instrumented socket + @param fd Socket descriptor + @sa mysql_socket_getfd +*/ +static inline void +mysql_socket_setfd(MYSQL_SOCKET *mysql_socket, my_socket fd) +{ + if (likely(mysql_socket != NULL)) + mysql_socket->fd= fd; +} + +/** + @def MYSQL_SOCKET_WAIT_VARIABLES + Instrumentation helper for socket waits. + This instrumentation declares local variables. + Do not use a ';' after this macro + @param LOCKER locker + @param STATE locker state + @sa MYSQL_START_SOCKET_WAIT. + @sa MYSQL_END_SOCKET_WAIT. +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define MYSQL_SOCKET_WAIT_VARIABLES(LOCKER, STATE) \ + struct PSI_socket_locker* LOCKER; \ + PSI_socket_locker_state STATE; +#else + #define MYSQL_SOCKET_WAIT_VARIABLES(LOCKER, STATE) +#endif + +/** + @def MYSQL_START_SOCKET_WAIT + Instrumentation helper for socket waits. + This instrumentation marks the start of a wait event. + @param LOCKER locker + @param STATE locker state + @param SOCKET instrumented socket + @param OP The socket operation to be performed + @param COUNT bytes to be written/read + @sa MYSQL_END_SOCKET_WAIT. +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define MYSQL_START_SOCKET_WAIT(LOCKER, STATE, SOCKET, OP, COUNT) \ + LOCKER= inline_mysql_start_socket_wait(STATE, SOCKET, OP, COUNT,\ + __FILE__, __LINE__) +#else + #define MYSQL_START_SOCKET_WAIT(LOCKER, STATE, SOCKET, OP, COUNT) \ + do {} while (0) +#endif + +/** + @def MYSQL_END_SOCKET_WAIT + Instrumentation helper for socket waits. + This instrumentation marks the end of a wait event. + @param LOCKER locker + @param COUNT actual bytes written/read, or -1 + @sa MYSQL_START_SOCKET_WAIT. +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define MYSQL_END_SOCKET_WAIT(LOCKER, COUNT) \ + inline_mysql_end_socket_wait(LOCKER, COUNT) +#else + #define MYSQL_END_SOCKET_WAIT(LOCKER, COUNT) \ + do {} while (0) +#endif + +/** + @def MYSQL_SOCKET_SET_STATE + Set the state (IDLE, ACTIVE) of an instrumented socket. + @param SOCKET the instrumented socket + @param STATE the new state + @sa PSI_socket_state +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define MYSQL_SOCKET_SET_STATE(SOCKET, STATE) \ + inline_mysql_socket_set_state(SOCKET, STATE) +#else + #define MYSQL_SOCKET_SET_STATE(SOCKET, STATE) \ + do {} while (0) +#endif + +#ifdef HAVE_PSI_SOCKET_INTERFACE +/** + Instrumentation calls for MYSQL_START_SOCKET_WAIT. + @sa MYSQL_START_SOCKET_WAIT. +*/ +static inline struct PSI_socket_locker* +inline_mysql_start_socket_wait(PSI_socket_locker_state *state, + MYSQL_SOCKET mysql_socket, + enum PSI_socket_operation op, + size_t byte_count, + const char *src_file, int src_line) +{ + struct PSI_socket_locker *locker; + if (mysql_socket.m_psi != NULL) + { + locker= PSI_SOCKET_CALL(start_socket_wait) + (state, mysql_socket.m_psi, op, byte_count, src_file, src_line); + } + else + locker= NULL; + return locker; +} + +/** + Instrumentation calls for MYSQL_END_SOCKET_WAIT. + @sa MYSQL_END_SOCKET_WAIT. +*/ +static inline void +inline_mysql_end_socket_wait(struct PSI_socket_locker *locker, size_t byte_count) +{ + if (locker != NULL) + PSI_SOCKET_CALL(end_socket_wait)(locker, byte_count); +} + +/** + Set the state (IDLE, ACTIVE) of an instrumented socket. + @param socket the instrumented socket + @param state the new state + @sa PSI_socket_state +*/ +static inline void +inline_mysql_socket_set_state(MYSQL_SOCKET socket, enum PSI_socket_state state) +{ + if (socket.m_psi != NULL) + PSI_SOCKET_CALL(set_socket_state)(socket.m_psi, state); +} +#endif /* HAVE_PSI_SOCKET_INTERFACE */ + +/** + @def mysql_socket_socket(K, D, T, P) + Create a socket. + @c mysql_socket_socket is a replacement for @c socket. + @param K PSI_socket_key for this instrumented socket + @param D Socket domain + @param T Protocol type + @param P Transport protocol +*/ + +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_socket(K, D, T, P) \ + inline_mysql_socket_socket(K, D, T, P) +#else + #define mysql_socket_socket(K, D, T, P) \ + inline_mysql_socket_socket(D, T, P) +#endif + +/** + @def mysql_socket_bind(FD, AP, L) + Bind a socket to a local port number and IP address + @c mysql_socket_bind is a replacement for @c bind. + @param FD Instrumented socket descriptor returned by socket() + @param AP Pointer to local port number and IP address in sockaddr structure + @param L Length of sockaddr structure +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_bind(FD, AP, L) \ + inline_mysql_socket_bind(__FILE__, __LINE__, FD, AP, L) +#else + #define mysql_socket_bind(FD, AP, L) \ + inline_mysql_socket_bind(FD, AP, L) +#endif + +/** + @def mysql_socket_getsockname(FD, AP, LP) + Return port number and IP address of the local host + @c mysql_socket_getsockname is a replacement for @c getsockname. + @param FD Instrumented socket descriptor returned by socket() + @param AP Pointer to returned address of local host in @c sockaddr structure + @param LP Pointer to length of @c sockaddr structure +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_getsockname(FD, AP, LP) \ + inline_mysql_socket_getsockname(__FILE__, __LINE__, FD, AP, LP) +#else + #define mysql_socket_getsockname(FD, AP, LP) \ + inline_mysql_socket_getsockname(FD, AP, LP) +#endif + +/** + @def mysql_socket_connect(FD, AP, L) + Establish a connection to a remote host. + @c mysql_socket_connect is a replacement for @c connect. + @param FD Instrumented socket descriptor returned by socket() + @param AP Pointer to target address in sockaddr structure + @param L Length of sockaddr structure +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_connect(FD, AP, L) \ + inline_mysql_socket_connect(__FILE__, __LINE__, FD, AP, L) +#else + #define mysql_socket_connect(FD, AP, L) \ + inline_mysql_socket_connect(FD, AP, L) +#endif + +/** + @def mysql_socket_getpeername(FD, AP, LP) + Get port number and IP address of remote host that a socket is connected to. + @c mysql_socket_getpeername is a replacement for @c getpeername. + @param FD Instrumented socket descriptor returned by socket() or accept() + @param AP Pointer to returned address of remote host in sockaddr structure + @param LP Pointer to length of sockaddr structure +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_getpeername(FD, AP, LP) \ + inline_mysql_socket_getpeername(__FILE__, __LINE__, FD, AP, LP) +#else + #define mysql_socket_getpeername(FD, AP, LP) \ + inline_mysql_socket_getpeername(FD, AP, LP) +#endif + +/** + @def mysql_socket_send(FD, B, N, FL) + Send data from the buffer, B, to a connected socket. + @c mysql_socket_send is a replacement for @c send. + @param FD Instrumented socket descriptor returned by socket() or accept() + @param B Buffer to send + @param N Number of bytes to send + @param FL Control flags +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_send(FD, B, N, FL) \ + inline_mysql_socket_send(__FILE__, __LINE__, FD, B, N, FL) +#else + #define mysql_socket_send(FD, B, N, FL) \ + inline_mysql_socket_send(FD, B, N, FL) +#endif + +/** + @def mysql_socket_recv(FD, B, N, FL) + Receive data from a connected socket. + @c mysql_socket_recv is a replacement for @c recv. + @param FD Instrumented socket descriptor returned by socket() or accept() + @param B Buffer to receive to + @param N Maximum bytes to receive + @param FL Control flags +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_recv(FD, B, N, FL) \ + inline_mysql_socket_recv(__FILE__, __LINE__, FD, B, N, FL) +#else + #define mysql_socket_recv(FD, B, N, FL) \ + inline_mysql_socket_recv(FD, B, N, FL) +#endif + +/** + @def mysql_socket_sendto(FD, B, N, FL, AP, L) + Send data to a socket at the specified address. + @c mysql_socket_sendto is a replacement for @c sendto. + @param FD Instrumented socket descriptor returned by socket() + @param B Buffer to send + @param N Number of bytes to send + @param FL Control flags + @param AP Pointer to destination sockaddr structure + @param L Size of sockaddr structure +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_sendto(FD, B, N, FL, AP, L) \ + inline_mysql_socket_sendto(__FILE__, __LINE__, FD, B, N, FL, AP, L) +#else + #define mysql_socket_sendto(FD, B, N, FL, AP, L) \ + inline_mysql_socket_sendto(FD, B, N, FL, AP, L) +#endif + +/** + @def mysql_socket_recvfrom(FD, B, N, FL, AP, L) + Receive data from a socket and return source address information + @c mysql_socket_recvfrom is a replacement for @c recvfrom. + @param FD Instrumented socket descriptor returned by socket() + @param B Buffer to receive to + @param N Maximum bytes to receive + @param FL Control flags + @param AP Pointer to source address in sockaddr_storage structure + @param LP Size of sockaddr_storage structure +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_recvfrom(FD, B, N, FL, AP, LP) \ + inline_mysql_socket_recvfrom(__FILE__, __LINE__, FD, B, N, FL, AP, LP) +#else + #define mysql_socket_recvfrom(FD, B, N, FL, AP, LP) \ + inline_mysql_socket_recvfrom(FD, B, N, FL, AP, LP) +#endif + +/** + @def mysql_socket_getsockopt(FD, LV, ON, OP, OL) + Get a socket option for the specified socket. + @c mysql_socket_getsockopt is a replacement for @c getsockopt. + @param FD Instrumented socket descriptor returned by socket() + @param LV Protocol level + @param ON Option to query + @param OP Buffer which will contain the value for the requested option + @param OL Pointer to length of OP +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_getsockopt(FD, LV, ON, OP, OL) \ + inline_mysql_socket_getsockopt(__FILE__, __LINE__, FD, LV, ON, OP, OL) +#else + #define mysql_socket_getsockopt(FD, LV, ON, OP, OL) \ + inline_mysql_socket_getsockopt(FD, LV, ON, OP, OL) +#endif + +/** + @def mysql_socket_setsockopt(FD, LV, ON, OP, OL) + Set a socket option for the specified socket. + @c mysql_socket_setsockopt is a replacement for @c setsockopt. + @param FD Instrumented socket descriptor returned by socket() + @param LV Protocol level + @param ON Option to modify + @param OP Buffer containing the value for the specified option + @param OL Pointer to length of OP +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_setsockopt(FD, LV, ON, OP, OL) \ + inline_mysql_socket_setsockopt(__FILE__, __LINE__, FD, LV, ON, OP, OL) +#else + #define mysql_socket_setsockopt(FD, LV, ON, OP, OL) \ + inline_mysql_socket_setsockopt(FD, LV, ON, OP, OL) +#endif + +/** + @def mysql_sock_set_nonblocking + Set socket to non-blocking. + @param FD instrumented socket descriptor +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_sock_set_nonblocking(FD) \ + inline_mysql_sock_set_nonblocking(__FILE__, __LINE__, FD) +#else + #define mysql_sock_set_nonblocking(FD) \ + inline_mysql_sock_set_nonblocking(FD) +#endif + +/** + @def mysql_socket_listen(FD, N) + Set socket state to listen for an incoming connection. + @c mysql_socket_listen is a replacement for @c listen. + @param FD Instrumented socket descriptor, bound and connected + @param N Maximum number of pending connections allowed. +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_listen(FD, N) \ + inline_mysql_socket_listen(__FILE__, __LINE__, FD, N) +#else + #define mysql_socket_listen(FD, N) \ + inline_mysql_socket_listen(FD, N) +#endif + +/** + @def mysql_socket_accept(K, FD, AP, LP) + Accept a connection from any remote host; TCP only. + @c mysql_socket_accept is a replacement for @c accept. + @param K PSI_socket_key for this instrumented socket + @param FD Instrumented socket descriptor, bound and placed in a listen state + @param AP Pointer to sockaddr structure with returned IP address and port of connected host + @param LP Pointer to length of valid information in AP +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_accept(K, FD, AP, LP) \ + inline_mysql_socket_accept(__FILE__, __LINE__, K, FD, AP, LP) +#else + #define mysql_socket_accept(K, FD, AP, LP) \ + inline_mysql_socket_accept(FD, AP, LP) +#endif + +/** + @def mysql_socket_close(FD) + Close a socket and sever any connections. + @c mysql_socket_close is a replacement for @c close. + @param FD Instrumented socket descriptor returned by socket() or accept() +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_close(FD) \ + inline_mysql_socket_close(__FILE__, __LINE__, FD) +#else + #define mysql_socket_close(FD) \ + inline_mysql_socket_close(FD) +#endif + +/** + @def mysql_socket_shutdown(FD, H) + Disable receives and/or sends on a socket. + @c mysql_socket_shutdown is a replacement for @c shutdown. + @param FD Instrumented socket descriptor returned by socket() or accept() + @param H Specifies which operations to shutdown +*/ +#ifdef HAVE_PSI_SOCKET_INTERFACE + #define mysql_socket_shutdown(FD, H) \ + inline_mysql_socket_shutdown(__FILE__, __LINE__, FD, H) +#else + #define mysql_socket_shutdown(FD, H) \ + inline_mysql_socket_shutdown(FD, H) +#endif + +#ifdef HAVE_PSI_SOCKET_INTERFACE +static inline void inline_mysql_socket_register( + const char *category, + PSI_socket_info *info, + int count) +{ + PSI_SOCKET_CALL(register_socket)(category, info, count); +} +#endif + +/** mysql_socket_socket */ + +static inline MYSQL_SOCKET +inline_mysql_socket_socket +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + PSI_socket_key key, +#endif + int domain, int type, int protocol) +{ + MYSQL_SOCKET mysql_socket= MYSQL_INVALID_SOCKET; + mysql_socket.fd= socket(domain, type, protocol); + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (likely(mysql_socket.fd != INVALID_SOCKET)) + { + mysql_socket.m_psi= PSI_SOCKET_CALL(init_socket) + (key, (const my_socket*)&mysql_socket.fd, NULL, 0); + } +#endif + return mysql_socket; +} + +/** mysql_socket_bind */ + +static inline int +inline_mysql_socket_bind +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_SOCKET mysql_socket, const struct sockaddr *addr, socklen_t len) +{ + int result; + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (mysql_socket.m_psi != NULL) + { + /* Instrumentation start */ + PSI_socket_locker_state state; + PSI_socket_locker *locker; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line); + + /* Instrumented code */ + result= bind(mysql_socket.fd, addr, len); + + /* Instrumentation end */ + if (result == 0) + PSI_SOCKET_CALL(set_socket_info)(mysql_socket.m_psi, NULL, addr, len); + + if (locker != NULL) + PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); + + return result; + } +#endif + + /* Non instrumented code */ + result= bind(mysql_socket.fd, addr, len); + return result; +} + +/** mysql_socket_getsockname */ + +static inline int +inline_mysql_socket_getsockname +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_SOCKET mysql_socket, struct sockaddr *addr, socklen_t *len) +{ + int result; + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (mysql_socket.m_psi != NULL) + { + /* Instrumentation start */ + PSI_socket_locker *locker; + PSI_socket_locker_state state; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line); + + /* Instrumented code */ + result= getsockname(mysql_socket.fd, addr, len); + + /* Instrumentation end */ + if (locker != NULL) + PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); + + return result; + } +#endif + + /* Non instrumented code */ + result= getsockname(mysql_socket.fd, addr, len); + + return result; +} + +/** mysql_socket_connect */ + +static inline int +inline_mysql_socket_connect +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_SOCKET mysql_socket, const struct sockaddr *addr, socklen_t len) +{ + int result; + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (mysql_socket.m_psi != NULL) + { + /* Instrumentation start */ + PSI_socket_locker *locker; + PSI_socket_locker_state state; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line); + + /* Instrumented code */ + result= connect(mysql_socket.fd, addr, len); + + /* Instrumentation end */ + if (locker != NULL) + PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); + + return result; + } +#endif + + /* Non instrumented code */ + result= connect(mysql_socket.fd, addr, len); + + return result; +} + +/** mysql_socket_getpeername */ + +static inline int +inline_mysql_socket_getpeername +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_SOCKET mysql_socket, struct sockaddr *addr, socklen_t *len) +{ + int result; + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (mysql_socket.m_psi != NULL) + { + /* Instrumentation start */ + PSI_socket_locker *locker; + PSI_socket_locker_state state; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line); + + /* Instrumented code */ + result= getpeername(mysql_socket.fd, addr, len); + + /* Instrumentation end */ + if (locker != NULL) + PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); + + return result; + } +#endif + + /* Non instrumented code */ + result= getpeername(mysql_socket.fd, addr, len); + + return result; +} + +/** mysql_socket_send */ + +static inline ssize_t +inline_mysql_socket_send +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_SOCKET mysql_socket, const SOCKBUF_T *buf, size_t n, int flags) +{ + ssize_t result; + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (mysql_socket.m_psi != NULL) + { + /* Instrumentation start */ + PSI_socket_locker *locker; + PSI_socket_locker_state state; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, mysql_socket.m_psi, PSI_SOCKET_SEND, n, src_file, src_line); + + /* Instrumented code */ + result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags); + + /* Instrumentation end */ + if (locker != NULL) + { + size_t bytes_written; + bytes_written= (result > -1) ? result : 0; + PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written); + } + + return result; + } +#endif + + /* Non instrumented code */ + result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags); + + return result; +} + +/** mysql_socket_recv */ + +static inline ssize_t +inline_mysql_socket_recv +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_SOCKET mysql_socket, SOCKBUF_T *buf, size_t n, int flags) +{ + ssize_t result; + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (mysql_socket.m_psi != NULL) + { + /* Instrumentation start */ + PSI_socket_locker *locker; + PSI_socket_locker_state state; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, mysql_socket.m_psi, PSI_SOCKET_RECV, (size_t)0, src_file, src_line); + + /* Instrumented code */ + result= recv(mysql_socket.fd, buf, IF_WIN((int),) n, flags); + + /* Instrumentation end */ + if (locker != NULL) + { + size_t bytes_read; + bytes_read= (result > -1) ? result : 0; + PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read); + } + + return result; + } +#endif + + /* Non instrumented code */ + result= recv(mysql_socket.fd, buf, IF_WIN((int),) n, flags); + + return result; +} + +/** mysql_socket_sendto */ + +static inline ssize_t +inline_mysql_socket_sendto +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_SOCKET mysql_socket, const SOCKBUF_T *buf, size_t n, int flags, const struct sockaddr *addr, socklen_t addr_len) +{ + ssize_t result; + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (mysql_socket.m_psi != NULL) + { + /* Instrumentation start */ + PSI_socket_locker *locker; + PSI_socket_locker_state state; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, mysql_socket.m_psi, PSI_SOCKET_SEND, n, src_file, src_line); + + /* Instrumented code */ + result= sendto(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len); + + /* Instrumentation end */ + if (locker != NULL) + { + size_t bytes_written; + bytes_written = (result > -1) ? result : 0; + PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written); + } + + return result; + } +#endif + + /* Non instrumented code */ + result= sendto(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len); + + return result; +} + +/** mysql_socket_recvfrom */ + +static inline ssize_t +inline_mysql_socket_recvfrom +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_SOCKET mysql_socket, SOCKBUF_T *buf, size_t n, int flags, + struct sockaddr *addr, socklen_t *addr_len) +{ + ssize_t result; + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (mysql_socket.m_psi != NULL) + { + /* Instrumentation start */ + PSI_socket_locker *locker; + PSI_socket_locker_state state; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, mysql_socket.m_psi, PSI_SOCKET_RECV, (size_t)0, src_file, src_line); + + /* Instrumented code */ + result= recvfrom(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len); + + /* Instrumentation end */ + if (locker != NULL) + { + size_t bytes_read; + bytes_read = (result > -1) ? result : 0; + PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read); + } + + return result; + } +#endif + + /* Non instrumented code */ + result= recvfrom(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len); + + return result; +} + +/** mysql_socket_getsockopt */ + +static inline int +inline_mysql_socket_getsockopt +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_SOCKET mysql_socket, int level, int optname, SOCKBUF_T *optval, socklen_t *optlen) +{ + int result; + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (mysql_socket.m_psi != NULL) + { + /* Instrumentation start */ + PSI_socket_locker *locker; + PSI_socket_locker_state state; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, mysql_socket.m_psi, PSI_SOCKET_OPT, (size_t)0, src_file, src_line); + + /* Instrumented code */ + result= getsockopt(mysql_socket.fd, level, optname, optval, optlen); + + /* Instrumentation end */ + if (locker != NULL) + PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); + + return result; + } +#endif + + /* Non instrumented code */ + result= getsockopt(mysql_socket.fd, level, optname, optval, optlen); + + return result; +} + +/** mysql_socket_setsockopt */ + +static inline int +inline_mysql_socket_setsockopt +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_SOCKET mysql_socket, int level, int optname, const SOCKBUF_T *optval, + socklen_t optlen) +{ + int result; + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (mysql_socket.m_psi) + { + /* Instrumentation start */ + PSI_socket_locker *locker; + PSI_socket_locker_state state; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, mysql_socket.m_psi, PSI_SOCKET_OPT, (size_t)0, src_file, src_line); + + /* Instrumented code */ + result= setsockopt(mysql_socket.fd, level, optname, optval, optlen); + + /* Instrumentation end */ + if (locker != NULL) + PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); + + return result; + } +#endif + + /* Non instrumented code */ + result= setsockopt(mysql_socket.fd, level, optname, optval, optlen); + + return result; +} + +/** set_socket_nonblock */ +static inline int +set_socket_nonblock(my_socket fd) +{ + int ret= 0; +#ifdef _WIN32 + { + u_long nonblocking= 1; + ret= ioctlsocket(fd, FIONBIO, &nonblocking); + } +#else + { + int fd_flags; + fd_flags= fcntl(fd, F_GETFL, 0); + if (fd_flags < 0) + return errno; +#if defined(O_NONBLOCK) + fd_flags |= O_NONBLOCK; +#elif defined(O_NDELAY) + fd_flags |= O_NDELAY; +#elif defined(O_FNDELAY) + fd_flags |= O_FNDELAY; +#else +#error "No definition of non-blocking flag found." +#endif /* O_NONBLOCK */ + if (fcntl(fd, F_SETFL, fd_flags) == -1) + ret= errno; + } +#endif /* _WIN32 */ + return ret; +} + +/** mysql_socket_set_nonblocking */ + +static inline int +inline_mysql_sock_set_nonblocking +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_SOCKET mysql_socket +) +{ + int result= 0; + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (mysql_socket.m_psi) + { + /* Instrumentation start */ + PSI_socket_locker *locker; + PSI_socket_locker_state state; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, mysql_socket.m_psi, PSI_SOCKET_OPT, + (size_t)0, src_file, src_line); + + /* Instrumented code */ + result= set_socket_nonblock(mysql_socket.fd); + + /* Instrumentation end */ + if (locker != NULL) + PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); + + return result; + } +#endif + + /* Non instrumented code */ + result= set_socket_nonblock(mysql_socket.fd); + + return result; +} + +/** mysql_socket_listen */ + +static inline int +inline_mysql_socket_listen +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_SOCKET mysql_socket, int backlog) +{ + int result; + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (mysql_socket.m_psi != NULL) + { + /* Instrumentation start */ + PSI_socket_locker *locker; + PSI_socket_locker_state state; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line); + + /* Instrumented code */ + result= listen(mysql_socket.fd, backlog); + + /* Instrumentation end */ + if (locker != NULL) + PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); + + return result; + } +#endif + + /* Non instrumented code */ + result= listen(mysql_socket.fd, backlog); + + return result; +} + +/** mysql_socket_accept */ + +static inline MYSQL_SOCKET +inline_mysql_socket_accept +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, PSI_socket_key key, +#endif + MYSQL_SOCKET socket_listen, struct sockaddr *addr, socklen_t *addr_len) +{ + MYSQL_SOCKET socket_accept= MYSQL_INVALID_SOCKET; + socklen_t addr_length= (addr_len != NULL) ? *addr_len : 0; + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (socket_listen.m_psi != NULL) + { + /* Instrumentation start */ + PSI_socket_locker *locker; + PSI_socket_locker_state state; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, socket_listen.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line); + + /* Instrumented code */ + socket_accept.fd= accept(socket_listen.fd, addr, &addr_length); + + /* Instrumentation end */ + if (locker != NULL) + PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); + } + else +#endif + { + /* Non instrumented code */ + socket_accept.fd= accept(socket_listen.fd, addr, &addr_length); + } + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (likely(socket_accept.fd != INVALID_SOCKET)) + { + /* Initialize the instrument with the new socket descriptor and address */ + socket_accept.m_psi= PSI_SOCKET_CALL(init_socket) + (key, (const my_socket*)&socket_accept.fd, addr, addr_length); + } +#endif + + return socket_accept; +} + +/** mysql_socket_close */ + +static inline int +inline_mysql_socket_close +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_SOCKET mysql_socket) +{ + int result; + +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (mysql_socket.m_psi != NULL) + { + /* Instrumentation start */ + PSI_socket_locker *locker; + PSI_socket_locker_state state; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, mysql_socket.m_psi, PSI_SOCKET_CLOSE, (size_t)0, src_file, src_line); + + /* Instrumented code */ + result= closesocket(mysql_socket.fd); + + /* Instrumentation end */ + if (locker != NULL) + PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); + /* Remove the instrumentation for this socket. */ + if (mysql_socket.m_psi != NULL) + PSI_SOCKET_CALL(destroy_socket)(mysql_socket.m_psi); + + return result; + } +#endif + + /* Non instrumented code */ + result= closesocket(mysql_socket.fd); + + return result; +} + +/** mysql_socket_shutdown */ + +static inline int +inline_mysql_socket_shutdown +( +#ifdef HAVE_PSI_SOCKET_INTERFACE + const char *src_file, uint src_line, +#endif + MYSQL_SOCKET mysql_socket, int how) +{ + int result; + +#ifdef _WIN32 + static LPFN_DISCONNECTEX DisconnectEx = NULL; + if (DisconnectEx == NULL) + { + DWORD dwBytesReturned; + GUID guidDisconnectEx = WSAID_DISCONNECTEX; + WSAIoctl(mysql_socket.fd, SIO_GET_EXTENSION_FUNCTION_POINTER, + &guidDisconnectEx, sizeof(GUID), + &DisconnectEx, sizeof(DisconnectEx), + &dwBytesReturned, NULL, NULL); + } +#endif + +/* Instrumentation start */ +#ifdef HAVE_PSI_SOCKET_INTERFACE + if (mysql_socket.m_psi != NULL) + { + PSI_socket_locker *locker; + PSI_socket_locker_state state; + locker= PSI_SOCKET_CALL(start_socket_wait) + (&state, mysql_socket.m_psi, PSI_SOCKET_SHUTDOWN, (size_t)0, src_file, src_line); + + /* Instrumented code */ +#ifdef _WIN32 + if (DisconnectEx) + result= (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED) NULL, + (DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1; + else +#endif + result= shutdown(mysql_socket.fd, how); + + /* Instrumentation end */ + if (locker != NULL) + PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0); + + return result; + } +#endif + + /* Non instrumented code */ +#ifdef _WIN32 + if (DisconnectEx) + result= (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED) NULL, + (DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1; + else +#endif + result= shutdown(mysql_socket.fd, how); + + return result; +} + +/** @} (end of group Socket_instrumentation) */ + +#endif + diff --git a/3rdparty/mysql/include/mysql/psi/mysql_sp.h b/3rdparty/mysql/include/mysql/psi/mysql_sp.h new file mode 100644 index 0000000000..68fc468db1 --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/mysql_sp.h @@ -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 diff --git a/3rdparty/mysql/include/mysql/psi/mysql_stage.h b/3rdparty/mysql/include/mysql/psi/mysql_stage.h new file mode 100644 index 0000000000..9c1623f437 --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/mysql_stage.h @@ -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 + diff --git a/3rdparty/mysql/include/mysql/psi/mysql_statement.h b/3rdparty/mysql/include/mysql/psi/mysql_statement.h new file mode 100644 index 0000000000..9c27933b06 --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/mysql_statement.h @@ -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 + diff --git a/3rdparty/mysql/include/mysql/psi/mysql_table.h b/3rdparty/mysql/include/mysql/psi/mysql_table.h new file mode 100644 index 0000000000..00f75661b7 --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/mysql_table.h @@ -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 + diff --git a/3rdparty/mysql/include/mysql/psi/mysql_thread.h b/3rdparty/mysql/include/mysql/psi/mysql_thread.h new file mode 100644 index 0000000000..c5ace991e0 --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/mysql_thread.h @@ -0,0 +1,1323 @@ +/* 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_THREAD_H +#define MYSQL_THREAD_H + +/** + @file mysql/psi/mysql_thread.h + Instrumentation helpers for mysys threads, mutexes, + read write locks and conditions. + This header file provides the necessary declarations + to use the mysys thread API with the performance schema instrumentation. + In some compilers (SunStudio), 'static inline' functions, when declared + but not used, are not optimized away (because they are unused) by default, + so that including a static inline function from a header file does + create unwanted dependencies, causing unresolved symbols at link time. + Other compilers, like gcc, optimize these dependencies by default. + + Since the instrumented APIs declared here are wrapper on top + of my_thread / safemutex / etc APIs, + including mysql/psi/mysql_thread.h assumes that + the dependency on my_thread and safemutex already exists. +*/ +/* + Note: there are several orthogonal dimensions here. + + Dimension 1: Instrumentation + HAVE_PSI_INTERFACE is defined when the instrumentation is compiled in. + This may happen both in debug or production builds. + + Dimension 2: Debug + SAFE_MUTEX is defined when debug is compiled in. + This may happen both with and without instrumentation. + + Dimension 3: Platform + Mutexes are implemented with one of: + - the pthread library + - fast mutexes + - window apis + This is implemented by various macro definitions in my_thread.h + + This causes complexity with '#ifdef'-ery that can't be avoided. +*/ + +#include "my_thread.h" +#include "my_thread_local.h" +#include "thr_mutex.h" +#include "thr_rwlock.h" +#include "mysql/psi/psi.h" +#ifdef MYSQL_SERVER +#ifndef MYSQL_DYNAMIC_PLUGIN +#include "pfs_thread_provider.h" +#endif +#endif + +#ifndef PSI_MUTEX_CALL +#define PSI_MUTEX_CALL(M) PSI_DYNAMIC_CALL(M) +#endif + +#ifndef PSI_RWLOCK_CALL +#define PSI_RWLOCK_CALL(M) PSI_DYNAMIC_CALL(M) +#endif + +#ifndef PSI_COND_CALL +#define PSI_COND_CALL(M) PSI_DYNAMIC_CALL(M) +#endif + +#ifndef PSI_THREAD_CALL +#define PSI_THREAD_CALL(M) PSI_DYNAMIC_CALL(M) +#endif + +/** + @defgroup Thread_instrumentation Thread Instrumentation + @ingroup Instrumentation_interface + @{ +*/ + +/** + An instrumented mutex structure. + @sa mysql_mutex_t +*/ +struct st_mysql_mutex +{ + /** The real mutex. */ + my_mutex_t m_mutex; + /** + The instrumentation hook. + Note that this hook is not conditionally defined, + for binary compatibility of the @c mysql_mutex_t interface. + */ + struct PSI_mutex *m_psi; +}; + +/** + Type of an instrumented mutex. + @c mysql_mutex_t is a drop-in replacement for @c my_mutex_t. + @sa mysql_mutex_assert_owner + @sa mysql_mutex_assert_not_owner + @sa mysql_mutex_init + @sa mysql_mutex_lock + @sa mysql_mutex_unlock + @sa mysql_mutex_destroy +*/ +typedef struct st_mysql_mutex mysql_mutex_t; + +/** + An instrumented rwlock structure. + @sa mysql_rwlock_t +*/ +struct st_mysql_rwlock +{ + /** The real rwlock */ + native_rw_lock_t m_rwlock; + /** + The instrumentation hook. + Note that this hook is not conditionally defined, + for binary compatibility of the @c mysql_rwlock_t interface. + */ + struct PSI_rwlock *m_psi; +}; + +/** + An instrumented prlock structure. + @sa mysql_prlock_t +*/ +struct st_mysql_prlock +{ + /** The real prlock */ + rw_pr_lock_t m_prlock; + /** + The instrumentation hook. + Note that this hook is not conditionally defined, + for binary compatibility of the @c mysql_rwlock_t interface. + */ + struct PSI_rwlock *m_psi; +}; + +/** + Type of an instrumented rwlock. + @c mysql_rwlock_t is a drop-in replacement for @c pthread_rwlock_t. + @sa mysql_rwlock_init + @sa mysql_rwlock_rdlock + @sa mysql_rwlock_tryrdlock + @sa mysql_rwlock_wrlock + @sa mysql_rwlock_trywrlock + @sa mysql_rwlock_unlock + @sa mysql_rwlock_destroy +*/ +typedef struct st_mysql_rwlock mysql_rwlock_t; + +/** + Type of an instrumented prlock. + A prlock is a read write lock that 'prefers readers' (pr). + @c mysql_prlock_t is a drop-in replacement for @c rw_pr_lock_t. + @sa mysql_prlock_init + @sa mysql_prlock_rdlock + @sa mysql_prlock_wrlock + @sa mysql_prlock_unlock + @sa mysql_prlock_destroy +*/ +typedef struct st_mysql_prlock mysql_prlock_t; + +/** + An instrumented cond structure. + @sa mysql_cond_t +*/ +struct st_mysql_cond +{ + /** The real condition */ + native_cond_t m_cond; + /** + The instrumentation hook. + Note that this hook is not conditionally defined, + for binary compatibility of the @c mysql_cond_t interface. + */ + struct PSI_cond *m_psi; +}; + +/** + Type of an instrumented condition. + @c mysql_cond_t is a drop-in replacement for @c native_cond_t. + @sa mysql_cond_init + @sa mysql_cond_wait + @sa mysql_cond_timedwait + @sa mysql_cond_signal + @sa mysql_cond_broadcast + @sa mysql_cond_destroy +*/ +typedef struct st_mysql_cond mysql_cond_t; + +/* + Consider the following code: + static inline void foo() { bar(); } + when foo() is never called. + + With gcc, foo() is a local static function, so the dependencies + are optimized away at compile time, and there is no dependency on bar(). + With other compilers (HP, Sun Studio), the function foo() implementation + is compiled, and bar() needs to be present to link. + + Due to the existing header dependencies in MySQL code, this header file + is sometime used when it is not needed, which in turn cause link failures + on some platforms. + The proper fix would be to cut these extra dependencies in the calling code. + DISABLE_MYSQL_THREAD_H is a work around to limit dependencies. + DISABLE_MYSQL_PRLOCK_H is similar, and is used to disable specifically + the prlock wrappers. +*/ +#ifndef DISABLE_MYSQL_THREAD_H + +/** + @def mysql_mutex_assert_owner(M) + Wrapper, to use safe_mutex_assert_owner with instrumented mutexes. + @c mysql_mutex_assert_owner is a drop-in replacement + for @c safe_mutex_assert_owner. +*/ +#ifdef SAFE_MUTEX +#define mysql_mutex_assert_owner(M) \ + safe_mutex_assert_owner(&(M)->m_mutex); +#else +#define mysql_mutex_assert_owner(M) { } +#endif + +/** + @def mysql_mutex_assert_not_owner(M) + Wrapper, to use safe_mutex_assert_not_owner with instrumented mutexes. + @c mysql_mutex_assert_not_owner is a drop-in replacement + for @c safe_mutex_assert_not_owner. +*/ +#ifdef SAFE_MUTEX +#define mysql_mutex_assert_not_owner(M) \ + safe_mutex_assert_not_owner(&(M)->m_mutex); +#else +#define mysql_mutex_assert_not_owner(M) { } +#endif + +/** + @def mysql_prlock_assert_write_owner(M) + Drop-in replacement + for @c rw_pr_lock_assert_write_owner. +*/ +#define mysql_prlock_assert_write_owner(M) \ + rw_pr_lock_assert_write_owner(&(M)->m_prlock) + +/** + @def mysql_prlock_assert_not_write_owner(M) + Drop-in replacement + for @c rw_pr_lock_assert_not_write_owner. +*/ +#define mysql_prlock_assert_not_write_owner(M) \ + rw_pr_lock_assert_not_write_owner(&(M)->m_prlock) + +/** + @def mysql_mutex_register(P1, P2, P3) + Mutex registration. +*/ +#define mysql_mutex_register(P1, P2, P3) \ + inline_mysql_mutex_register(P1, P2, P3) + +/** + @def mysql_mutex_init(K, M, A) + Instrumented mutex_init. + @c mysql_mutex_init is a replacement for @c pthread_mutex_init. + @param K The PSI_mutex_key for this instrumented mutex + @param M The mutex to initialize + @param A Mutex attributes +*/ + +#ifdef HAVE_PSI_MUTEX_INTERFACE + #ifdef SAFE_MUTEX + #define mysql_mutex_init(K, M, A) \ + inline_mysql_mutex_init(K, M, A, __FILE__, __LINE__) + #else + #define mysql_mutex_init(K, M, A) \ + inline_mysql_mutex_init(K, M, A) + #endif +#else + #ifdef SAFE_MUTEX + #define mysql_mutex_init(K, M, A) \ + inline_mysql_mutex_init(M, A, __FILE__, __LINE__) + #else + #define mysql_mutex_init(K, M, A) \ + inline_mysql_mutex_init(M, A) + #endif +#endif + +/** + @def mysql_mutex_destroy(M) + Instrumented mutex_destroy. + @c mysql_mutex_destroy is a drop-in replacement + for @c pthread_mutex_destroy. +*/ +#ifdef SAFE_MUTEX + #define mysql_mutex_destroy(M) \ + inline_mysql_mutex_destroy(M, __FILE__, __LINE__) +#else + #define mysql_mutex_destroy(M) \ + inline_mysql_mutex_destroy(M) +#endif + +/** + @def mysql_mutex_lock(M) + Instrumented mutex_lock. + @c mysql_mutex_lock is a drop-in replacement for @c pthread_mutex_lock. + @param M The mutex to lock +*/ + +#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE) + #define mysql_mutex_lock(M) \ + inline_mysql_mutex_lock(M, __FILE__, __LINE__) +#else + #define mysql_mutex_lock(M) \ + inline_mysql_mutex_lock(M) +#endif + +/** + @def mysql_mutex_trylock(M) + Instrumented mutex_lock. + @c mysql_mutex_trylock is a drop-in replacement + for @c my_mutex_trylock. +*/ + +#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE) + #define mysql_mutex_trylock(M) \ + inline_mysql_mutex_trylock(M, __FILE__, __LINE__) +#else + #define mysql_mutex_trylock(M) \ + inline_mysql_mutex_trylock(M) +#endif + +/** + @def mysql_mutex_unlock(M) + Instrumented mutex_unlock. + @c mysql_mutex_unlock is a drop-in replacement for @c pthread_mutex_unlock. +*/ +#ifdef SAFE_MUTEX + #define mysql_mutex_unlock(M) \ + inline_mysql_mutex_unlock(M, __FILE__, __LINE__) +#else + #define mysql_mutex_unlock(M) \ + inline_mysql_mutex_unlock(M) +#endif + +/** + @def mysql_rwlock_register(P1, P2, P3) + Rwlock registration. +*/ +#define mysql_rwlock_register(P1, P2, P3) \ + inline_mysql_rwlock_register(P1, P2, P3) + +/** + @def mysql_rwlock_init(K, RW) + Instrumented rwlock_init. + @c mysql_rwlock_init is a replacement for @c pthread_rwlock_init. + Note that pthread_rwlockattr_t is not supported in MySQL. + @param K The PSI_rwlock_key for this instrumented rwlock + @param RW The rwlock to initialize +*/ +#ifdef HAVE_PSI_RWLOCK_INTERFACE + #define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(K, RW) +#else + #define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(RW) +#endif + +/** + @def mysql_prlock_init(K, RW) + Instrumented rw_pr_init. + @c mysql_prlock_init is a replacement for @c rw_pr_init. + @param K The PSI_rwlock_key for this instrumented prlock + @param RW The prlock to initialize +*/ +#ifdef HAVE_PSI_RWLOCK_INTERFACE + #define mysql_prlock_init(K, RW) inline_mysql_prlock_init(K, RW) +#else + #define mysql_prlock_init(K, RW) inline_mysql_prlock_init(RW) +#endif + +/** + @def mysql_rwlock_destroy(RW) + Instrumented rwlock_destroy. + @c mysql_rwlock_destroy is a drop-in replacement + for @c pthread_rwlock_destroy. +*/ +#define mysql_rwlock_destroy(RW) inline_mysql_rwlock_destroy(RW) + +/** + @def mysql_prlock_destroy(RW) + Instrumented rw_pr_destroy. + @c mysql_prlock_destroy is a drop-in replacement + for @c rw_pr_destroy. +*/ +#define mysql_prlock_destroy(RW) inline_mysql_prlock_destroy(RW) + +/** + @def mysql_rwlock_rdlock(RW) + Instrumented rwlock_rdlock. + @c mysql_rwlock_rdlock is a drop-in replacement + for @c pthread_rwlock_rdlock. +*/ +#ifdef HAVE_PSI_RWLOCK_INTERFACE + #define mysql_rwlock_rdlock(RW) \ + inline_mysql_rwlock_rdlock(RW, __FILE__, __LINE__) +#else + #define mysql_rwlock_rdlock(RW) \ + inline_mysql_rwlock_rdlock(RW) +#endif + +/** + @def mysql_prlock_rdlock(RW) + Instrumented rw_pr_rdlock. + @c mysql_prlock_rdlock is a drop-in replacement + for @c rw_pr_rdlock. +*/ +#ifdef HAVE_PSI_RWLOCK_INTERFACE + #define mysql_prlock_rdlock(RW) \ + inline_mysql_prlock_rdlock(RW, __FILE__, __LINE__) +#else + #define mysql_prlock_rdlock(RW) \ + inline_mysql_prlock_rdlock(RW) +#endif + +/** + @def mysql_rwlock_wrlock(RW) + Instrumented rwlock_wrlock. + @c mysql_rwlock_wrlock is a drop-in replacement + for @c pthread_rwlock_wrlock. +*/ +#ifdef HAVE_PSI_RWLOCK_INTERFACE + #define mysql_rwlock_wrlock(RW) \ + inline_mysql_rwlock_wrlock(RW, __FILE__, __LINE__) +#else + #define mysql_rwlock_wrlock(RW) \ + inline_mysql_rwlock_wrlock(RW) +#endif + +/** + @def mysql_prlock_wrlock(RW) + Instrumented rw_pr_wrlock. + @c mysql_prlock_wrlock is a drop-in replacement + for @c rw_pr_wrlock. +*/ +#ifdef HAVE_PSI_RWLOCK_INTERFACE + #define mysql_prlock_wrlock(RW) \ + inline_mysql_prlock_wrlock(RW, __FILE__, __LINE__) +#else + #define mysql_prlock_wrlock(RW) \ + inline_mysql_prlock_wrlock(RW) +#endif + +/** + @def mysql_rwlock_tryrdlock(RW) + Instrumented rwlock_tryrdlock. + @c mysql_rwlock_tryrdlock is a drop-in replacement + for @c pthread_rwlock_tryrdlock. +*/ +#ifdef HAVE_PSI_RWLOCK_INTERFACE + #define mysql_rwlock_tryrdlock(RW) \ + inline_mysql_rwlock_tryrdlock(RW, __FILE__, __LINE__) +#else + #define mysql_rwlock_tryrdlock(RW) \ + inline_mysql_rwlock_tryrdlock(RW) +#endif + +/** + @def mysql_rwlock_trywrlock(RW) + Instrumented rwlock_trywrlock. + @c mysql_rwlock_trywrlock is a drop-in replacement + for @c pthread_rwlock_trywrlock. +*/ +#ifdef HAVE_PSI_RWLOCK_INTERFACE + #define mysql_rwlock_trywrlock(RW) \ + inline_mysql_rwlock_trywrlock(RW, __FILE__, __LINE__) +#else + #define mysql_rwlock_trywrlock(RW) \ + inline_mysql_rwlock_trywrlock(RW) +#endif + +/** + @def mysql_rwlock_unlock(RW) + Instrumented rwlock_unlock. + @c mysql_rwlock_unlock is a drop-in replacement + for @c pthread_rwlock_unlock. +*/ +#define mysql_rwlock_unlock(RW) inline_mysql_rwlock_unlock(RW) + +/** + @def mysql_prlock_unlock(RW) + Instrumented rw_pr_unlock. + @c mysql_prlock_unlock is a drop-in replacement + for @c rw_pr_unlock. +*/ +#define mysql_prlock_unlock(RW) inline_mysql_prlock_unlock(RW) + +/** + @def mysql_cond_register(P1, P2, P3) + Cond registration. +*/ +#define mysql_cond_register(P1, P2, P3) \ + inline_mysql_cond_register(P1, P2, P3) + +/** + @def mysql_cond_init(K, C) + Instrumented cond_init. + @c mysql_cond_init is a replacement for @c pthread_cond_init. + Note that pthread_condattr_t is not supported in MySQL. + @param C The cond to initialize + @param K The PSI_cond_key for this instrumented cond + +*/ +#ifdef HAVE_PSI_COND_INTERFACE + #define mysql_cond_init(K, C) inline_mysql_cond_init(K, C) +#else + #define mysql_cond_init(K, C) inline_mysql_cond_init(C) +#endif + +/** + @def mysql_cond_destroy(C) + Instrumented cond_destroy. + @c mysql_cond_destroy is a drop-in replacement for @c pthread_cond_destroy. +*/ +#define mysql_cond_destroy(C) inline_mysql_cond_destroy(C) + +/** + @def mysql_cond_wait(C) + Instrumented cond_wait. + @c mysql_cond_wait is a drop-in replacement for @c native_cond_wait. +*/ +#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE) + #define mysql_cond_wait(C, M) \ + inline_mysql_cond_wait(C, M, __FILE__, __LINE__) +#else + #define mysql_cond_wait(C, M) \ + inline_mysql_cond_wait(C, M) +#endif + +/** + @def mysql_cond_timedwait(C, M, W) + Instrumented cond_timedwait. + @c mysql_cond_timedwait is a drop-in replacement + for @c native_cond_timedwait. +*/ +#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE) + #define mysql_cond_timedwait(C, M, W) \ + inline_mysql_cond_timedwait(C, M, W, __FILE__, __LINE__) +#else + #define mysql_cond_timedwait(C, M, W) \ + inline_mysql_cond_timedwait(C, M, W) +#endif + +/** + @def mysql_cond_signal(C) + Instrumented cond_signal. + @c mysql_cond_signal is a drop-in replacement for @c pthread_cond_signal. +*/ +#define mysql_cond_signal(C) inline_mysql_cond_signal(C) + +/** + @def mysql_cond_broadcast(C) + Instrumented cond_broadcast. + @c mysql_cond_broadcast is a drop-in replacement + for @c pthread_cond_broadcast. +*/ +#define mysql_cond_broadcast(C) inline_mysql_cond_broadcast(C) + +/** + @def mysql_thread_register(P1, P2, P3) + Thread registration. +*/ +#define mysql_thread_register(P1, P2, P3) \ + inline_mysql_thread_register(P1, P2, P3) + +/** + @def mysql_thread_create(K, P1, P2, P3, P4) + Instrumented my_thread_create. + This function creates both the thread instrumentation and a thread. + @c mysql_thread_create is a replacement for @c my_thread_create. + The parameter P4 (or, if it is NULL, P1) will be used as the + instrumented thread "indentity". + Providing a P1 / P4 parameter with a different value for each call + will on average improve performances, since this thread identity value + is used internally to randomize access to data and prevent contention. + This is optional, and the improvement is not guaranteed, only statistical. + @param K The PSI_thread_key for this instrumented thread + @param P1 my_thread_create parameter 1 + @param P2 my_thread_create parameter 2 + @param P3 my_thread_create parameter 3 + @param P4 my_thread_create parameter 4 +*/ +#ifdef HAVE_PSI_THREAD_INTERFACE + #define mysql_thread_create(K, P1, P2, P3, P4) \ + inline_mysql_thread_create(K, P1, P2, P3, P4) +#else + #define mysql_thread_create(K, P1, P2, P3, P4) \ + my_thread_create(P1, P2, P3, P4) +#endif + +/** + @def mysql_thread_set_psi_id(I) + Set the thread identifier for the instrumentation. + @param I The thread identifier +*/ +#ifdef HAVE_PSI_THREAD_INTERFACE + #define mysql_thread_set_psi_id(I) inline_mysql_thread_set_psi_id(I) +#else + #define mysql_thread_set_psi_id(I) do {} while (0) +#endif + +/** + @def mysql_thread_set_psi_THD(T) + Set the thread sql session for the instrumentation. + @param I The thread identifier +*/ +#ifdef HAVE_PSI_THREAD_INTERFACE + #define mysql_thread_set_psi_THD(T) inline_mysql_thread_set_psi_THD(T) +#else + #define mysql_thread_set_psi_THD(T) do {} while (0) +#endif + +static inline void inline_mysql_mutex_register( +#ifdef HAVE_PSI_MUTEX_INTERFACE + const char *category, + PSI_mutex_info *info, + int count +#else + const char *category MY_ATTRIBUTE ((unused)), + void *info MY_ATTRIBUTE ((unused)), + int count MY_ATTRIBUTE ((unused)) +#endif +) +{ +#ifdef HAVE_PSI_MUTEX_INTERFACE + PSI_MUTEX_CALL(register_mutex)(category, info, count); +#endif +} + +static inline int inline_mysql_mutex_init( +#ifdef HAVE_PSI_MUTEX_INTERFACE + PSI_mutex_key key, +#endif + mysql_mutex_t *that, + const native_mutexattr_t *attr +#ifdef SAFE_MUTEX + , const char *src_file, uint src_line +#endif + ) +{ +#ifdef HAVE_PSI_MUTEX_INTERFACE + that->m_psi= PSI_MUTEX_CALL(init_mutex)(key, &that->m_mutex); +#else + that->m_psi= NULL; +#endif + return my_mutex_init(&that->m_mutex, attr +#ifdef SAFE_MUTEX + , src_file, src_line +#endif + ); +} + +static inline int inline_mysql_mutex_destroy( + mysql_mutex_t *that +#ifdef SAFE_MUTEX + , const char *src_file, uint src_line +#endif + ) +{ +#ifdef HAVE_PSI_MUTEX_INTERFACE + if (that->m_psi != NULL) + { + PSI_MUTEX_CALL(destroy_mutex)(that->m_psi); + that->m_psi= NULL; + } +#endif + return my_mutex_destroy(&that->m_mutex +#ifdef SAFE_MUTEX + , src_file, src_line +#endif + ); +} + +static inline int inline_mysql_mutex_lock( + mysql_mutex_t *that +#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE) + , const char *src_file, uint src_line +#endif + ) +{ + int result; + +#ifdef HAVE_PSI_MUTEX_INTERFACE + if (that->m_psi != NULL) + { + /* Instrumentation start */ + PSI_mutex_locker *locker; + PSI_mutex_locker_state state; + locker= PSI_MUTEX_CALL(start_mutex_wait)(&state, that->m_psi, + PSI_MUTEX_LOCK, src_file, src_line); + + /* Instrumented code */ + result= my_mutex_lock(&that->m_mutex +#ifdef SAFE_MUTEX + , src_file, src_line +#endif + ); + + /* Instrumentation end */ + if (locker != NULL) + PSI_MUTEX_CALL(end_mutex_wait)(locker, result); + + return result; + } +#endif + + /* Non instrumented code */ + result= my_mutex_lock(&that->m_mutex +#ifdef SAFE_MUTEX + , src_file, src_line +#endif + ); + + return result; +} + +static inline int inline_mysql_mutex_trylock( + mysql_mutex_t *that +#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE) + , const char *src_file, uint src_line +#endif + ) +{ + int result; + +#ifdef HAVE_PSI_MUTEX_INTERFACE + if (that->m_psi != NULL) + { + /* Instrumentation start */ + PSI_mutex_locker *locker; + PSI_mutex_locker_state state; + locker= PSI_MUTEX_CALL(start_mutex_wait)(&state, that->m_psi, + PSI_MUTEX_TRYLOCK, src_file, src_line); + + /* Instrumented code */ + result= my_mutex_trylock(&that->m_mutex +#ifdef SAFE_MUTEX + , src_file, src_line +#endif + ); + + /* Instrumentation end */ + if (locker != NULL) + PSI_MUTEX_CALL(end_mutex_wait)(locker, result); + + return result; + } +#endif + + /* Non instrumented code */ + result= my_mutex_trylock(&that->m_mutex +#ifdef SAFE_MUTEX + , src_file, src_line +#endif + ); + + return result; +} + +static inline int inline_mysql_mutex_unlock( + mysql_mutex_t *that +#ifdef SAFE_MUTEX + , const char *src_file, uint src_line +#endif + ) +{ + int result; + +#ifdef HAVE_PSI_MUTEX_INTERFACE + if (that->m_psi != NULL) + PSI_MUTEX_CALL(unlock_mutex)(that->m_psi); +#endif + + result= my_mutex_unlock(&that->m_mutex +#ifdef SAFE_MUTEX + , src_file, src_line +#endif + ); + + return result; +} + +static inline void inline_mysql_rwlock_register( +#ifdef HAVE_PSI_RWLOCK_INTERFACE + const char *category, + PSI_rwlock_info *info, + int count +#else + const char *category MY_ATTRIBUTE ((unused)), + void *info MY_ATTRIBUTE ((unused)), + int count MY_ATTRIBUTE ((unused)) +#endif +) +{ +#ifdef HAVE_PSI_RWLOCK_INTERFACE + PSI_RWLOCK_CALL(register_rwlock)(category, info, count); +#endif +} + +static inline int inline_mysql_rwlock_init( +#ifdef HAVE_PSI_RWLOCK_INTERFACE + PSI_rwlock_key key, +#endif + mysql_rwlock_t *that) +{ +#ifdef HAVE_PSI_RWLOCK_INTERFACE + that->m_psi= PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_rwlock); +#else + that->m_psi= NULL; +#endif + return native_rw_init(&that->m_rwlock); +} + +#ifndef DISABLE_MYSQL_PRLOCK_H +static inline int inline_mysql_prlock_init( +#ifdef HAVE_PSI_RWLOCK_INTERFACE + PSI_rwlock_key key, +#endif + mysql_prlock_t *that) +{ +#ifdef HAVE_PSI_RWLOCK_INTERFACE + that->m_psi= PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_prlock); +#else + that->m_psi= NULL; +#endif + return rw_pr_init(&that->m_prlock); +} +#endif + +static inline int inline_mysql_rwlock_destroy( + mysql_rwlock_t *that) +{ +#ifdef HAVE_PSI_RWLOCK_INTERFACE + if (that->m_psi != NULL) + { + PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi); + that->m_psi= NULL; + } +#endif + return native_rw_destroy(&that->m_rwlock); +} + +#ifndef DISABLE_MYSQL_PRLOCK_H +static inline int inline_mysql_prlock_destroy( + mysql_prlock_t *that) +{ +#ifdef HAVE_PSI_RWLOCK_INTERFACE + if (that->m_psi != NULL) + { + PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi); + that->m_psi= NULL; + } +#endif + return rw_pr_destroy(&that->m_prlock); +} +#endif + +static inline int inline_mysql_rwlock_rdlock( + mysql_rwlock_t *that +#ifdef HAVE_PSI_RWLOCK_INTERFACE + , const char *src_file, uint src_line +#endif + ) +{ + int result; + +#ifdef HAVE_PSI_RWLOCK_INTERFACE + if (that->m_psi != NULL) + { + /* Instrumentation start */ + PSI_rwlock_locker *locker; + PSI_rwlock_locker_state state; + locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi, + PSI_RWLOCK_READLOCK, src_file, src_line); + + /* Instrumented code */ + result= native_rw_rdlock(&that->m_rwlock); + + /* Instrumentation end */ + if (locker != NULL) + PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result); + + return result; + } +#endif + + /* Non instrumented code */ + result= native_rw_rdlock(&that->m_rwlock); + + return result; +} + +#ifndef DISABLE_MYSQL_PRLOCK_H +static inline int inline_mysql_prlock_rdlock( + mysql_prlock_t *that +#ifdef HAVE_PSI_RWLOCK_INTERFACE + , const char *src_file, uint src_line +#endif + ) +{ + int result; + +#ifdef HAVE_PSI_RWLOCK_INTERFACE + if (that->m_psi != NULL) + { + /* Instrumentation start */ + PSI_rwlock_locker *locker; + PSI_rwlock_locker_state state; + locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi, + PSI_RWLOCK_READLOCK, src_file, src_line); + + /* Instrumented code */ + result= rw_pr_rdlock(&that->m_prlock); + + /* Instrumentation end */ + if (locker != NULL) + PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result); + + return result; + } +#endif + + /* Non instrumented code */ + result= rw_pr_rdlock(&that->m_prlock); + + return result; +} +#endif + +static inline int inline_mysql_rwlock_wrlock( + mysql_rwlock_t *that +#ifdef HAVE_PSI_RWLOCK_INTERFACE + , const char *src_file, uint src_line +#endif + ) +{ + int result; + +#ifdef HAVE_PSI_RWLOCK_INTERFACE + if (that->m_psi != NULL) + { + /* Instrumentation start */ + PSI_rwlock_locker *locker; + PSI_rwlock_locker_state state; + locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi, + PSI_RWLOCK_WRITELOCK, src_file, src_line); + + /* Instrumented code */ + result= native_rw_wrlock(&that->m_rwlock); + + /* Instrumentation end */ + if (locker != NULL) + PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result); + + return result; + } +#endif + + /* Non instrumented code */ + result= native_rw_wrlock(&that->m_rwlock); + + return result; +} + +#ifndef DISABLE_MYSQL_PRLOCK_H +static inline int inline_mysql_prlock_wrlock( + mysql_prlock_t *that +#ifdef HAVE_PSI_RWLOCK_INTERFACE + , const char *src_file, uint src_line +#endif + ) +{ + int result; + +#ifdef HAVE_PSI_RWLOCK_INTERFACE + if (that->m_psi != NULL) + { + /* Instrumentation start */ + PSI_rwlock_locker *locker; + PSI_rwlock_locker_state state; + locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi, + PSI_RWLOCK_WRITELOCK, src_file, src_line); + + /* Instrumented code */ + result= rw_pr_wrlock(&that->m_prlock); + + /* Instrumentation end */ + if (locker != NULL) + PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result); + + return result; + } +#endif + + /* Non instrumented code */ + result= rw_pr_wrlock(&that->m_prlock); + + return result; +} +#endif + +static inline int inline_mysql_rwlock_tryrdlock( + mysql_rwlock_t *that +#ifdef HAVE_PSI_RWLOCK_INTERFACE + , const char *src_file, uint src_line +#endif + ) +{ + int result; + +#ifdef HAVE_PSI_RWLOCK_INTERFACE + if (that->m_psi != NULL) + { + /* Instrumentation start */ + PSI_rwlock_locker *locker; + PSI_rwlock_locker_state state; + locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi, + PSI_RWLOCK_TRYREADLOCK, src_file, src_line); + + /* Instrumented code */ + result= native_rw_tryrdlock(&that->m_rwlock); + + /* Instrumentation end */ + if (locker != NULL) + PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result); + + return result; + } +#endif + + /* Non instrumented code */ + result= native_rw_tryrdlock(&that->m_rwlock); + + return result; +} + +static inline int inline_mysql_rwlock_trywrlock( + mysql_rwlock_t *that +#ifdef HAVE_PSI_RWLOCK_INTERFACE + , const char *src_file, uint src_line +#endif + ) +{ + int result; + +#ifdef HAVE_PSI_RWLOCK_INTERFACE + if (that->m_psi != NULL) + { + /* Instrumentation start */ + PSI_rwlock_locker *locker; + PSI_rwlock_locker_state state; + locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi, + PSI_RWLOCK_TRYWRITELOCK, src_file, src_line); + + /* Instrumented code */ + result= native_rw_trywrlock(&that->m_rwlock); + + /* Instrumentation end */ + if (locker != NULL) + PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result); + + return result; + } +#endif + + /* Non instrumented code */ + result= native_rw_trywrlock(&that->m_rwlock); + + return result; +} + +static inline int inline_mysql_rwlock_unlock( + mysql_rwlock_t *that) +{ + int result; +#ifdef HAVE_PSI_RWLOCK_INTERFACE + if (that->m_psi != NULL) + PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi); +#endif + result= native_rw_unlock(&that->m_rwlock); + return result; +} + +#ifndef DISABLE_MYSQL_PRLOCK_H +static inline int inline_mysql_prlock_unlock( + mysql_prlock_t *that) +{ + int result; +#ifdef HAVE_PSI_RWLOCK_INTERFACE + if (that->m_psi != NULL) + PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi); +#endif + result= rw_pr_unlock(&that->m_prlock); + return result; +} +#endif + +static inline void inline_mysql_cond_register( +#ifdef HAVE_PSI_COND_INTERFACE + const char *category, + PSI_cond_info *info, + int count +#else + const char *category MY_ATTRIBUTE ((unused)), + void *info MY_ATTRIBUTE ((unused)), + int count MY_ATTRIBUTE ((unused)) +#endif +) +{ +#ifdef HAVE_PSI_COND_INTERFACE + PSI_COND_CALL(register_cond)(category, info, count); +#endif +} + +static inline int inline_mysql_cond_init( +#ifdef HAVE_PSI_COND_INTERFACE + PSI_cond_key key, +#endif + mysql_cond_t *that) +{ +#ifdef HAVE_PSI_COND_INTERFACE + that->m_psi= PSI_COND_CALL(init_cond)(key, &that->m_cond); +#else + that->m_psi= NULL; +#endif + return native_cond_init(&that->m_cond); +} + +static inline int inline_mysql_cond_destroy( + mysql_cond_t *that) +{ +#ifdef HAVE_PSI_COND_INTERFACE + if (that->m_psi != NULL) + { + PSI_COND_CALL(destroy_cond)(that->m_psi); + that->m_psi= NULL; + } +#endif + return native_cond_destroy(&that->m_cond); +} + +static inline int inline_mysql_cond_wait( + mysql_cond_t *that, + mysql_mutex_t *mutex +#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE) + , const char *src_file, uint src_line +#endif + ) +{ + int result; + +#ifdef HAVE_PSI_COND_INTERFACE + if (that->m_psi != NULL) + { + /* Instrumentation start */ + PSI_cond_locker *locker; + PSI_cond_locker_state state; + locker= PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi, + PSI_COND_WAIT, src_file, src_line); + + /* Instrumented code */ + result= my_cond_wait(&that->m_cond, &mutex->m_mutex +#ifdef SAFE_MUTEX + , src_file, src_line +#endif + ); + + /* Instrumentation end */ + if (locker != NULL) + PSI_COND_CALL(end_cond_wait)(locker, result); + + return result; + } +#endif + + /* Non instrumented code */ + result= my_cond_wait(&that->m_cond, &mutex->m_mutex +#ifdef SAFE_MUTEX + , src_file, src_line +#endif + ); + + return result; +} + +static inline int inline_mysql_cond_timedwait( + mysql_cond_t *that, + mysql_mutex_t *mutex, + const struct timespec *abstime +#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE) + , const char *src_file, uint src_line +#endif + ) +{ + int result; + +#ifdef HAVE_PSI_COND_INTERFACE + if (that->m_psi != NULL) + { + /* Instrumentation start */ + PSI_cond_locker *locker; + PSI_cond_locker_state state; + locker= PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi, + PSI_COND_TIMEDWAIT, src_file, src_line); + + /* Instrumented code */ + result= my_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime +#ifdef SAFE_MUTEX + , src_file, src_line +#endif + ); + + /* Instrumentation end */ + if (locker != NULL) + PSI_COND_CALL(end_cond_wait)(locker, result); + + return result; + } +#endif + + /* Non instrumented code */ + result= my_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime +#ifdef SAFE_MUTEX + , src_file, src_line +#endif + ); + + return result; +} + +static inline int inline_mysql_cond_signal( + mysql_cond_t *that) +{ + int result; +#ifdef HAVE_PSI_COND_INTERFACE + if (that->m_psi != NULL) + PSI_COND_CALL(signal_cond)(that->m_psi); +#endif + result= native_cond_signal(&that->m_cond); + return result; +} + +static inline int inline_mysql_cond_broadcast( + mysql_cond_t *that) +{ + int result; +#ifdef HAVE_PSI_COND_INTERFACE + if (that->m_psi != NULL) + PSI_COND_CALL(broadcast_cond)(that->m_psi); +#endif + result= native_cond_broadcast(&that->m_cond); + return result; +} + +static inline void inline_mysql_thread_register( +#ifdef HAVE_PSI_THREAD_INTERFACE + const char *category, + PSI_thread_info *info, + int count +#else + const char *category MY_ATTRIBUTE ((unused)), + void *info MY_ATTRIBUTE ((unused)), + int count MY_ATTRIBUTE ((unused)) +#endif +) +{ +#ifdef HAVE_PSI_THREAD_INTERFACE + PSI_THREAD_CALL(register_thread)(category, info, count); +#endif +} + +#ifdef HAVE_PSI_THREAD_INTERFACE +static inline int inline_mysql_thread_create( + PSI_thread_key key, + my_thread_handle *thread, const my_thread_attr_t *attr, + my_start_routine start_routine, void *arg) +{ + int result; + result= PSI_THREAD_CALL(spawn_thread)(key, thread, attr, start_routine, arg); + return result; +} + +static inline void inline_mysql_thread_set_psi_id(my_thread_id id) +{ + struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)(); + PSI_THREAD_CALL(set_thread_id)(psi, id); +} + +#ifdef __cplusplus +class THD; +static inline void inline_mysql_thread_set_psi_THD(THD *thd) +{ + struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)(); + PSI_THREAD_CALL(set_thread_THD)(psi, thd); +} +#endif /* __cplusplus */ + +#endif + +#endif /* DISABLE_MYSQL_THREAD_H */ + +/** @} (end of group Thread_instrumentation) */ + +#endif + diff --git a/3rdparty/mysql/include/mysql/psi/mysql_transaction.h b/3rdparty/mysql/include/mysql/psi/mysql_transaction.h new file mode 100644 index 0000000000..c80abf4622 --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/mysql_transaction.h @@ -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 + diff --git a/3rdparty/mysql/include/mysql/psi/psi.h b/3rdparty/mysql/include/mysql/psi/psi.h new file mode 100644 index 0000000000..9fb62868e3 --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/psi.h @@ -0,0 +1,2980 @@ +/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ + +#ifndef MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H +#define MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H + +#ifdef EMBEDDED_LIBRARY +#define DISABLE_ALL_PSI +#endif /* EMBEDDED_LIBRARY */ + +#ifndef MY_GLOBAL_INCLUDED +/* + Make sure a .c or .cc file contains an include to my_global.h first. + When this include is missing, all the #ifdef HAVE_XXX have no effect, + and the resulting binary won't build, or won't link, + or will crash at runtime + since various structures will have different binary definitions. +*/ +#error "You must include my_global.h in the code for the build to be correct." +#endif + +#include "psi_base.h" +#include "psi_memory.h" + +/* + MAINTAINER: + The following pattern: + typedef struct XYZ XYZ; + is not needed in C++, but required for C. +*/ + +C_MODE_START + +/** @sa MDL_key. */ +struct MDL_key; +typedef struct MDL_key MDL_key; + +/** @sa enum_mdl_type. */ +typedef int opaque_mdl_type; + +/** @sa enum_mdl_duration. */ +typedef int opaque_mdl_duration; + +/** @sa MDL_wait::enum_wait_status. */ +typedef int opaque_mdl_status; + +/** @sa enum_vio_type. */ +typedef int opaque_vio_type; + +struct TABLE_SHARE; + +struct sql_digest_storage; + +#ifdef __cplusplus + class THD; +#else + /* + Phony declaration when compiling C code. + This is ok, because the C code will never have a THD anyway. + */ + struct opaque_THD + { + int dummy; + }; + typedef struct opaque_THD THD; +#endif + +/** + @file mysql/psi/psi.h + Performance schema instrumentation interface. + + @defgroup Instrumentation_interface Instrumentation Interface + @ingroup Performance_schema + @{ +*/ + +/** + Interface for an instrumented mutex. + This is an opaque structure. +*/ +struct PSI_mutex; +typedef struct PSI_mutex PSI_mutex; + +/** + Interface for an instrumented rwlock. + This is an opaque structure. +*/ +struct PSI_rwlock; +typedef struct PSI_rwlock PSI_rwlock; + +/** + Interface for an instrumented condition. + This is an opaque structure. +*/ +struct PSI_cond; +typedef struct PSI_cond PSI_cond; + +/** + Interface for an instrumented table share. + This is an opaque structure. +*/ +struct PSI_table_share; +typedef struct PSI_table_share PSI_table_share; + +/** + Interface for an instrumented table handle. + This is an opaque structure. +*/ +struct PSI_table; +typedef struct PSI_table PSI_table; + +/** + Interface for an instrumented thread. + This is an opaque structure. +*/ +struct PSI_thread; +typedef struct PSI_thread PSI_thread; + +/** + Interface for an instrumented file handle. + This is an opaque structure. +*/ +struct PSI_file; +typedef struct PSI_file PSI_file; + +/** + Interface for an instrumented socket descriptor. + This is an opaque structure. +*/ +struct PSI_socket; +typedef struct PSI_socket PSI_socket; + +/** + Interface for an instrumented prepared statement. + This is an opaque structure. +*/ +struct PSI_prepared_stmt; +typedef struct PSI_prepared_stmt PSI_prepared_stmt; + +/** + Interface for an instrumented table operation. + This is an opaque structure. +*/ +struct PSI_table_locker; +typedef struct PSI_table_locker PSI_table_locker; + +/** + Interface for an instrumented statement. + This is an opaque structure. +*/ +struct PSI_statement_locker; +typedef struct PSI_statement_locker PSI_statement_locker; + +/** + Interface for an instrumented transaction. + This is an opaque structure. +*/ +struct PSI_transaction_locker; +typedef struct PSI_transaction_locker PSI_transaction_locker; + +/** + Interface for an instrumented idle operation. + This is an opaque structure. +*/ +struct PSI_idle_locker; +typedef struct PSI_idle_locker PSI_idle_locker; + +/** + Interface for an instrumented statement digest operation. + This is an opaque structure. +*/ +struct PSI_digest_locker; +typedef struct PSI_digest_locker PSI_digest_locker; + +/** + Interface for an instrumented stored procedure share. + This is an opaque structure. +*/ +struct PSI_sp_share; +typedef struct PSI_sp_share PSI_sp_share; + +/** + Interface for an instrumented stored program. + This is an opaque structure. +*/ +struct PSI_sp_locker; +typedef struct PSI_sp_locker PSI_sp_locker; + +/** + Interface for an instrumented metadata lock. + This is an opaque structure. +*/ +struct PSI_metadata_lock; +typedef struct PSI_metadata_lock PSI_metadata_lock; + +/** + Interface for an instrumented stage progress. + This is a public structure, for efficiency. +*/ +struct PSI_stage_progress +{ + ulonglong m_work_completed; + ulonglong m_work_estimated; +}; +typedef struct PSI_stage_progress PSI_stage_progress; + +/** IO operation performed on an instrumented table. */ +enum PSI_table_io_operation +{ + /** Row fetch. */ + PSI_TABLE_FETCH_ROW= 0, + /** Row write. */ + PSI_TABLE_WRITE_ROW= 1, + /** Row update. */ + PSI_TABLE_UPDATE_ROW= 2, + /** Row delete. */ + PSI_TABLE_DELETE_ROW= 3 +}; +typedef enum PSI_table_io_operation PSI_table_io_operation; + +/** + State data storage for @c start_table_io_wait_v1_t, + @c start_table_lock_wait_v1_t. + This structure provide temporary storage to a table locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa start_table_io_wait_v1_t + @sa start_table_lock_wait_v1_t +*/ +struct PSI_table_locker_state +{ + /** Internal state. */ + uint m_flags; + /** Current io operation. */ + enum PSI_table_io_operation m_io_operation; + /** Current table handle. */ + struct PSI_table *m_table; + /** Current table share. */ + struct PSI_table_share *m_table_share; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Internal data. */ + void *m_wait; + /** + Implementation specific. + For table io, the table io index. + For table lock, the lock type. + */ + uint m_index; +}; +typedef struct PSI_table_locker_state PSI_table_locker_state; + +/** Entry point for the performance schema interface. */ +struct PSI_bootstrap +{ + /** + ABI interface finder. + Calling this method with an interface version number returns either + an instance of the ABI for this version, or NULL. + @param version the interface version number to find + @return a versioned interface (PSI_v1, PSI_v2 or PSI) + @sa PSI_VERSION_1 + @sa PSI_v1 + @sa PSI_VERSION_2 + @sa PSI_v2 + @sa PSI_CURRENT_VERSION + @sa PSI + */ + void* (*get_interface)(int version); +}; +typedef struct PSI_bootstrap PSI_bootstrap; + +#ifdef HAVE_PSI_INTERFACE + +#ifdef DISABLE_ALL_PSI + +#ifndef DISABLE_PSI_THREAD +#define DISABLE_PSI_THREAD +#endif + +#ifndef DISABLE_PSI_MUTEX +#define DISABLE_PSI_MUTEX +#endif + +#ifndef DISABLE_PSI_RWLOCK +#define DISABLE_PSI_RWLOCK +#endif + +#ifndef DISABLE_PSI_COND +#define DISABLE_PSI_COND +#endif + +#ifndef DISABLE_PSI_FILE +#define DISABLE_PSI_FILE +#endif + +#ifndef DISABLE_PSI_TABLE +#define DISABLE_PSI_TABLE +#endif + +#ifndef DISABLE_PSI_SOCKET +#define DISABLE_PSI_SOCKET +#endif + +#ifndef DISABLE_PSI_STAGE +#define DISABLE_PSI_STAGE +#endif + +#ifndef DISABLE_PSI_STATEMENT +#define DISABLE_PSI_STATEMENT +#endif + +#ifndef DISABLE_PSI_SP +#define DISABLE_PSI_SP +#endif + +#ifndef DISABLE_PSI_IDLE +#define DISABLE_PSI_IDLE +#endif + +#ifndef DISABLE_PSI_STATEMENT_DIGEST +#define DISABLE_PSI_STATEMENT_DIGEST +#endif + +#ifndef DISABLE_PSI_METADATA +#define DISABLE_PSI_METADATA +#endif + +#ifndef DISABLE_PSI_MEMORY +#define DISABLE_PSI_MEMORY +#endif + +#ifndef DISABLE_PSI_TRANSACTION +#define DISABLE_PSI_TRANSACTION +#endif + +#ifndef DISABLE_PSI_SP +#define DISABLE_PSI_SP +#endif + +#ifndef DISABLE_PSI_PS +#define DISABLE_PSI_PS +#endif + +#endif + +/** + @def DISABLE_PSI_MUTEX + Compiling option to disable the mutex instrumentation. + This option is mostly intended to be used during development, + when doing special builds with only a subset of the performance schema instrumentation, + for code analysis / profiling / performance tuning of a specific instrumentation alone. + @sa DISABLE_PSI_RWLOCK + @sa DISABLE_PSI_COND + @sa DISABLE_PSI_FILE + @sa DISABLE_PSI_THREAD + @sa DISABLE_PSI_TABLE + @sa DISABLE_PSI_STAGE + @sa DISABLE_PSI_STATEMENT + @sa DISABLE_PSI_SP + @sa DISABLE_PSI_STATEMENT_DIGEST + @sa DISABLE_PSI_SOCKET + @sa DISABLE_PSI_MEMORY + @sa DISABLE_PSI_IDLE + @sa DISABLE_PSI_METADATA + @sa DISABLE PSI_TRANSACTION +*/ + +#ifndef DISABLE_PSI_MUTEX +#define HAVE_PSI_MUTEX_INTERFACE +#endif + +/** + @def DISABLE_PSI_RWLOCK + Compiling option to disable the rwlock instrumentation. + @sa DISABLE_PSI_MUTEX +*/ + +#ifndef DISABLE_PSI_RWLOCK +#define HAVE_PSI_RWLOCK_INTERFACE +#endif + +/** + @def DISABLE_PSI_COND + Compiling option to disable the cond instrumentation. + @sa DISABLE_PSI_MUTEX +*/ + +#ifndef DISABLE_PSI_COND +#define HAVE_PSI_COND_INTERFACE +#endif + +/** + @def DISABLE_PSI_FILE + Compiling option to disable the file instrumentation. + @sa DISABLE_PSI_MUTEX +*/ + +#ifndef DISABLE_PSI_FILE +#define HAVE_PSI_FILE_INTERFACE +#endif + +/** + @def DISABLE_PSI_THREAD + Compiling option to disable the thread instrumentation. + @sa DISABLE_PSI_MUTEX +*/ +#ifndef DISABLE_PSI_THREAD +#define HAVE_PSI_THREAD_INTERFACE +#endif + +/** + @def DISABLE_PSI_TABLE + Compiling option to disable the table instrumentation. + @sa DISABLE_PSI_MUTEX +*/ + +#ifndef DISABLE_PSI_TABLE +#define HAVE_PSI_TABLE_INTERFACE +#endif + +/** + @def DISABLE_PSI_STAGE + Compiling option to disable the stage instrumentation. + @sa DISABLE_PSI_MUTEX +*/ + +#ifndef DISABLE_PSI_STAGE +#define HAVE_PSI_STAGE_INTERFACE +#endif + +/** + @def DISABLE_PSI_STATEMENT + Compiling option to disable the statement instrumentation. + @sa DISABLE_PSI_MUTEX +*/ + +#ifndef DISABLE_PSI_STATEMENT +#define HAVE_PSI_STATEMENT_INTERFACE +#endif + +/** + @def DISABLE_PSI_SP + Compiling option to disable the stored program instrumentation. + @sa DISABLE_PSI_MUTEX +*/ +#ifndef DISABLE_PSI_SP +#define HAVE_PSI_SP_INTERFACE +#endif + +/** + @def DISABLE_PSI_PS + Compiling option to disable the prepared statement instrumentation. + @sa DISABLE_PSI_MUTEX +*/ +#ifndef DISABLE_PSI_STATEMENT +#ifndef DISABLE_PSI_PS +#define HAVE_PSI_PS_INTERFACE +#endif +#endif + +/** + @def DISABLE_PSI_STATEMENT_DIGEST + Compiling option to disable the statement digest instrumentation. +*/ + +#ifndef DISABLE_PSI_STATEMENT +#ifndef DISABLE_PSI_STATEMENT_DIGEST +#define HAVE_PSI_STATEMENT_DIGEST_INTERFACE +#endif +#endif + +/** + @def DISABLE_PSI_TRANSACTION + Compiling option to disable the transaction instrumentation. + @sa DISABLE_PSI_MUTEX +*/ + +#ifndef DISABLE_PSI_TRANSACTION +#define HAVE_PSI_TRANSACTION_INTERFACE +#endif + +/** + @def DISABLE_PSI_SOCKET + Compiling option to disable the statement instrumentation. + @sa DISABLE_PSI_MUTEX +*/ + +#ifndef DISABLE_PSI_SOCKET +#define HAVE_PSI_SOCKET_INTERFACE +#endif + +/** + @def DISABLE_PSI_MEMORY + Compiling option to disable the memory instrumentation. + @sa DISABLE_PSI_MUTEX +*/ + +#ifndef DISABLE_PSI_MEMORY +#define HAVE_PSI_MEMORY_INTERFACE +#endif + +/** + @def DISABLE_PSI_IDLE + Compiling option to disable the idle instrumentation. + @sa DISABLE_PSI_MUTEX +*/ + +#ifndef DISABLE_PSI_IDLE +#define HAVE_PSI_IDLE_INTERFACE +#endif + +/** + @def DISABLE_PSI_METADATA + Compiling option to disable the metadata instrumentation. + @sa DISABLE_PSI_MUTEX +*/ + +#ifndef DISABLE_PSI_METADATA +#define HAVE_PSI_METADATA_INTERFACE +#endif + +/** + @def PSI_VERSION_1 + Performance Schema Interface number for version 1. + This version is supported. +*/ +#define PSI_VERSION_1 1 + +/** + @def PSI_VERSION_2 + Performance Schema Interface number for version 2. + This version is not implemented, it's a placeholder. +*/ +#define PSI_VERSION_2 2 + +/** + @def PSI_CURRENT_VERSION + Performance Schema Interface number for the most recent version. + The most current version is @c PSI_VERSION_1 +*/ +#define PSI_CURRENT_VERSION 1 + +#ifndef USE_PSI_2 +#ifndef USE_PSI_1 +#define USE_PSI_1 +#endif +#endif + +/** + Interface for an instrumented mutex operation. + This is an opaque structure. +*/ +struct PSI_mutex_locker; +typedef struct PSI_mutex_locker PSI_mutex_locker; + +/** + Interface for an instrumented rwlock operation. + This is an opaque structure. +*/ +struct PSI_rwlock_locker; +typedef struct PSI_rwlock_locker PSI_rwlock_locker; + +/** + Interface for an instrumented condition operation. + This is an opaque structure. +*/ +struct PSI_cond_locker; +typedef struct PSI_cond_locker PSI_cond_locker; + +/** + Interface for an instrumented file operation. + This is an opaque structure. +*/ +struct PSI_file_locker; +typedef struct PSI_file_locker PSI_file_locker; + +/** + Interface for an instrumented socket operation. + This is an opaque structure. +*/ +struct PSI_socket_locker; +typedef struct PSI_socket_locker PSI_socket_locker; + +/** + Interface for an instrumented MDL operation. + This is an opaque structure. +*/ +struct PSI_metadata_locker; +typedef struct PSI_metadata_locker PSI_metadata_locker; + +/** Operation performed on an instrumented mutex. */ +enum PSI_mutex_operation +{ + /** Lock. */ + PSI_MUTEX_LOCK= 0, + /** Lock attempt. */ + PSI_MUTEX_TRYLOCK= 1 +}; +typedef enum PSI_mutex_operation PSI_mutex_operation; + +/** + Operation performed on an instrumented rwlock. + For basic READ / WRITE lock, + operations are "READ" or "WRITE". + For SX-locks, operations are "SHARED", "SHARED-EXCLUSIVE" or "EXCLUSIVE". +*/ +enum PSI_rwlock_operation +{ + /** Read lock. */ + PSI_RWLOCK_READLOCK= 0, + /** Write lock. */ + PSI_RWLOCK_WRITELOCK= 1, + /** Read lock attempt. */ + PSI_RWLOCK_TRYREADLOCK= 2, + /** Write lock attempt. */ + PSI_RWLOCK_TRYWRITELOCK= 3, + + /** Shared lock. */ + PSI_RWLOCK_SHAREDLOCK= 4, + /** Shared Exclusive lock. */ + PSI_RWLOCK_SHAREDEXCLUSIVELOCK= 5, + /** Exclusive lock. */ + PSI_RWLOCK_EXCLUSIVELOCK= 6, + /** Shared lock attempt. */ + PSI_RWLOCK_TRYSHAREDLOCK= 7, + /** Shared Exclusive lock attempt. */ + PSI_RWLOCK_TRYSHAREDEXCLUSIVELOCK= 8, + /** Exclusive lock attempt. */ + PSI_RWLOCK_TRYEXCLUSIVELOCK= 9 + +}; +typedef enum PSI_rwlock_operation PSI_rwlock_operation; + +/** Operation performed on an instrumented condition. */ +enum PSI_cond_operation +{ + /** Wait. */ + PSI_COND_WAIT= 0, + /** Wait, with timeout. */ + PSI_COND_TIMEDWAIT= 1 +}; +typedef enum PSI_cond_operation PSI_cond_operation; + +/** Operation performed on an instrumented file. */ +enum PSI_file_operation +{ + /** File creation, as in @c create(). */ + PSI_FILE_CREATE= 0, + /** Temporary file creation, as in @c create_temp_file(). */ + PSI_FILE_CREATE_TMP= 1, + /** File open, as in @c open(). */ + PSI_FILE_OPEN= 2, + /** File open, as in @c fopen(). */ + PSI_FILE_STREAM_OPEN= 3, + /** File close, as in @c close(). */ + PSI_FILE_CLOSE= 4, + /** File close, as in @c fclose(). */ + PSI_FILE_STREAM_CLOSE= 5, + /** + Generic file read, such as @c fgets(), @c fgetc(), @c fread(), @c read(), + @c pread(). + */ + PSI_FILE_READ= 6, + /** + Generic file write, such as @c fputs(), @c fputc(), @c fprintf(), + @c vfprintf(), @c fwrite(), @c write(), @c pwrite(). + */ + PSI_FILE_WRITE= 7, + /** Generic file seek, such as @c fseek() or @c seek(). */ + PSI_FILE_SEEK= 8, + /** Generic file tell, such as @c ftell() or @c tell(). */ + PSI_FILE_TELL= 9, + /** File flush, as in @c fflush(). */ + PSI_FILE_FLUSH= 10, + /** File stat, as in @c stat(). */ + PSI_FILE_STAT= 11, + /** File stat, as in @c fstat(). */ + PSI_FILE_FSTAT= 12, + /** File chsize, as in @c my_chsize(). */ + PSI_FILE_CHSIZE= 13, + /** File delete, such as @c my_delete() or @c my_delete_with_symlink(). */ + PSI_FILE_DELETE= 14, + /** File rename, such as @c my_rename() or @c my_rename_with_symlink(). */ + PSI_FILE_RENAME= 15, + /** File sync, as in @c fsync() or @c my_sync(). */ + PSI_FILE_SYNC= 16 +}; +typedef enum PSI_file_operation PSI_file_operation; + +/** Lock operation performed on an instrumented table. */ +enum PSI_table_lock_operation +{ + /** Table lock, in the server layer. */ + PSI_TABLE_LOCK= 0, + /** Table lock, in the storage engine layer. */ + PSI_TABLE_EXTERNAL_LOCK= 1 +}; +typedef enum PSI_table_lock_operation PSI_table_lock_operation; + +/** State of an instrumented socket. */ +enum PSI_socket_state +{ + /** Idle, waiting for the next command. */ + PSI_SOCKET_STATE_IDLE= 1, + /** Active, executing a command. */ + PSI_SOCKET_STATE_ACTIVE= 2 +}; +typedef enum PSI_socket_state PSI_socket_state; + +/** Operation performed on an instrumented socket. */ +enum PSI_socket_operation +{ + /** Socket creation, as in @c socket() or @c socketpair(). */ + PSI_SOCKET_CREATE= 0, + /** Socket connection, as in @c connect(), @c listen() and @c accept(). */ + PSI_SOCKET_CONNECT= 1, + /** Socket bind, as in @c bind(), @c getsockname() and @c getpeername(). */ + PSI_SOCKET_BIND= 2, + /** Socket close, as in @c shutdown(). */ + PSI_SOCKET_CLOSE= 3, + /** Socket send, @c send(). */ + PSI_SOCKET_SEND= 4, + /** Socket receive, @c recv(). */ + PSI_SOCKET_RECV= 5, + /** Socket send, @c sendto(). */ + PSI_SOCKET_SENDTO= 6, + /** Socket receive, @c recvfrom). */ + PSI_SOCKET_RECVFROM= 7, + /** Socket send, @c sendmsg(). */ + PSI_SOCKET_SENDMSG= 8, + /** Socket receive, @c recvmsg(). */ + PSI_SOCKET_RECVMSG= 9, + /** Socket seek, such as @c fseek() or @c seek(). */ + PSI_SOCKET_SEEK= 10, + /** Socket options, as in @c getsockopt() and @c setsockopt(). */ + PSI_SOCKET_OPT= 11, + /** Socket status, as in @c sockatmark() and @c isfdtype(). */ + PSI_SOCKET_STAT= 12, + /** Socket shutdown, as in @c shutdown(). */ + PSI_SOCKET_SHUTDOWN= 13, + /** Socket select, as in @c select() and @c poll(). */ + PSI_SOCKET_SELECT= 14 +}; +typedef enum PSI_socket_operation PSI_socket_operation; + +/** + Instrumented mutex key. + To instrument a mutex, a mutex key must be obtained using @c register_mutex. + Using a zero key always disable the instrumentation. +*/ +typedef unsigned int PSI_mutex_key; + +/** + Instrumented rwlock key. + To instrument a rwlock, a rwlock key must be obtained + using @c register_rwlock. + Using a zero key always disable the instrumentation. +*/ +typedef unsigned int PSI_rwlock_key; + +/** + Instrumented cond key. + To instrument a condition, a condition key must be obtained + using @c register_cond. + Using a zero key always disable the instrumentation. +*/ +typedef unsigned int PSI_cond_key; + +/** + Instrumented thread key. + To instrument a thread, a thread key must be obtained + using @c register_thread. + Using a zero key always disable the instrumentation. +*/ +typedef unsigned int PSI_thread_key; + +/** + Instrumented file key. + To instrument a file, a file key must be obtained using @c register_file. + Using a zero key always disable the instrumentation. +*/ +#ifndef PSI_FILE_KEY_DEFINED +typedef unsigned int PSI_file_key; +#define PSI_FILE_KEY_DEFINED +#endif + +/** + Instrumented stage key. + To instrument a stage, a stage key must be obtained using @c register_stage. + Using a zero key always disable the instrumentation. +*/ +typedef unsigned int PSI_stage_key; + +/** + Instrumented statement key. + To instrument a statement, a statement key must be obtained using @c register_statement. + Using a zero key always disable the instrumentation. +*/ +typedef unsigned int PSI_statement_key; + +/** + Instrumented socket key. + To instrument a socket, a socket key must be obtained using @c register_socket. + Using a zero key always disable the instrumentation. +*/ +typedef unsigned int PSI_socket_key; + +#ifdef HAVE_PSI_1 + +/** + @defgroup Group_PSI_v1 Application Binary Interface, version 1 + @ingroup Instrumentation_interface + @{ +*/ + +/** + Mutex information. + @since PSI_VERSION_1 + This structure is used to register an instrumented mutex. +*/ +struct PSI_mutex_info_v1 +{ + /** + Pointer to the key assigned to the registered mutex. + */ + PSI_mutex_key *m_key; + /** + The name of the mutex to register. + */ + const char *m_name; + /** + The flags of the mutex to register. + @sa PSI_FLAG_GLOBAL + */ + int m_flags; +}; +typedef struct PSI_mutex_info_v1 PSI_mutex_info_v1; + +/** + Rwlock information. + @since PSI_VERSION_1 + This structure is used to register an instrumented rwlock. +*/ +struct PSI_rwlock_info_v1 +{ + /** + Pointer to the key assigned to the registered rwlock. + */ + PSI_rwlock_key *m_key; + /** + The name of the rwlock to register. + */ + const char *m_name; + /** + The flags of the rwlock to register. + @sa PSI_FLAG_GLOBAL + */ + int m_flags; +}; +typedef struct PSI_rwlock_info_v1 PSI_rwlock_info_v1; + +/** + Condition information. + @since PSI_VERSION_1 + This structure is used to register an instrumented cond. +*/ +struct PSI_cond_info_v1 +{ + /** + Pointer to the key assigned to the registered cond. + */ + PSI_cond_key *m_key; + /** + The name of the cond to register. + */ + const char *m_name; + /** + The flags of the cond to register. + @sa PSI_FLAG_GLOBAL + */ + int m_flags; +}; +typedef struct PSI_cond_info_v1 PSI_cond_info_v1; + +/** + Thread instrument information. + @since PSI_VERSION_1 + This structure is used to register an instrumented thread. +*/ +struct PSI_thread_info_v1 +{ + /** + Pointer to the key assigned to the registered thread. + */ + PSI_thread_key *m_key; + /** + The name of the thread instrument to register. + */ + const char *m_name; + /** + The flags of the thread to register. + @sa PSI_FLAG_GLOBAL + */ + int m_flags; +}; +typedef struct PSI_thread_info_v1 PSI_thread_info_v1; + +/** + File instrument information. + @since PSI_VERSION_1 + This structure is used to register an instrumented file. +*/ +struct PSI_file_info_v1 +{ + /** + Pointer to the key assigned to the registered file. + */ + PSI_file_key *m_key; + /** + The name of the file instrument to register. + */ + const char *m_name; + /** + The flags of the file instrument to register. + @sa PSI_FLAG_GLOBAL + */ + int m_flags; +}; +typedef struct PSI_file_info_v1 PSI_file_info_v1; + +/** + Stage instrument information. + @since PSI_VERSION_1 + This structure is used to register an instrumented stage. +*/ +struct PSI_stage_info_v1 +{ + /** The registered stage key. */ + PSI_stage_key m_key; + /** The name of the stage instrument to register. */ + const char *m_name; + /** The flags of the stage instrument to register. */ + int m_flags; +}; +typedef struct PSI_stage_info_v1 PSI_stage_info_v1; + +/** + Statement instrument information. + @since PSI_VERSION_1 + This structure is used to register an instrumented statement. +*/ +struct PSI_statement_info_v1 +{ + /** The registered statement key. */ + PSI_statement_key m_key; + /** The name of the statement instrument to register. */ + const char *m_name; + /** The flags of the statement instrument to register. */ + int m_flags; +}; +typedef struct PSI_statement_info_v1 PSI_statement_info_v1; + +/** + Socket instrument information. + @since PSI_VERSION_1 + This structure is used to register an instrumented socket. +*/ +struct PSI_socket_info_v1 +{ + /** + Pointer to the key assigned to the registered socket. + */ + PSI_socket_key *m_key; + /** + The name of the socket instrument to register. + */ + const char *m_name; + /** + The flags of the socket instrument to register. + @sa PSI_FLAG_GLOBAL + */ + int m_flags; +}; +typedef struct PSI_socket_info_v1 PSI_socket_info_v1; + +/** + State data storage for @c start_idle_wait_v1_t. + This structure provide temporary storage to an idle locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa start_idle_wait_v1_t. +*/ +struct PSI_idle_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Internal data. */ + void *m_wait; +}; +typedef struct PSI_idle_locker_state_v1 PSI_idle_locker_state_v1; + +/** + State data storage for @c start_mutex_wait_v1_t. + This structure provide temporary storage to a mutex locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa start_mutex_wait_v1_t +*/ +struct PSI_mutex_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current operation. */ + enum PSI_mutex_operation m_operation; + /** Current mutex. */ + struct PSI_mutex *m_mutex; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Internal data. */ + void *m_wait; +}; +typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state_v1; + +/** + State data storage for @c start_rwlock_rdwait_v1_t, @c start_rwlock_wrwait_v1_t. + This structure provide temporary storage to a rwlock locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa start_rwlock_rdwait_v1_t + @sa start_rwlock_wrwait_v1_t +*/ +struct PSI_rwlock_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current operation. */ + enum PSI_rwlock_operation m_operation; + /** Current rwlock. */ + struct PSI_rwlock *m_rwlock; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Internal data. */ + void *m_wait; +}; +typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state_v1; + +/** + State data storage for @c start_cond_wait_v1_t. + This structure provide temporary storage to a condition locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa start_cond_wait_v1_t +*/ +struct PSI_cond_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current operation. */ + enum PSI_cond_operation m_operation; + /** Current condition. */ + struct PSI_cond *m_cond; + /** Current mutex. */ + struct PSI_mutex *m_mutex; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Internal data. */ + void *m_wait; +}; +typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state_v1; + +/** + State data storage for @c get_thread_file_name_locker_v1_t. + This structure provide temporary storage to a file locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa get_thread_file_name_locker_v1_t + @sa get_thread_file_stream_locker_v1_t + @sa get_thread_file_descriptor_locker_v1_t +*/ +struct PSI_file_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current operation. */ + enum PSI_file_operation m_operation; + /** Current file. */ + struct PSI_file *m_file; + /** Current file name. */ + const char *m_name; + /** Current file class. */ + void *m_class; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Operation number of bytes. */ + size_t m_number_of_bytes; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Internal data. */ + void *m_wait; +}; +typedef struct PSI_file_locker_state_v1 PSI_file_locker_state_v1; + +/** + State data storage for @c start_metadata_wait_v1_t. + This structure provide temporary storage to a metadata locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa start_metadata_wait_v1_t +*/ +struct PSI_metadata_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current metadata lock. */ + struct PSI_metadata_lock *m_metadata_lock; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Internal data. */ + void *m_wait; +}; +typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state_v1; + +/* Duplicate of NAME_LEN, to avoid dependency on mysql_com.h */ +#define PSI_SCHEMA_NAME_LEN (64 * 3) + +/** + State data storage for @c get_thread_statement_locker_v1_t, + @c get_thread_statement_locker_v1_t. + This structure provide temporary storage to a statement locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa get_thread_statement_locker_v1_t +*/ +struct PSI_statement_locker_state_v1 +{ + /** Discarded flag. */ + my_bool m_discarded; + /** In prepare flag. */ + my_bool m_in_prepare; + /** Metric, no index used flag. */ + uchar m_no_index_used; + /** Metric, no good index used flag. */ + uchar m_no_good_index_used; + /** Internal state. */ + uint m_flags; + /** Instrumentation class. */ + void *m_class; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Internal data. */ + void *m_statement; + /** Locked time. */ + ulonglong m_lock_time; + /** Rows sent. */ + ulonglong m_rows_sent; + /** Rows examined. */ + ulonglong m_rows_examined; + /** Metric, temporary tables created on disk. */ + ulong m_created_tmp_disk_tables; + /** Metric, temporary tables created. */ + ulong m_created_tmp_tables; + /** Metric, number of select full join. */ + ulong m_select_full_join; + /** Metric, number of select full range join. */ + ulong m_select_full_range_join; + /** Metric, number of select range. */ + ulong m_select_range; + /** Metric, number of select range check. */ + ulong m_select_range_check; + /** Metric, number of select scan. */ + ulong m_select_scan; + /** Metric, number of sort merge passes. */ + ulong m_sort_merge_passes; + /** Metric, number of sort merge. */ + ulong m_sort_range; + /** Metric, number of sort rows. */ + ulong m_sort_rows; + /** Metric, number of sort scans. */ + ulong m_sort_scan; + /** Statement digest. */ + const struct sql_digest_storage *m_digest; + /** Current schema name. */ + char m_schema_name[PSI_SCHEMA_NAME_LEN]; + /** Length in bytes of @c m_schema_name. */ + uint m_schema_name_length; + /** Statement character set number. */ + uint m_cs_number; + PSI_sp_share *m_parent_sp_share; + PSI_prepared_stmt *m_parent_prepared_stmt; +}; +typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state_v1; + +/** + State data storage for @c get_thread_transaction_locker_v1_t, + @c get_thread_transaction_locker_v1_t. + This structure provide temporary storage to a transaction locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa get_thread_transaction_locker_v1_t +*/ +struct PSI_transaction_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Instrumentation class. */ + void *m_class; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Internal data. */ + void *m_transaction; + /** True if read-only transaction, false if read-write. */ + my_bool m_read_only; + /** True if transaction is autocommit. */ + my_bool m_autocommit; + /** Number of statements. */ + ulong m_statement_count; + /** Total number of savepoints. */ + ulong m_savepoint_count; + /** Number of rollback_to_savepoint. */ + ulong m_rollback_to_savepoint_count; + /** Number of release_savepoint. */ + ulong m_release_savepoint_count; +}; + +typedef struct PSI_transaction_locker_state_v1 PSI_transaction_locker_state_v1; + +/** + State data storage for @c start_socket_wait_v1_t. + This structure provide temporary storage to a socket locker. + The content of this structure is considered opaque, + the fields are only hints of what an implementation + of the psi interface can use. + This memory is provided by the instrumented code for performance reasons. + @sa start_socket_wait_v1_t +*/ +struct PSI_socket_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current socket. */ + struct PSI_socket *m_socket; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Operation number of bytes. */ + size_t m_number_of_bytes; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Current operation. */ + enum PSI_socket_operation m_operation; + /** Source file. */ + const char* m_src_file; + /** Source line number. */ + int m_src_line; + /** Internal data. */ + void *m_wait; +}; +typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state_v1; + +struct PSI_sp_locker_state_v1 +{ + /** Internal state. */ + uint m_flags; + /** Current thread. */ + struct PSI_thread *m_thread; + /** Timer start. */ + ulonglong m_timer_start; + /** Timer function. */ + ulonglong (*m_timer)(void); + /** Stored Procedure share. */ + PSI_sp_share* m_sp_share; +}; +typedef struct PSI_sp_locker_state_v1 PSI_sp_locker_state_v1; + +/* Using typedef to make reuse between PSI_v1 and PSI_v2 easier later. */ + +/** + Mutex registration API. + @param category a category name (typically a plugin name) + @param info an array of mutex info to register + @param count the size of the info array +*/ +typedef void (*register_mutex_v1_t) + (const char *category, struct PSI_mutex_info_v1 *info, int count); + +/** + Rwlock registration API. + @param category a category name (typically a plugin name) + @param info an array of rwlock info to register + @param count the size of the info array +*/ +typedef void (*register_rwlock_v1_t) + (const char *category, struct PSI_rwlock_info_v1 *info, int count); + +/** + Cond registration API. + @param category a category name (typically a plugin name) + @param info an array of cond info to register + @param count the size of the info array +*/ +typedef void (*register_cond_v1_t) + (const char *category, struct PSI_cond_info_v1 *info, int count); + +/** + Thread registration API. + @param category a category name (typically a plugin name) + @param info an array of thread info to register + @param count the size of the info array +*/ +typedef void (*register_thread_v1_t) + (const char *category, struct PSI_thread_info_v1 *info, int count); + +/** + File registration API. + @param category a category name (typically a plugin name) + @param info an array of file info to register + @param count the size of the info array +*/ +typedef void (*register_file_v1_t) + (const char *category, struct PSI_file_info_v1 *info, int count); + +/** + Stage registration API. + @param category a category name + @param info an array of stage info to register + @param count the size of the info array +*/ +typedef void (*register_stage_v1_t) + (const char *category, struct PSI_stage_info_v1 **info, int count); + +/** + Statement registration API. + @param category a category name + @param info an array of stage info to register + @param count the size of the info array +*/ +typedef void (*register_statement_v1_t) + (const char *category, struct PSI_statement_info_v1 *info, int count); + +/** + Socket registration API. + @param category a category name (typically a plugin name) + @param info an array of socket info to register + @param count the size of the info array +*/ +typedef void (*register_socket_v1_t) + (const char *category, struct PSI_socket_info_v1 *info, int count); + +/** + Mutex instrumentation initialisation API. + @param key the registered mutex key + @param identity the address of the mutex itself + @return an instrumented mutex +*/ +typedef struct PSI_mutex* (*init_mutex_v1_t) + (PSI_mutex_key key, const void *identity); + +/** + Mutex instrumentation destruction API. + @param mutex the mutex to destroy +*/ +typedef void (*destroy_mutex_v1_t)(struct PSI_mutex *mutex); + +/** + Rwlock instrumentation initialisation API. + @param key the registered rwlock key + @param identity the address of the rwlock itself + @return an instrumented rwlock +*/ +typedef struct PSI_rwlock* (*init_rwlock_v1_t) + (PSI_rwlock_key key, const void *identity); + +/** + Rwlock instrumentation destruction API. + @param rwlock the rwlock to destroy +*/ +typedef void (*destroy_rwlock_v1_t)(struct PSI_rwlock *rwlock); + +/** + Cond instrumentation initialisation API. + @param key the registered key + @param identity the address of the rwlock itself + @return an instrumented cond +*/ +typedef struct PSI_cond* (*init_cond_v1_t) + (PSI_cond_key key, const void *identity); + +/** + Cond instrumentation destruction API. + @param cond the rcond to destroy +*/ +typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond); + +/** + Socket instrumentation initialisation API. + @param key the registered mutex key + @param socket descriptor + @param addr the socket ip address + @param addr_len length of socket ip address + @return an instrumented socket +*/ +typedef struct PSI_socket* (*init_socket_v1_t) + (PSI_socket_key key, const my_socket *fd, + const struct sockaddr *addr, socklen_t addr_len); + +/** + socket instrumentation destruction API. + @param socket the socket to destroy +*/ +typedef void (*destroy_socket_v1_t)(struct PSI_socket *socket); + +/** + Acquire a table share instrumentation. + @param temporary True for temporary tables + @param share The SQL layer table share + @return a table share instrumentation, or NULL +*/ +typedef struct PSI_table_share* (*get_table_share_v1_t) + (my_bool temporary, struct TABLE_SHARE *share); + +/** + Release a table share. + @param info the table share to release +*/ +typedef void (*release_table_share_v1_t)(struct PSI_table_share *share); + +/** + Drop a table share. + @param temporary True for temporary tables + @param schema_name the table schema name + @param schema_name_length the table schema name length + @param table_name the table name + @param table_name_length the table name length +*/ +typedef void (*drop_table_share_v1_t) + (my_bool temporary, const char *schema_name, int schema_name_length, + const char *table_name, int table_name_length); + +/** + Open an instrumentation table handle. + @param share the table to open + @param identity table handle identity + @return a table handle, or NULL +*/ +typedef struct PSI_table* (*open_table_v1_t) + (struct PSI_table_share *share, const void *identity); + +/** + Unbind a table handle from the current thread. + This operation happens when an opened table is added to the open table cache. + @param table the table to unbind +*/ +typedef void (*unbind_table_v1_t) + (struct PSI_table *table); + +/** + Rebind a table handle to the current thread. + This operation happens when a table from the open table cache + is reused for a thread. + @param table the table to unbind +*/ +typedef PSI_table* (*rebind_table_v1_t) + (PSI_table_share *share, const void *identity, PSI_table *table); + +/** + Close an instrumentation table handle. + Note that the table handle is invalid after this call. + @param table the table handle to close +*/ +typedef void (*close_table_v1_t)(struct TABLE_SHARE *server_share, + struct PSI_table *table); + +/** + Create a file instrumentation for a created file. + This method does not create the file itself, but is used to notify the + instrumentation interface that a file was just created. + @param key the file instrumentation key for this file + @param name the file name + @param file the file handle +*/ +typedef void (*create_file_v1_t)(PSI_file_key key, const char *name, + File file); + +/** + Spawn a thread. + This method creates a new thread, with instrumentation. + @param key the instrumentation key for this thread + @param thread the resulting thread + @param attr the thread attributes + @param start_routine the thread start routine + @param arg the thread start routine argument +*/ +typedef int (*spawn_thread_v1_t)(PSI_thread_key key, + my_thread_handle *thread, + const my_thread_attr_t *attr, + void *(*start_routine)(void*), void *arg); + +/** + Create instrumentation for a thread. + @param key the registered key + @param identity an address typical of the thread + @return an instrumented thread +*/ +typedef struct PSI_thread* (*new_thread_v1_t) + (PSI_thread_key key, const void *identity, ulonglong thread_id); + +/** + Assign a THD to an instrumented thread. + @param thread the instrumented thread + @param THD the sql layer THD to assign +*/ +typedef void (*set_thread_THD_v1_t)(struct PSI_thread *thread, + THD *thd); + +/** + Assign an id to an instrumented thread. + @param thread the instrumented thread + @param id the id to assign +*/ +typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread, + ulonglong id); + +/** + Assign the current operating system thread id to an instrumented thread. + The operating system task id is obtained from @c gettid() + @param thread the instrumented thread +*/ +typedef void (*set_thread_os_id_v1_t)(struct PSI_thread *thread); + +/** + Get the instrumentation for the running thread. + For this function to return a result, + the thread instrumentation must have been attached to the + running thread using @c set_thread() + @return the instrumentation for the running thread +*/ +typedef struct PSI_thread* (*get_thread_v1_t)(void); + +/** + Assign a user name to the instrumented thread. + @param user the user name + @param user_len the user name length +*/ +typedef void (*set_thread_user_v1_t)(const char *user, int user_len); + +/** + Assign a user name and host name to the instrumented thread. + @param user the user name + @param user_len the user name length + @param host the host name + @param host_len the host name length +*/ +typedef void (*set_thread_account_v1_t)(const char *user, int user_len, + const char *host, int host_len); + +/** + Assign a current database to the instrumented thread. + @param db the database name + @param db_len the database name length +*/ +typedef void (*set_thread_db_v1_t)(const char* db, int db_len); + +/** + Assign a current command to the instrumented thread. + @param command the current command +*/ +typedef void (*set_thread_command_v1_t)(int command); + +/** + Assign a connection type to the instrumented thread. + @param conn_type the connection type +*/ +typedef void (*set_connection_type_v1_t)(opaque_vio_type conn_type); + + +/** + Assign a start time to the instrumented thread. + @param start_time the thread start time +*/ +typedef void (*set_thread_start_time_v1_t)(time_t start_time); + +/** + Assign a state to the instrumented thread. + @param state the thread state +*/ +typedef void (*set_thread_state_v1_t)(const char* state); + +/** + Assign a process info to the instrumented thread. + @param info the process into string + @param info_len the process into string length +*/ +typedef void (*set_thread_info_v1_t)(const char* info, uint info_len); + +/** + Attach a thread instrumentation to the running thread. + In case of thread pools, this method should be called when + a worker thread picks a work item and runs it. + Also, this method should be called if the instrumented code does not + keep the pointer returned by @c new_thread() and relies on @c get_thread() + instead. + @param thread the thread instrumentation +*/ +typedef void (*set_thread_v1_t)(struct PSI_thread *thread); + +/** Delete the current thread instrumentation. */ +typedef void (*delete_current_thread_v1_t)(void); + +/** Delete a thread instrumentation. */ +typedef void (*delete_thread_v1_t)(struct PSI_thread *thread); + +/** + Get a file instrumentation locker, for opening or creating a file. + @param state data storage for the locker + @param key the file instrumentation key + @param op the operation to perform + @param name the file name + @param identity a pointer representative of this file. + @return a file locker, or NULL +*/ +typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t) + (struct PSI_file_locker_state_v1 *state, + PSI_file_key key, enum PSI_file_operation op, const char *name, + const void *identity); + +/** + Get a file stream instrumentation locker. + @param state data storage for the locker + @param file the file stream to access + @param op the operation to perform + @return a file locker, or NULL +*/ +typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t) + (struct PSI_file_locker_state_v1 *state, + struct PSI_file *file, enum PSI_file_operation op); + +/** + Get a file instrumentation locker. + @param state data storage for the locker + @param file the file descriptor to access + @param op the operation to perform + @return a file locker, or NULL +*/ +typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t) + (struct PSI_file_locker_state_v1 *state, + File file, enum PSI_file_operation op); + +/** + Record a mutex instrumentation unlock event. + @param mutex the mutex instrumentation +*/ +typedef void (*unlock_mutex_v1_t) + (struct PSI_mutex *mutex); + +/** + Record a rwlock instrumentation unlock event. + @param rwlock the rwlock instrumentation +*/ +typedef void (*unlock_rwlock_v1_t) + (struct PSI_rwlock *rwlock); + +/** + Record a condition instrumentation signal event. + @param cond the cond instrumentation +*/ +typedef void (*signal_cond_v1_t) + (struct PSI_cond *cond); + +/** + Record a condition instrumentation broadcast event. + @param cond the cond instrumentation +*/ +typedef void (*broadcast_cond_v1_t) + (struct PSI_cond *cond); + +/** + Record an idle instrumentation wait start event. + @param state data storage for the locker + @param file the source file name + @param line the source line number + @return an idle locker, or NULL +*/ +typedef struct PSI_idle_locker* (*start_idle_wait_v1_t) + (struct PSI_idle_locker_state_v1 *state, const char *src_file, uint src_line); + +/** + Record an idle instrumentation wait end event. + @param locker a thread locker for the running thread +*/ +typedef void (*end_idle_wait_v1_t) + (struct PSI_idle_locker *locker); + +/** + Record a mutex instrumentation wait start event. + @param state data storage for the locker + @param mutex the instrumented mutex to lock + @param op the operation to perform + @param file the source file name + @param line the source line number + @return a mutex locker, or NULL +*/ +typedef struct PSI_mutex_locker* (*start_mutex_wait_v1_t) + (struct PSI_mutex_locker_state_v1 *state, + struct PSI_mutex *mutex, + enum PSI_mutex_operation op, + const char *src_file, uint src_line); + +/** + Record a mutex instrumentation wait end event. + @param locker a thread locker for the running thread + @param rc the wait operation return code +*/ +typedef void (*end_mutex_wait_v1_t) + (struct PSI_mutex_locker *locker, int rc); + +/** + Record a rwlock instrumentation read wait start event. + @param locker a thread locker for the running thread + @param must must block: 1 for lock, 0 for trylock +*/ +typedef struct PSI_rwlock_locker* (*start_rwlock_rdwait_v1_t) + (struct PSI_rwlock_locker_state_v1 *state, + struct PSI_rwlock *rwlock, + enum PSI_rwlock_operation op, + const char *src_file, uint src_line); + +/** + Record a rwlock instrumentation read wait end event. + @param locker a thread locker for the running thread + @param rc the wait operation return code +*/ +typedef void (*end_rwlock_rdwait_v1_t) + (struct PSI_rwlock_locker *locker, int rc); + +/** + Record a rwlock instrumentation write wait start event. + @param locker a thread locker for the running thread + @param must must block: 1 for lock, 0 for trylock +*/ +typedef struct PSI_rwlock_locker* (*start_rwlock_wrwait_v1_t) + (struct PSI_rwlock_locker_state_v1 *state, + struct PSI_rwlock *rwlock, + enum PSI_rwlock_operation op, + const char *src_file, uint src_line); + +/** + Record a rwlock instrumentation write wait end event. + @param locker a thread locker for the running thread + @param rc the wait operation return code +*/ +typedef void (*end_rwlock_wrwait_v1_t) + (struct PSI_rwlock_locker *locker, int rc); + +/** + Record a condition instrumentation wait start event. + @param locker a thread locker for the running thread + @param must must block: 1 for wait, 0 for timedwait +*/ +typedef struct PSI_cond_locker* (*start_cond_wait_v1_t) + (struct PSI_cond_locker_state_v1 *state, + struct PSI_cond *cond, + struct PSI_mutex *mutex, + enum PSI_cond_operation op, + const char *src_file, uint src_line); + +/** + Record a condition instrumentation wait end event. + @param locker a thread locker for the running thread + @param rc the wait operation return code +*/ +typedef void (*end_cond_wait_v1_t) + (struct PSI_cond_locker *locker, int rc); + +/** + Record a table instrumentation io wait start event. + @param locker a table locker for the running thread + @param file the source file name + @param line the source line number +*/ +typedef struct PSI_table_locker* (*start_table_io_wait_v1_t) + (struct PSI_table_locker_state *state, + struct PSI_table *table, + enum PSI_table_io_operation op, + uint index, + const char *src_file, uint src_line); + +/** + Record a table instrumentation io wait end event. + @param locker a table locker for the running thread + @param numrows the number of rows involved in io +*/ +typedef void (*end_table_io_wait_v1_t) + (struct PSI_table_locker *locker, + ulonglong numrows); + +/** + Record a table instrumentation lock wait start event. + @param locker a table locker for the running thread + @param file the source file name + @param line the source line number +*/ +typedef struct PSI_table_locker* (*start_table_lock_wait_v1_t) + (struct PSI_table_locker_state *state, + struct PSI_table *table, + enum PSI_table_lock_operation op, + ulong flags, + const char *src_file, uint src_line); + +/** + Record a table instrumentation lock wait end event. + @param locker a table locker for the running thread +*/ +typedef void (*end_table_lock_wait_v1_t)(struct PSI_table_locker *locker); + +typedef void (*unlock_table_v1_t)(struct PSI_table *table); + +/** + Start a file instrumentation open operation. + @param locker the file locker + @param op the operation to perform + @param src_file the source file name + @param src_line the source line number +*/ +typedef void (*start_file_open_wait_v1_t) + (struct PSI_file_locker *locker, const char *src_file, uint src_line); + +/** + End a file instrumentation open operation, for file streams. + @param locker the file locker. + @param result the opened file (NULL indicates failure, non NULL success). + @return an instrumented file handle +*/ +typedef struct PSI_file* (*end_file_open_wait_v1_t) + (struct PSI_file_locker *locker, void *result); + +/** + End a file instrumentation open operation, for non stream files. + @param locker the file locker. + @param file the file number assigned by open() or create() for this file. +*/ +typedef void (*end_file_open_wait_and_bind_to_descriptor_v1_t) + (struct PSI_file_locker *locker, File file); + +/** + End a file instrumentation open operation, for non stream temporary files. + @param locker the file locker. + @param file the file number assigned by open() or create() for this file. + @param filename the file name generated during temporary file creation. +*/ +typedef void (*end_temp_file_open_wait_and_bind_to_descriptor_v1_t) + (struct PSI_file_locker *locker, File file, const char *filename); + +/** + Record a file instrumentation start event. + @param locker a file locker for the running thread + @param op file operation to be performed + @param count the number of bytes requested, or 0 if not applicable + @param src_file the source file name + @param src_line the source line number +*/ +typedef void (*start_file_wait_v1_t) + (struct PSI_file_locker *locker, size_t count, + const char *src_file, uint src_line); + +/** + Record a file instrumentation end event. + Note that for file close operations, the instrumented file handle + associated with the file (which was provided to obtain a locker) + is invalid after this call. + @param locker a file locker for the running thread + @param count the number of bytes actually used in the operation, + or 0 if not applicable, or -1 if the operation failed + @sa get_thread_file_name_locker + @sa get_thread_file_stream_locker + @sa get_thread_file_descriptor_locker +*/ +typedef void (*end_file_wait_v1_t) + (struct PSI_file_locker *locker, size_t count); + +/** + Start a file instrumentation close operation. + @param locker the file locker + @param op the operation to perform + @param src_file the source file name + @param src_line the source line number +*/ +typedef void (*start_file_close_wait_v1_t) + (struct PSI_file_locker *locker, const char *src_file, uint src_line); + +/** + End a file instrumentation close operation. + @param locker the file locker. + @param rc the close operation return code (0 for success). + @return an instrumented file handle +*/ +typedef void (*end_file_close_wait_v1_t) + (struct PSI_file_locker *locker, int rc); + +/** + Start a new stage, and implicitly end the previous stage. + @param key the key of the new stage + @param src_file the source file name + @param src_line the source line number + @return the new stage progress +*/ +typedef PSI_stage_progress* (*start_stage_v1_t) + (PSI_stage_key key, const char *src_file, int src_line); + +typedef PSI_stage_progress* (*get_current_stage_progress_v1_t)(void); + +/** End the current stage. */ +typedef void (*end_stage_v1_t) (void); + +/** + Get a statement instrumentation locker. + @param state data storage for the locker + @param key the statement instrumentation key + @param charset client character set + @return a statement locker, or NULL +*/ +typedef struct PSI_statement_locker* (*get_thread_statement_locker_v1_t) + (struct PSI_statement_locker_state_v1 *state, + PSI_statement_key key, const void *charset, PSI_sp_share *sp_share); + +/** + Refine a statement locker to a more specific key. + Note that only events declared mutable can be refined. + @param the statement locker for the current event + @param key the new key for the event + @sa PSI_FLAG_MUTABLE +*/ +typedef struct PSI_statement_locker* (*refine_statement_v1_t) + (struct PSI_statement_locker *locker, + PSI_statement_key key); + +/** + Start a new statement event. + @param locker the statement locker for this event + @param db the active database name for this statement + @param db_length the active database name length for this statement + @param src_file source file name + @param src_line source line number +*/ +typedef void (*start_statement_v1_t) + (struct PSI_statement_locker *locker, + const char *db, uint db_length, + const char *src_file, uint src_line); + +/** + Set the statement text for a statement event. + @param locker the current statement locker + @param text the statement text + @param text_len the statement text length +*/ +typedef void (*set_statement_text_v1_t) + (struct PSI_statement_locker *locker, + const char *text, uint text_len); + +/** + Set a statement event lock time. + @param locker the statement locker + @param lock_time the locked time, in microseconds +*/ +typedef void (*set_statement_lock_time_t) + (struct PSI_statement_locker *locker, ulonglong lock_time); + +/** + Set a statement event rows sent metric. + @param locker the statement locker + @param count the number of rows sent +*/ +typedef void (*set_statement_rows_sent_t) + (struct PSI_statement_locker *locker, ulonglong count); + +/** + Set a statement event rows examined metric. + @param locker the statement locker + @param count the number of rows examined +*/ +typedef void (*set_statement_rows_examined_t) + (struct PSI_statement_locker *locker, ulonglong count); + +/** + Increment a statement event "created tmp disk tables" metric. + @param locker the statement locker + @param count the metric increment value +*/ +typedef void (*inc_statement_created_tmp_disk_tables_t) + (struct PSI_statement_locker *locker, ulong count); + +/** + Increment a statement event "created tmp tables" metric. + @param locker the statement locker + @param count the metric increment value +*/ +typedef void (*inc_statement_created_tmp_tables_t) + (struct PSI_statement_locker *locker, ulong count); + +/** + Increment a statement event "select full join" metric. + @param locker the statement locker + @param count the metric increment value +*/ +typedef void (*inc_statement_select_full_join_t) + (struct PSI_statement_locker *locker, ulong count); + +/** + Increment a statement event "select full range join" metric. + @param locker the statement locker + @param count the metric increment value +*/ +typedef void (*inc_statement_select_full_range_join_t) + (struct PSI_statement_locker *locker, ulong count); + +/** + Increment a statement event "select range join" metric. + @param locker the statement locker + @param count the metric increment value +*/ +typedef void (*inc_statement_select_range_t) + (struct PSI_statement_locker *locker, ulong count); + +/** + Increment a statement event "select range check" metric. + @param locker the statement locker + @param count the metric increment value +*/ +typedef void (*inc_statement_select_range_check_t) + (struct PSI_statement_locker *locker, ulong count); + +/** + Increment a statement event "select scan" metric. + @param locker the statement locker + @param count the metric increment value +*/ +typedef void (*inc_statement_select_scan_t) + (struct PSI_statement_locker *locker, ulong count); + +/** + Increment a statement event "sort merge passes" metric. + @param locker the statement locker + @param count the metric increment value +*/ +typedef void (*inc_statement_sort_merge_passes_t) + (struct PSI_statement_locker *locker, ulong count); + +/** + Increment a statement event "sort range" metric. + @param locker the statement locker + @param count the metric increment value +*/ +typedef void (*inc_statement_sort_range_t) + (struct PSI_statement_locker *locker, ulong count); + +/** + Increment a statement event "sort rows" metric. + @param locker the statement locker + @param count the metric increment value +*/ +typedef void (*inc_statement_sort_rows_t) + (struct PSI_statement_locker *locker, ulong count); + +/** + Increment a statement event "sort scan" metric. + @param locker the statement locker + @param count the metric increment value +*/ +typedef void (*inc_statement_sort_scan_t) + (struct PSI_statement_locker *locker, ulong count); + +/** + Set a statement event "no index used" metric. + @param locker the statement locker + @param count the metric value +*/ +typedef void (*set_statement_no_index_used_t) + (struct PSI_statement_locker *locker); + +/** + Set a statement event "no good index used" metric. + @param locker the statement locker + @param count the metric value +*/ +typedef void (*set_statement_no_good_index_used_t) + (struct PSI_statement_locker *locker); + +/** + End a statement event. + @param locker the statement locker + @param stmt_da the statement diagnostics area. + @sa Diagnostics_area +*/ +typedef void (*end_statement_v1_t) + (struct PSI_statement_locker *locker, void *stmt_da); + +/** + Get a transaction instrumentation locker. + @param state data storage for the locker + @param xid the xid for this transaction + @param trxid the InnoDB transaction id + @param iso_level isolation level for this transaction + @param read_only true if transaction access mode is read-only + @param autocommit true if transaction is autocommit + @return a transaction locker, or NULL +*/ +typedef struct PSI_transaction_locker* (*get_thread_transaction_locker_v1_t) + (struct PSI_transaction_locker_state_v1 *state, const void *xid, + const ulonglong *trxid, int isolation_level, my_bool read_only, + my_bool autocommit); + +/** + Start a new transaction event. + @param locker the transaction locker for this event + @param src_file source file name + @param src_line source line number +*/ +typedef void (*start_transaction_v1_t) + (struct PSI_transaction_locker *locker, + const char *src_file, uint src_line); + +/** + Set the transaction xid. + @param locker the transaction locker for this event + @param xid the id of the XA transaction + #param xa_state is the state of the XA transaction +*/ +typedef void (*set_transaction_xid_v1_t) + (struct PSI_transaction_locker *locker, + const void *xid, int xa_state); + +/** + Set the state of the XA transaction. + @param locker the transaction locker for this event + @param xa_state the new state of the xa transaction +*/ +typedef void (*set_transaction_xa_state_v1_t) + (struct PSI_transaction_locker *locker, + int xa_state); + +/** + Set the transaction gtid. + @param locker the transaction locker for this event + @param sid the source id for the transaction, mapped from sidno + @param gtid_spec the gtid specifier for the transaction +*/ +typedef void (*set_transaction_gtid_v1_t) + (struct PSI_transaction_locker *locker, + const void *sid, const void *gtid_spec); + +/** + Set the transaction trx_id. + @param locker the transaction locker for this event + @param trxid the storage engine transaction ID +*/ +typedef void (*set_transaction_trxid_v1_t) + (struct PSI_transaction_locker *locker, + const ulonglong *trxid); + +/** + Increment a transaction event savepoint count. + @param locker the transaction locker + @param count the increment value +*/ +typedef void (*inc_transaction_savepoints_v1_t) + (struct PSI_transaction_locker *locker, ulong count); + +/** + Increment a transaction event rollback to savepoint count. + @param locker the transaction locker + @param count the increment value +*/ +typedef void (*inc_transaction_rollback_to_savepoint_v1_t) + (struct PSI_transaction_locker *locker, ulong count); + +/** + Increment a transaction event release savepoint count. + @param locker the transaction locker + @param count the increment value +*/ +typedef void (*inc_transaction_release_savepoint_v1_t) + (struct PSI_transaction_locker *locker, ulong count); + +/** + Commit or rollback the transaction. + @param locker the transaction locker for this event + @param commit true if transaction was committed, false if rolled back +*/ +typedef void (*end_transaction_v1_t) + (struct PSI_transaction_locker *locker, + my_bool commit); + +/** + Record a socket instrumentation start event. + @param locker a socket locker for the running thread + @param op socket operation to be performed + @param count the number of bytes requested, or 0 if not applicable + @param src_file the source file name + @param src_line the source line number +*/ +typedef struct PSI_socket_locker* (*start_socket_wait_v1_t) + (struct PSI_socket_locker_state_v1 *state, + struct PSI_socket *socket, + enum PSI_socket_operation op, + size_t count, + const char *src_file, uint src_line); + +/** + Record a socket instrumentation end event. + Note that for socket close operations, the instrumented socket handle + associated with the socket (which was provided to obtain a locker) + is invalid after this call. + @param locker a socket locker for the running thread + @param count the number of bytes actually used in the operation, + or 0 if not applicable, or -1 if the operation failed + @sa get_thread_socket_locker +*/ +typedef void (*end_socket_wait_v1_t) + (struct PSI_socket_locker *locker, size_t count); + +/** + Set the socket state for an instrumented socket. + @param socket the instrumented socket + @param state socket state + */ +typedef void (*set_socket_state_v1_t)(struct PSI_socket *socket, + enum PSI_socket_state state); + +/** + Set the socket info for an instrumented socket. + @param socket the instrumented socket + @param fd the socket descriptor + @param addr the socket ip address + @param addr_len length of socket ip address + @param thread_id associated thread id +*/ +typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket, + const my_socket *fd, + const struct sockaddr *addr, + socklen_t addr_len); + +/** + Bind a socket to the thread that owns it. + @param socket instrumented socket +*/ +typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket); + +/** + Get a prepare statement. + @param locker a statement locker for the running thread. +*/ +typedef PSI_prepared_stmt* (*create_prepared_stmt_v1_t) + (void *identity, uint stmt_id, PSI_statement_locker *locker, + const char *stmt_name, size_t stmt_name_length, + const char *name, size_t length); + +/** + destroy a prepare statement. + @param prepared_stmt prepared statement. +*/ +typedef void (*destroy_prepared_stmt_v1_t) + (PSI_prepared_stmt *prepared_stmt); + +/** + repreare a prepare statement. + @param prepared_stmt prepared statement. +*/ +typedef void (*reprepare_prepared_stmt_v1_t) + (PSI_prepared_stmt *prepared_stmt); + +/** + Record a prepare statement instrumentation execute event. + @param locker a statement locker for the running thread. + @param prepared_stmt prepared statement. +*/ +typedef void (*execute_prepared_stmt_v1_t) + (PSI_statement_locker *locker, PSI_prepared_stmt* prepared_stmt); + +/** + Get a digest locker for the current statement. + @param locker a statement locker for the running thread +*/ +typedef struct PSI_digest_locker * (*digest_start_v1_t) + (struct PSI_statement_locker *locker); + +/** + Add a token to the current digest instrumentation. + @param locker a digest locker for the current statement + @param token the lexical token to add + @param yylval the lexical token attributes +*/ +typedef void (*digest_end_v1_t) + (struct PSI_digest_locker *locker, const struct sql_digest_storage *digest); + +typedef PSI_sp_locker* (*start_sp_v1_t) + (struct PSI_sp_locker_state_v1 *state, struct PSI_sp_share* sp_share); + +typedef void (*end_sp_v1_t) + (struct PSI_sp_locker *locker); + +typedef void (*drop_sp_v1_t) + (uint object_type, + const char *schema_name, uint schema_name_length, + const char *object_name, uint object_name_length); + +/** + Acquire a sp share instrumentation. + @param type of stored program + @param schema name of stored program + @param name of stored program + @return a stored program share instrumentation, or NULL +*/ +typedef struct PSI_sp_share* (*get_sp_share_v1_t) + (uint object_type, + const char *schema_name, uint schema_name_length, + const char *object_name, uint object_name_length); + +/** + Release a stored program share. + @param info the stored program share to release +*/ +typedef void (*release_sp_share_v1_t)(struct PSI_sp_share *share); + +typedef PSI_metadata_lock* (*create_metadata_lock_v1_t) + (void *identity, + const MDL_key *key, + opaque_mdl_type mdl_type, + opaque_mdl_duration mdl_duration, + opaque_mdl_status mdl_status, + const char *src_file, + uint src_line); + +typedef void (*set_metadata_lock_status_v1_t)(PSI_metadata_lock *lock, + opaque_mdl_status mdl_status); + +typedef void (*destroy_metadata_lock_v1_t)(PSI_metadata_lock *lock); + +typedef struct PSI_metadata_locker* (*start_metadata_wait_v1_t) + (struct PSI_metadata_locker_state_v1 *state, + struct PSI_metadata_lock *mdl, + const char *src_file, uint src_line); + +typedef void (*end_metadata_wait_v1_t) + (struct PSI_metadata_locker *locker, int rc); + +/** + Stores an array of connection attributes + @param buffer char array of length encoded connection attributes + in network format + @param length length of the data in buffer + @param from_cs charset in which @c buffer is encoded + @return state + @retval non_0 attributes truncated + @retval 0 stored the attribute +*/ +typedef int (*set_thread_connect_attrs_v1_t)(const char *buffer, uint length, + const void *from_cs); + +/** + Performance Schema Interface, version 1. + @since PSI_VERSION_1 +*/ +struct PSI_v1 +{ + /** @sa register_mutex_v1_t. */ + register_mutex_v1_t register_mutex; + /** @sa register_rwlock_v1_t. */ + register_rwlock_v1_t register_rwlock; + /** @sa register_cond_v1_t. */ + register_cond_v1_t register_cond; + /** @sa register_thread_v1_t. */ + register_thread_v1_t register_thread; + /** @sa register_file_v1_t. */ + register_file_v1_t register_file; + /** @sa register_stage_v1_t. */ + register_stage_v1_t register_stage; + /** @sa register_statement_v1_t. */ + register_statement_v1_t register_statement; + /** @sa register_socket_v1_t. */ + register_socket_v1_t register_socket; + /** @sa init_mutex_v1_t. */ + init_mutex_v1_t init_mutex; + /** @sa destroy_mutex_v1_t. */ + destroy_mutex_v1_t destroy_mutex; + /** @sa init_rwlock_v1_t. */ + init_rwlock_v1_t init_rwlock; + /** @sa destroy_rwlock_v1_t. */ + destroy_rwlock_v1_t destroy_rwlock; + /** @sa init_cond_v1_t. */ + init_cond_v1_t init_cond; + /** @sa destroy_cond_v1_t. */ + destroy_cond_v1_t destroy_cond; + /** @sa init_socket_v1_t. */ + init_socket_v1_t init_socket; + /** @sa destroy_socket_v1_t. */ + destroy_socket_v1_t destroy_socket; + + /** @sa get_table_share_v1_t. */ + get_table_share_v1_t get_table_share; + /** @sa release_table_share_v1_t. */ + release_table_share_v1_t release_table_share; + /** @sa drop_table_share_v1_t. */ + drop_table_share_v1_t drop_table_share; + /** @sa open_table_v1_t. */ + open_table_v1_t open_table; + /** @sa unbind_table_v1_t. */ + unbind_table_v1_t unbind_table; + /** @sa rebind_table_v1_t. */ + rebind_table_v1_t rebind_table; + /** @sa close_table_v1_t. */ + close_table_v1_t close_table; + /** @sa create_file_v1_t. */ + create_file_v1_t create_file; + /** @sa spawn_thread_v1_t. */ + spawn_thread_v1_t spawn_thread; + /** @sa new_thread_v1_t. */ + new_thread_v1_t new_thread; + /** @sa set_thread_id_v1_t. */ + set_thread_id_v1_t set_thread_id; + /** @sa set_thread_THD_v1_t. */ + set_thread_THD_v1_t set_thread_THD; + /** @sa set_thread_os_id_v1_t. */ + set_thread_os_id_v1_t set_thread_os_id; + /** @sa get_thread_v1_t. */ + get_thread_v1_t get_thread; + /** @sa set_thread_user_v1_t. */ + set_thread_user_v1_t set_thread_user; + /** @sa set_thread_account_v1_t. */ + set_thread_account_v1_t set_thread_account; + /** @sa set_thread_db_v1_t. */ + set_thread_db_v1_t set_thread_db; + /** @sa set_thread_command_v1_t. */ + set_thread_command_v1_t set_thread_command; + /** @sa set_connection_type_v1_t. */ + set_connection_type_v1_t set_connection_type; + /** @sa set_thread_start_time_v1_t. */ + set_thread_start_time_v1_t set_thread_start_time; + /** @sa set_thread_state_v1_t. */ + set_thread_state_v1_t set_thread_state; + /** @sa set_thread_info_v1_t. */ + set_thread_info_v1_t set_thread_info; + /** @sa set_thread_v1_t. */ + set_thread_v1_t set_thread; + /** @sa delete_current_thread_v1_t. */ + delete_current_thread_v1_t delete_current_thread; + /** @sa delete_thread_v1_t. */ + delete_thread_v1_t delete_thread; + /** @sa get_thread_file_name_locker_v1_t. */ + get_thread_file_name_locker_v1_t get_thread_file_name_locker; + /** @sa get_thread_file_stream_locker_v1_t. */ + get_thread_file_stream_locker_v1_t get_thread_file_stream_locker; + /** @sa get_thread_file_descriptor_locker_v1_t. */ + get_thread_file_descriptor_locker_v1_t get_thread_file_descriptor_locker; + /** @sa unlock_mutex_v1_t. */ + unlock_mutex_v1_t unlock_mutex; + /** @sa unlock_rwlock_v1_t. */ + unlock_rwlock_v1_t unlock_rwlock; + /** @sa signal_cond_v1_t. */ + signal_cond_v1_t signal_cond; + /** @sa broadcast_cond_v1_t. */ + broadcast_cond_v1_t broadcast_cond; + /** @sa start_idle_wait_v1_t. */ + start_idle_wait_v1_t start_idle_wait; + /** @sa end_idle_wait_v1_t. */ + end_idle_wait_v1_t end_idle_wait; + /** @sa start_mutex_wait_v1_t. */ + start_mutex_wait_v1_t start_mutex_wait; + /** @sa end_mutex_wait_v1_t. */ + end_mutex_wait_v1_t end_mutex_wait; + /** @sa start_rwlock_rdwait_v1_t. */ + start_rwlock_rdwait_v1_t start_rwlock_rdwait; + /** @sa end_rwlock_rdwait_v1_t. */ + end_rwlock_rdwait_v1_t end_rwlock_rdwait; + /** @sa start_rwlock_wrwait_v1_t. */ + start_rwlock_wrwait_v1_t start_rwlock_wrwait; + /** @sa end_rwlock_wrwait_v1_t. */ + end_rwlock_wrwait_v1_t end_rwlock_wrwait; + /** @sa start_cond_wait_v1_t. */ + start_cond_wait_v1_t start_cond_wait; + /** @sa end_cond_wait_v1_t. */ + end_cond_wait_v1_t end_cond_wait; + /** @sa start_table_io_wait_v1_t. */ + start_table_io_wait_v1_t start_table_io_wait; + /** @sa end_table_io_wait_v1_t. */ + end_table_io_wait_v1_t end_table_io_wait; + /** @sa start_table_lock_wait_v1_t. */ + start_table_lock_wait_v1_t start_table_lock_wait; + /** @sa end_table_lock_wait_v1_t. */ + end_table_lock_wait_v1_t end_table_lock_wait; + /** @sa start_file_open_wait_v1_t. */ + start_file_open_wait_v1_t start_file_open_wait; + /** @sa end_file_open_wait_v1_t. */ + end_file_open_wait_v1_t end_file_open_wait; + /** @sa end_file_open_wait_and_bind_to_descriptor_v1_t. */ + end_file_open_wait_and_bind_to_descriptor_v1_t + end_file_open_wait_and_bind_to_descriptor; + /** @sa end_temp_file_open_wait_and_bind_to_descriptor_v1_t. */ + end_temp_file_open_wait_and_bind_to_descriptor_v1_t + end_temp_file_open_wait_and_bind_to_descriptor; + /** @sa start_file_wait_v1_t. */ + start_file_wait_v1_t start_file_wait; + /** @sa end_file_wait_v1_t. */ + end_file_wait_v1_t end_file_wait; + /** @sa start_file_close_wait_v1_t. */ + start_file_close_wait_v1_t start_file_close_wait; + /** @sa end_file_close_wait_v1_t. */ + end_file_close_wait_v1_t end_file_close_wait; + /** @sa start_stage_v1_t. */ + start_stage_v1_t start_stage; + /** @sa get_current_stage_progress_v1_t. */ + get_current_stage_progress_v1_t get_current_stage_progress; + /** @sa end_stage_v1_t. */ + end_stage_v1_t end_stage; + /** @sa get_thread_statement_locker_v1_t. */ + get_thread_statement_locker_v1_t get_thread_statement_locker; + /** @sa refine_statement_v1_t. */ + refine_statement_v1_t refine_statement; + /** @sa start_statement_v1_t. */ + start_statement_v1_t start_statement; + /** @sa set_statement_text_v1_t. */ + set_statement_text_v1_t set_statement_text; + /** @sa set_statement_lock_time_t. */ + set_statement_lock_time_t set_statement_lock_time; + /** @sa set_statement_rows_sent_t. */ + set_statement_rows_sent_t set_statement_rows_sent; + /** @sa set_statement_rows_examined_t. */ + set_statement_rows_examined_t set_statement_rows_examined; + /** @sa inc_statement_created_tmp_disk_tables. */ + inc_statement_created_tmp_disk_tables_t inc_statement_created_tmp_disk_tables; + /** @sa inc_statement_created_tmp_tables. */ + inc_statement_created_tmp_tables_t inc_statement_created_tmp_tables; + /** @sa inc_statement_select_full_join. */ + inc_statement_select_full_join_t inc_statement_select_full_join; + /** @sa inc_statement_select_full_range_join. */ + inc_statement_select_full_range_join_t inc_statement_select_full_range_join; + /** @sa inc_statement_select_range. */ + inc_statement_select_range_t inc_statement_select_range; + /** @sa inc_statement_select_range_check. */ + inc_statement_select_range_check_t inc_statement_select_range_check; + /** @sa inc_statement_select_scan. */ + inc_statement_select_scan_t inc_statement_select_scan; + /** @sa inc_statement_sort_merge_passes. */ + inc_statement_sort_merge_passes_t inc_statement_sort_merge_passes; + /** @sa inc_statement_sort_range. */ + inc_statement_sort_range_t inc_statement_sort_range; + /** @sa inc_statement_sort_rows. */ + inc_statement_sort_rows_t inc_statement_sort_rows; + /** @sa inc_statement_sort_scan. */ + inc_statement_sort_scan_t inc_statement_sort_scan; + /** @sa set_statement_no_index_used. */ + set_statement_no_index_used_t set_statement_no_index_used; + /** @sa set_statement_no_good_index_used. */ + set_statement_no_good_index_used_t set_statement_no_good_index_used; + /** @sa end_statement_v1_t. */ + end_statement_v1_t end_statement; + /** @sa get_thread_transaction_locker_v1_t. */ + get_thread_transaction_locker_v1_t get_thread_transaction_locker; + /** @sa start_transaction_v1_t. */ + start_transaction_v1_t start_transaction; + /** @sa set_transaction_xid_v1_t. */ + set_transaction_xid_v1_t set_transaction_xid; + /** @sa set_transaction_xa_state_v1_t. */ + set_transaction_xa_state_v1_t set_transaction_xa_state; + /** @sa set_transaction_gtid_v1_t. */ + set_transaction_gtid_v1_t set_transaction_gtid; + /** @sa set_transaction_trxid_v1_t. */ + set_transaction_trxid_v1_t set_transaction_trxid; + /** @sa inc_transaction_savepoints_v1_t. */ + inc_transaction_savepoints_v1_t inc_transaction_savepoints; + /** @sa inc_transaction_rollback_to_savepoint_v1_t. */ + inc_transaction_rollback_to_savepoint_v1_t inc_transaction_rollback_to_savepoint; + /** @sa inc_transaction_release_savepoint_v1_t. */ + inc_transaction_release_savepoint_v1_t inc_transaction_release_savepoint; + /** @sa end_transaction_v1_t. */ + end_transaction_v1_t end_transaction; + /** @sa start_socket_wait_v1_t. */ + start_socket_wait_v1_t start_socket_wait; + /** @sa end_socket_wait_v1_t. */ + end_socket_wait_v1_t end_socket_wait; + /** @sa set_socket_state_v1_t. */ + set_socket_state_v1_t set_socket_state; + /** @sa set_socket_info_v1_t. */ + set_socket_info_v1_t set_socket_info; + /** @sa set_socket_thread_owner_v1_t. */ + set_socket_thread_owner_v1_t set_socket_thread_owner; + /** @sa create_prepared_stmt_v1_t. */ + create_prepared_stmt_v1_t create_prepared_stmt; + /** @sa destroy_prepared_stmt_v1_t. */ + destroy_prepared_stmt_v1_t destroy_prepared_stmt; + /** @sa reprepare_prepared_stmt_v1_t. */ + reprepare_prepared_stmt_v1_t reprepare_prepared_stmt; + /** @sa execute_prepared_stmt_v1_t. */ + execute_prepared_stmt_v1_t execute_prepared_stmt; + /** @sa digest_start_v1_t. */ + digest_start_v1_t digest_start; + /** @sa digest_end_v1_t. */ + digest_end_v1_t digest_end; + /** @sa set_thread_connect_attrs_v1_t. */ + set_thread_connect_attrs_v1_t set_thread_connect_attrs; + /** @sa start_sp_v1_t. */ + start_sp_v1_t start_sp; + /** @sa start_sp_v1_t. */ + end_sp_v1_t end_sp; + /** @sa drop_sp_v1_t. */ + drop_sp_v1_t drop_sp; + /** @sa get_sp_share_v1_t. */ + get_sp_share_v1_t get_sp_share; + /** @sa release_sp_share_v1_t. */ + release_sp_share_v1_t release_sp_share; + /** @sa register_memory_v1_t. */ + register_memory_v1_t register_memory; + /** @sa memory_alloc_v1_t. */ + memory_alloc_v1_t memory_alloc; + /** @sa memory_realloc_v1_t. */ + memory_realloc_v1_t memory_realloc; + /** @sa memory_claim_v1_t. */ + memory_claim_v1_t memory_claim; + /** @sa memory_free_v1_t. */ + memory_free_v1_t memory_free; + + unlock_table_v1_t unlock_table; + + create_metadata_lock_v1_t create_metadata_lock; + set_metadata_lock_status_v1_t set_metadata_lock_status; + destroy_metadata_lock_v1_t destroy_metadata_lock; + + start_metadata_wait_v1_t start_metadata_wait; + end_metadata_wait_v1_t end_metadata_wait; +}; + +/** @} (end of group Group_PSI_v1) */ + +#endif /* HAVE_PSI_1 */ + +#ifdef USE_PSI_2 +#define HAVE_PSI_2 +#endif + +#ifdef HAVE_PSI_2 + +/** + @defgroup Group_PSI_v2 Application Binary Interface, version 2 + @ingroup Instrumentation_interface + @{ +*/ + +/** + Performance Schema Interface, version 2. + This is a placeholder, this interface is not defined yet. + @since PSI_VERSION_2 +*/ +struct PSI_v2 +{ + /** Placeholder */ + int placeholder; + /* ... extended interface ... */ +}; + +/** Placeholder */ +struct PSI_mutex_info_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_rwlock_info_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_cond_info_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_thread_info_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_file_info_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_stage_info_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_statement_info_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_transaction_info_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_idle_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_mutex_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_rwlock_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_cond_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_file_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_statement_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_transaction_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +/** Placeholder */ +struct PSI_socket_locker_state_v2 +{ + /** Placeholder */ + int placeholder; +}; + +struct PSI_metadata_locker_state_v2 +{ + int placeholder; +}; + +/** @} (end of group Group_PSI_v2) */ + +#endif /* HAVE_PSI_2 */ + +/** + @typedef PSI + The instrumentation interface for the current version. + @sa PSI_CURRENT_VERSION +*/ + +/** + @typedef PSI_mutex_info + The mutex information structure for the current version. +*/ + +/** + @typedef PSI_rwlock_info + The rwlock information structure for the current version. +*/ + +/** + @typedef PSI_cond_info + The cond information structure for the current version. +*/ + +/** + @typedef PSI_thread_info + The thread information structure for the current version. +*/ + +/** + @typedef PSI_file_info + The file information structure for the current version. +*/ + +/* Export the required version */ +#ifdef USE_PSI_1 +typedef struct PSI_v1 PSI; +typedef struct PSI_mutex_info_v1 PSI_mutex_info; +typedef struct PSI_rwlock_info_v1 PSI_rwlock_info; +typedef struct PSI_cond_info_v1 PSI_cond_info; +typedef struct PSI_thread_info_v1 PSI_thread_info; +typedef struct PSI_file_info_v1 PSI_file_info; +typedef struct PSI_stage_info_v1 PSI_stage_info; +typedef struct PSI_statement_info_v1 PSI_statement_info; +typedef struct PSI_transaction_info_v1 PSI_transaction_info; +typedef struct PSI_socket_info_v1 PSI_socket_info; +typedef struct PSI_idle_locker_state_v1 PSI_idle_locker_state; +typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state; +typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state; +typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state; +typedef struct PSI_file_locker_state_v1 PSI_file_locker_state; +typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state; +typedef struct PSI_transaction_locker_state_v1 PSI_transaction_locker_state; +typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state; +typedef struct PSI_sp_locker_state_v1 PSI_sp_locker_state; +typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state; +#endif + +#ifdef USE_PSI_2 +typedef struct PSI_v2 PSI; +typedef struct PSI_mutex_info_v2 PSI_mutex_info; +typedef struct PSI_rwlock_info_v2 PSI_rwlock_info; +typedef struct PSI_cond_info_v2 PSI_cond_info; +typedef struct PSI_thread_info_v2 PSI_thread_info; +typedef struct PSI_file_info_v2 PSI_file_info; +typedef struct PSI_stage_info_v2 PSI_stage_info; +typedef struct PSI_statement_info_v2 PSI_statement_info; +typedef struct PSI_transaction_info_v2 PSI_transaction_info; +typedef struct PSI_socket_info_v2 PSI_socket_info; +typedef struct PSI_idle_locker_state_v2 PSI_idle_locker_state; +typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state; +typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state; +typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state; +typedef struct PSI_file_locker_state_v2 PSI_file_locker_state; +typedef struct PSI_statement_locker_state_v2 PSI_statement_locker_state; +typedef struct PSI_transaction_locker_state_v2 PSI_transaction_locker_state; +typedef struct PSI_socket_locker_state_v2 PSI_socket_locker_state; +typedef struct PSI_sp_locker_state_v2 PSI_sp_locker_state; +typedef struct PSI_metadata_locker_state_v2 PSI_metadata_locker_state; +#endif + +#else /* HAVE_PSI_INTERFACE */ + +/** + Dummy structure, used to declare PSI_server when no instrumentation + is available. + The content does not matter, since PSI_server will be NULL. +*/ +struct PSI_none +{ + int opaque; +}; +typedef struct PSI_none PSI; + +/** + Stage instrument information. + @since PSI_VERSION_1 + This structure is used to register an instrumented stage. +*/ +struct PSI_stage_info_none +{ + /** Unused stage key. */ + unsigned int m_key; + /** The name of the stage instrument. */ + const char *m_name; + /** Unused stage flags. */ + int m_flags; +}; + +/** + The stage instrumentation has to co exist with the legacy + THD::set_proc_info instrumentation. + To avoid duplication of the instrumentation in the server, + the common PSI_stage_info structure is used, + so we export it here, even when not building + with HAVE_PSI_INTERFACE. +*/ +typedef struct PSI_stage_info_none PSI_stage_info; + +#endif /* HAVE_PSI_INTERFACE */ + +extern MYSQL_PLUGIN_IMPORT PSI *PSI_server; + +/* + Allow to override PSI_XXX_CALL at compile time + with more efficient implementations, if available. + If nothing better is available, + make a dynamic call using the PSI_server function pointer. +*/ + +#define PSI_DYNAMIC_CALL(M) PSI_server->M + +/** @} */ + +C_MODE_END +#endif /* MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H */ + diff --git a/3rdparty/mysql/include/mysql/psi/psi_base.h b/3rdparty/mysql/include/mysql/psi/psi_base.h new file mode 100644 index 0000000000..94cb5c9f51 --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/psi_base.h @@ -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 */ + diff --git a/3rdparty/mysql/include/mysql/psi/psi_memory.h b/3rdparty/mysql/include/mysql/psi/psi_memory.h new file mode 100644 index 0000000000..725b3ed77d --- /dev/null +++ b/3rdparty/mysql/include/mysql/psi/psi_memory.h @@ -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 */ + diff --git a/3rdparty/mysql/include/mysql/service_my_snprintf.h b/3rdparty/mysql/include/mysql/service_my_snprintf.h new file mode 100644 index 0000000000..d734ae155e --- /dev/null +++ b/3rdparty/mysql/include/mysql/service_my_snprintf.h @@ -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: + % + where everithing but the format is optional. + + Three one-character flags are recognized: + '0' has the standard zero-padding semantics; + '-' is parsed, but silently ignored; + '`' (backtick) is only supported for strings (%s) and means that the + string will be quoted according to MySQL identifier quoting rules. + + Both and can be specified as numbers or '*'. + If an asterisk is used, an argument of type int is consumed. + + can be 'l', 'll', or 'z'. + + Supported formats are 's' (null pointer is accepted, printed as + "(null)"), 'b' (extension, see below), 'c', 'd', 'i', 'u', 'x', 'o', + 'X', 'p' (works as 0x%x). + + Standard syntax for positional arguments $n is supported. + + Extensions: + + Flag '`' (backtick): see above. + + Format 'b': binary buffer, prints exactly bytes from the + argument, without stopping at '\0'. +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MYSQL_ABI_CHECK +#include +#include +#endif + +extern struct my_snprintf_service_st { + size_t (*my_snprintf_type)(char*, size_t, const char*, ...); + size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list); +} *my_snprintf_service; + +#ifdef MYSQL_DYNAMIC_PLUGIN + +#define my_vsnprintf my_snprintf_service->my_vsnprintf_type +#define my_snprintf my_snprintf_service->my_snprintf_type + +#else + +size_t my_snprintf(char* to, size_t n, const char* fmt, ...); +size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* #define MYSQL_SERVICE_MY_SNPRINTF_INCLUDED */ diff --git a/3rdparty/mysql/include/mysql/service_mysql_alloc.h b/3rdparty/mysql/include/mysql/service_mysql_alloc.h new file mode 100644 index 0000000000..a43a169daf --- /dev/null +++ b/3rdparty/mysql/include/mysql/service_mysql_alloc.h @@ -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 +#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 + diff --git a/3rdparty/mysql/include/mysql_com.h b/3rdparty/mysql/include/mysql_com.h index ec1c133799..fd30b8439e 100644 --- a/3rdparty/mysql/include/mysql_com.h +++ b/3rdparty/mysql/include/mysql_com.h @@ -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 diff --git a/3rdparty/mysql/include/mysql_com_server.h b/3rdparty/mysql/include/mysql_com_server.h new file mode 100644 index 0000000000..1ea040207d --- /dev/null +++ b/3rdparty/mysql/include/mysql_com_server.h @@ -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 diff --git a/3rdparty/mysql/include/mysql_embed.h b/3rdparty/mysql/include/mysql_embed.h new file mode 100644 index 0000000000..cdee3a98a8 --- /dev/null +++ b/3rdparty/mysql/include/mysql_embed.h @@ -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 */ diff --git a/3rdparty/mysql/include/mysql_time.h b/3rdparty/mysql/include/mysql_time.h index 5f4fc12c00..ac9719c68c 100644 --- a/3rdparty/mysql/include/mysql_time.h +++ b/3rdparty/mysql/include/mysql_time.h @@ -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; diff --git a/3rdparty/mysql/include/mysql_version.h b/3rdparty/mysql/include/mysql_version.h index 473a199871..b065bfd738 100644 --- a/3rdparty/mysql/include/mysql_version.h +++ b/3rdparty/mysql/include/mysql_version.h @@ -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 #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 */ diff --git a/3rdparty/mysql/include/mysqld_ername.h b/3rdparty/mysql/include/mysqld_ername.h new file mode 100644 index 0000000000..50d6531cf2 --- /dev/null +++ b/3rdparty/mysql/include/mysqld_ername.h @@ -0,0 +1,1082 @@ +/* Autogenerated file, please don't edit */ + +{ "ER_HASHCHK", 1000, "hashchk" }, +{ "ER_NISAMCHK", 1001, "isamchk" }, +{ "ER_NO", 1002, "NO" }, +{ "ER_YES", 1003, "YES" }, +{ "ER_CANT_CREATE_FILE", 1004, "Can\'t create file \'%-.200s\' (errno: %d - %s)" }, +{ "ER_CANT_CREATE_TABLE", 1005, "Can\'t create table \'%-.200s\' (errno: %d)" }, +{ "ER_CANT_CREATE_DB", 1006, "Can\'t create database \'%-.192s\' (errno: %d)" }, +{ "ER_DB_CREATE_EXISTS", 1007, "Can\'t create database \'%-.192s\'; database exists" }, +{ "ER_DB_DROP_EXISTS", 1008, "Can\'t drop database \'%-.192s\'; database doesn\'t exist" }, +{ "ER_DB_DROP_DELETE", 1009, "Error dropping database (can\'t delete \'%-.192s\', errno: %d)" }, +{ "ER_DB_DROP_RMDIR", 1010, "Error dropping database (can\'t rmdir \'%-.192s\', errno: %d)" }, +{ "ER_CANT_DELETE_FILE", 1011, "Error on delete of \'%-.192s\' (errno: %d - %s)" }, +{ "ER_CANT_FIND_SYSTEM_REC", 1012, "Can\'t read record in system table" }, +{ "ER_CANT_GET_STAT", 1013, "Can\'t get status of \'%-.200s\' (errno: %d - %s)" }, +{ "ER_CANT_GET_WD", 1014, "Can\'t get working directory (errno: %d - %s)" }, +{ "ER_CANT_LOCK", 1015, "Can\'t lock file (errno: %d - %s)" }, +{ "ER_CANT_OPEN_FILE", 1016, "Can\'t open file: \'%-.200s\' (errno: %d - %s)" }, +{ "ER_FILE_NOT_FOUND", 1017, "Can\'t find file: \'%-.200s\' (errno: %d - %s)" }, +{ "ER_CANT_READ_DIR", 1018, "Can\'t read dir of \'%-.192s\' (errno: %d - %s)" }, +{ "ER_CANT_SET_WD", 1019, "Can\'t change dir to \'%-.192s\' (errno: %d - %s)" }, +{ "ER_CHECKREAD", 1020, "Record has changed since last read in table \'%-.192s\'" }, +{ "ER_DISK_FULL", 1021, "Disk full (%s); waiting for someone to free some space... (errno: %d - %s)" }, +{ "ER_DUP_KEY", 1022, "Can\'t write; duplicate key in table \'%-.192s\'" }, +{ "ER_ERROR_ON_CLOSE", 1023, "Error on close of \'%-.192s\' (errno: %d - %s)" }, +{ "ER_ERROR_ON_READ", 1024, "Error reading file \'%-.200s\' (errno: %d - %s)" }, +{ "ER_ERROR_ON_RENAME", 1025, "Error on rename of \'%-.210s\' to \'%-.210s\' (errno: %d - %s)" }, +{ "ER_ERROR_ON_WRITE", 1026, "Error writing file \'%-.200s\' (errno: %d - %s)" }, +{ "ER_FILE_USED", 1027, "\'%-.192s\' is locked against change" }, +{ "ER_FILSORT_ABORT", 1028, "Sort aborted" }, +{ "ER_FORM_NOT_FOUND", 1029, "View \'%-.192s\' doesn\'t exist for \'%-.192s\'" }, +{ "ER_GET_ERRNO", 1030, "Got error %d from storage engine" }, +{ "ER_ILLEGAL_HA", 1031, "Table storage engine for \'%-.192s\' doesn\'t have this option" }, +{ "ER_KEY_NOT_FOUND", 1032, "Can\'t find record in \'%-.192s\'" }, +{ "ER_NOT_FORM_FILE", 1033, "Incorrect information in file: \'%-.200s\'" }, +{ "ER_NOT_KEYFILE", 1034, "Incorrect key file for table \'%-.200s\'; try to repair it" }, +{ "ER_OLD_KEYFILE", 1035, "Old key file for table \'%-.192s\'; repair it!" }, +{ "ER_OPEN_AS_READONLY", 1036, "Table \'%-.192s\' is read only" }, +{ "ER_OUTOFMEMORY", 1037, "Out of memory; restart server and try again (needed %d bytes)" }, +{ "ER_OUT_OF_SORTMEMORY", 1038, "Out of sort memory, consider increasing server sort buffer size" }, +{ "ER_UNEXPECTED_EOF", 1039, "Unexpected EOF found when reading file \'%-.192s\' (errno: %d - %s)" }, +{ "ER_CON_COUNT_ERROR", 1040, "Too many connections" }, +{ "ER_OUT_OF_RESOURCES", 1041, "Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use \'ulimit\' to allow mysqld to use more memory or you can add more swap space" }, +{ "ER_BAD_HOST_ERROR", 1042, "Can\'t get hostname for your address" }, +{ "ER_HANDSHAKE_ERROR", 1043, "Bad handshake" }, +{ "ER_DBACCESS_DENIED_ERROR", 1044, "Access denied for user \'%-.48s\'@\'%-.64s\' to database \'%-.192s\'" }, +{ "ER_ACCESS_DENIED_ERROR", 1045, "Access denied for user \'%-.48s\'@\'%-.64s\' (using password: %s)" }, +{ "ER_NO_DB_ERROR", 1046, "No database selected" }, +{ "ER_UNKNOWN_COM_ERROR", 1047, "Unknown command" }, +{ "ER_BAD_NULL_ERROR", 1048, "Column \'%-.192s\' cannot be null" }, +{ "ER_BAD_DB_ERROR", 1049, "Unknown database \'%-.192s\'" }, +{ "ER_TABLE_EXISTS_ERROR", 1050, "Table \'%-.192s\' already exists" }, +{ "ER_BAD_TABLE_ERROR", 1051, "Unknown table \'%-.100s\'" }, +{ "ER_NON_UNIQ_ERROR", 1052, "Column \'%-.192s\' in %-.192s is ambiguous" }, +{ "ER_SERVER_SHUTDOWN", 1053, "Server shutdown in progress" }, +{ "ER_BAD_FIELD_ERROR", 1054, "Unknown column \'%-.192s\' in \'%-.192s\'" }, +{ "ER_WRONG_FIELD_WITH_GROUP", 1055, "\'%-.192s\' isn\'t in GROUP BY" }, +{ "ER_WRONG_GROUP_FIELD", 1056, "Can\'t group on \'%-.192s\'" }, +{ "ER_WRONG_SUM_SELECT", 1057, "Statement has sum functions and columns in same statement" }, +{ "ER_WRONG_VALUE_COUNT", 1058, "Column count doesn\'t match value count" }, +{ "ER_TOO_LONG_IDENT", 1059, "Identifier name \'%-.100s\' is too long" }, +{ "ER_DUP_FIELDNAME", 1060, "Duplicate column name \'%-.192s\'" }, +{ "ER_DUP_KEYNAME", 1061, "Duplicate key name \'%-.192s\'" }, +{ "ER_DUP_ENTRY", 1062, "Duplicate entry \'%-.192s\' for key %d" }, +{ "ER_WRONG_FIELD_SPEC", 1063, "Incorrect column specifier for column \'%-.192s\'" }, +{ "ER_PARSE_ERROR", 1064, "%s near \'%-.80s\' at line %d" }, +{ "ER_EMPTY_QUERY", 1065, "Query was empty" }, +{ "ER_NONUNIQ_TABLE", 1066, "Not unique table/alias: \'%-.192s\'" }, +{ "ER_INVALID_DEFAULT", 1067, "Invalid default value for \'%-.192s\'" }, +{ "ER_MULTIPLE_PRI_KEY", 1068, "Multiple primary key defined" }, +{ "ER_TOO_MANY_KEYS", 1069, "Too many keys specified; max %d keys allowed" }, +{ "ER_TOO_MANY_KEY_PARTS", 1070, "Too many key parts specified; max %d parts allowed" }, +{ "ER_TOO_LONG_KEY", 1071, "Specified key was too long; max key length is %d bytes" }, +{ "ER_KEY_COLUMN_DOES_NOT_EXITS", 1072, "Key column \'%-.192s\' doesn\'t exist in table" }, +{ "ER_BLOB_USED_AS_KEY", 1073, "BLOB column \'%-.192s\' can\'t be used in key specification with the used table type" }, +{ "ER_TOO_BIG_FIELDLENGTH", 1074, "Column length too big for column \'%-.192s\' (max = %lu); use BLOB or TEXT instead" }, +{ "ER_WRONG_AUTO_KEY", 1075, "Incorrect table definition; there can be only one auto column and it must be defined as a key" }, +{ "ER_READY", 1076, "%s: ready for connections.\nVersion: \'%s\' socket: \'%s\' port: %d" }, +{ "ER_NORMAL_SHUTDOWN", 1077, "%s: Normal shutdown\n" }, +{ "ER_GOT_SIGNAL", 1078, "%s: Got signal %d. Aborting!\n" }, +{ "ER_SHUTDOWN_COMPLETE", 1079, "%s: Shutdown complete\n" }, +{ "ER_FORCING_CLOSE", 1080, "%s: Forcing close of thread %ld user: \'%-.48s\'\n" }, +{ "ER_IPSOCK_ERROR", 1081, "Can\'t create IP socket" }, +{ "ER_NO_SUCH_INDEX", 1082, "Table \'%-.192s\' has no index like the one used in CREATE INDEX; recreate the table" }, +{ "ER_WRONG_FIELD_TERMINATORS", 1083, "Field separator argument is not what is expected; check the manual" }, +{ "ER_BLOBS_AND_NO_TERMINATED", 1084, "You can\'t use fixed rowlength with BLOBs; please use \'fields terminated by\'" }, +{ "ER_TEXTFILE_NOT_READABLE", 1085, "The file \'%-.128s\' must be in the database directory or be readable by all" }, +{ "ER_FILE_EXISTS_ERROR", 1086, "File \'%-.200s\' already exists" }, +{ "ER_LOAD_INFO", 1087, "Records: %ld Deleted: %ld Skipped: %ld Warnings: %ld" }, +{ "ER_ALTER_INFO", 1088, "Records: %ld Duplicates: %ld" }, +{ "ER_WRONG_SUB_KEY", 1089, "Incorrect prefix key; the used key part isn\'t a string, the used length is longer than the key part, or the storage engine doesn\'t support unique prefix keys" }, +{ "ER_CANT_REMOVE_ALL_FIELDS", 1090, "You can\'t delete all columns with ALTER TABLE; use DROP TABLE instead" }, +{ "ER_CANT_DROP_FIELD_OR_KEY", 1091, "Can\'t DROP \'%-.192s\'; check that column/key exists" }, +{ "ER_INSERT_INFO", 1092, "Records: %ld Duplicates: %ld Warnings: %ld" }, +{ "ER_UPDATE_TABLE_USED", 1093, "You can\'t specify target table \'%-.192s\' for update in FROM clause" }, +{ "ER_NO_SUCH_THREAD", 1094, "Unknown thread id: %lu" }, +{ "ER_KILL_DENIED_ERROR", 1095, "You are not owner of thread %lu" }, +{ "ER_NO_TABLES_USED", 1096, "No tables used" }, +{ "ER_TOO_BIG_SET", 1097, "Too many strings for column %-.192s and SET" }, +{ "ER_NO_UNIQUE_LOGFILE", 1098, "Can\'t generate a unique log-filename %-.200s.(1-999)\n" }, +{ "ER_TABLE_NOT_LOCKED_FOR_WRITE", 1099, "Table \'%-.192s\' was locked with a READ lock and can\'t be updated" }, +{ "ER_TABLE_NOT_LOCKED", 1100, "Table \'%-.192s\' was not locked with LOCK TABLES" }, +{ "ER_BLOB_CANT_HAVE_DEFAULT", 1101, "BLOB, TEXT, GEOMETRY or JSON column \'%-.192s\' can\'t have a default value" }, +{ "ER_WRONG_DB_NAME", 1102, "Incorrect database name \'%-.100s\'" }, +{ "ER_WRONG_TABLE_NAME", 1103, "Incorrect table name \'%-.100s\'" }, +{ "ER_TOO_BIG_SELECT", 1104, "The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay" }, +{ "ER_UNKNOWN_ERROR", 1105, "Unknown error" }, +{ "ER_UNKNOWN_PROCEDURE", 1106, "Unknown procedure \'%-.192s\'" }, +{ "ER_WRONG_PARAMCOUNT_TO_PROCEDURE", 1107, "Incorrect parameter count to procedure \'%-.192s\'" }, +{ "ER_WRONG_PARAMETERS_TO_PROCEDURE", 1108, "Incorrect parameters to procedure \'%-.192s\'" }, +{ "ER_UNKNOWN_TABLE", 1109, "Unknown table \'%-.192s\' in %-.32s" }, +{ "ER_FIELD_SPECIFIED_TWICE", 1110, "Column \'%-.192s\' specified twice" }, +{ "ER_INVALID_GROUP_FUNC_USE", 1111, "Invalid use of group function" }, +{ "ER_UNSUPPORTED_EXTENSION", 1112, "Table \'%-.192s\' uses an extension that doesn\'t exist in this MySQL version" }, +{ "ER_TABLE_MUST_HAVE_COLUMNS", 1113, "A table must have at least 1 column" }, +{ "ER_RECORD_FILE_FULL", 1114, "The table \'%-.192s\' is full" }, +{ "ER_UNKNOWN_CHARACTER_SET", 1115, "Unknown character set: \'%-.64s\'" }, +{ "ER_TOO_MANY_TABLES", 1116, "Too many tables; MySQL can only use %d tables in a join" }, +{ "ER_TOO_MANY_FIELDS", 1117, "Too many columns" }, +{ "ER_TOO_BIG_ROWSIZE", 1118, "Row size too large. The maximum row size for the used table type, not counting BLOBs, is %ld. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs" }, +{ "ER_STACK_OVERRUN", 1119, "Thread stack overrun: Used: %ld of a %ld stack. Use \'mysqld --thread_stack=#\' to specify a bigger stack if needed" }, +{ "ER_WRONG_OUTER_JOIN", 1120, "Cross dependency found in OUTER JOIN; examine your ON conditions" }, +{ "ER_NULL_COLUMN_IN_INDEX", 1121, "Table handler doesn\'t support NULL in given index. Please change column \'%-.192s\' to be NOT NULL or use another handler" }, +{ "ER_CANT_FIND_UDF", 1122, "Can\'t load function \'%-.192s\'" }, +{ "ER_CANT_INITIALIZE_UDF", 1123, "Can\'t initialize function \'%-.192s\'; %-.80s" }, +{ "ER_UDF_NO_PATHS", 1124, "No paths allowed for shared library" }, +{ "ER_UDF_EXISTS", 1125, "Function \'%-.192s\' already exists" }, +{ "ER_CANT_OPEN_LIBRARY", 1126, "Can\'t open shared library \'%-.192s\' (errno: %d %-.128s)" }, +{ "ER_CANT_FIND_DL_ENTRY", 1127, "Can\'t find symbol \'%-.128s\' in library" }, +{ "ER_FUNCTION_NOT_DEFINED", 1128, "Function \'%-.192s\' is not defined" }, +{ "ER_HOST_IS_BLOCKED", 1129, "Host \'%-.64s\' is blocked because of many connection errors; unblock with \'mysqladmin flush-hosts\'" }, +{ "ER_HOST_NOT_PRIVILEGED", 1130, "Host \'%-.64s\' is not allowed to connect to this MySQL server" }, +{ "ER_PASSWORD_ANONYMOUS_USER", 1131, "You are using MySQL as an anonymous user and anonymous users are not allowed to change passwords" }, +{ "ER_PASSWORD_NOT_ALLOWED", 1132, "You must have privileges to update tables in the mysql database to be able to change passwords for others" }, +{ "ER_PASSWORD_NO_MATCH", 1133, "Can\'t find any matching row in the user table" }, +{ "ER_UPDATE_INFO", 1134, "Rows matched: %ld Changed: %ld Warnings: %ld" }, +{ "ER_CANT_CREATE_THREAD", 1135, "Can\'t create a new thread (errno %d); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug" }, +{ "ER_WRONG_VALUE_COUNT_ON_ROW", 1136, "Column count doesn\'t match value count at row %ld" }, +{ "ER_CANT_REOPEN_TABLE", 1137, "Can\'t reopen table: \'%-.192s\'" }, +{ "ER_INVALID_USE_OF_NULL", 1138, "Invalid use of NULL value" }, +{ "ER_REGEXP_ERROR", 1139, "Got error \'%-.64s\' from regexp" }, +{ "ER_MIX_OF_GROUP_FUNC_AND_FIELDS", 1140, "Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause" }, +{ "ER_NONEXISTING_GRANT", 1141, "There is no such grant defined for user \'%-.48s\' on host \'%-.64s\'" }, +{ "ER_TABLEACCESS_DENIED_ERROR", 1142, "%-.128s command denied to user \'%-.48s\'@\'%-.64s\' for table \'%-.64s\'" }, +{ "ER_COLUMNACCESS_DENIED_ERROR", 1143, "%-.16s command denied to user \'%-.48s\'@\'%-.64s\' for column \'%-.192s\' in table \'%-.192s\'" }, +{ "ER_ILLEGAL_GRANT_FOR_TABLE", 1144, "Illegal GRANT/REVOKE command; please consult the manual to see which privileges can be used" }, +{ "ER_GRANT_WRONG_HOST_OR_USER", 1145, "The host or user argument to GRANT is too long" }, +{ "ER_NO_SUCH_TABLE", 1146, "Table \'%-.192s.%-.192s\' doesn\'t exist" }, +{ "ER_NONEXISTING_TABLE_GRANT", 1147, "There is no such grant defined for user \'%-.48s\' on host \'%-.64s\' on table \'%-.192s\'" }, +{ "ER_NOT_ALLOWED_COMMAND", 1148, "The used command is not allowed with this MySQL version" }, +{ "ER_SYNTAX_ERROR", 1149, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use" }, +{ "ER_UNUSED1", 1150, "Delayed insert thread couldn\'t get requested lock for table %-.192s" }, +{ "ER_UNUSED2", 1151, "Too many delayed threads in use" }, +{ "ER_ABORTING_CONNECTION", 1152, "Aborted connection %ld to db: \'%-.192s\' user: \'%-.48s\' (%-.64s)" }, +{ "ER_NET_PACKET_TOO_LARGE", 1153, "Got a packet bigger than \'max_allowed_packet\' bytes" }, +{ "ER_NET_READ_ERROR_FROM_PIPE", 1154, "Got a read error from the connection pipe" }, +{ "ER_NET_FCNTL_ERROR", 1155, "Got an error from fcntl()" }, +{ "ER_NET_PACKETS_OUT_OF_ORDER", 1156, "Got packets out of order" }, +{ "ER_NET_UNCOMPRESS_ERROR", 1157, "Couldn\'t uncompress communication packet" }, +{ "ER_NET_READ_ERROR", 1158, "Got an error reading communication packets" }, +{ "ER_NET_READ_INTERRUPTED", 1159, "Got timeout reading communication packets" }, +{ "ER_NET_ERROR_ON_WRITE", 1160, "Got an error writing communication packets" }, +{ "ER_NET_WRITE_INTERRUPTED", 1161, "Got timeout writing communication packets" }, +{ "ER_TOO_LONG_STRING", 1162, "Result string is longer than \'max_allowed_packet\' bytes" }, +{ "ER_TABLE_CANT_HANDLE_BLOB", 1163, "The used table type doesn\'t support BLOB/TEXT columns" }, +{ "ER_TABLE_CANT_HANDLE_AUTO_INCREMENT", 1164, "The used table type doesn\'t support AUTO_INCREMENT columns" }, +{ "ER_UNUSED3", 1165, "INSERT DELAYED can\'t be used with table \'%-.192s\' because it is locked with LOCK TABLES" }, +{ "ER_WRONG_COLUMN_NAME", 1166, "Incorrect column name \'%-.100s\'" }, +{ "ER_WRONG_KEY_COLUMN", 1167, "The used storage engine can\'t index column \'%-.192s\'" }, +{ "ER_WRONG_MRG_TABLE", 1168, "Unable to open underlying table which is differently defined or of non-MyISAM type or doesn\'t exist" }, +{ "ER_DUP_UNIQUE", 1169, "Can\'t write, because of unique constraint, to table \'%-.192s\'" }, +{ "ER_BLOB_KEY_WITHOUT_LENGTH", 1170, "BLOB/TEXT column \'%-.192s\' used in key specification without a key length" }, +{ "ER_PRIMARY_CANT_HAVE_NULL", 1171, "All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead" }, +{ "ER_TOO_MANY_ROWS", 1172, "Result consisted of more than one row" }, +{ "ER_REQUIRES_PRIMARY_KEY", 1173, "This table type requires a primary key" }, +{ "ER_NO_RAID_COMPILED", 1174, "This version of MySQL is not compiled with RAID support" }, +{ "ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE", 1175, "You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column" }, +{ "ER_KEY_DOES_NOT_EXITS", 1176, "Key \'%-.192s\' doesn\'t exist in table \'%-.192s\'" }, +{ "ER_CHECK_NO_SUCH_TABLE", 1177, "Can\'t open table" }, +{ "ER_CHECK_NOT_IMPLEMENTED", 1178, "The storage engine for the table doesn\'t support %s" }, +{ "ER_CANT_DO_THIS_DURING_AN_TRANSACTION", 1179, "You are not allowed to execute this command in a transaction" }, +{ "ER_ERROR_DURING_COMMIT", 1180, "Got error %d during COMMIT" }, +{ "ER_ERROR_DURING_ROLLBACK", 1181, "Got error %d during ROLLBACK" }, +{ "ER_ERROR_DURING_FLUSH_LOGS", 1182, "Got error %d during FLUSH_LOGS" }, +{ "ER_ERROR_DURING_CHECKPOINT", 1183, "Got error %d during CHECKPOINT" }, +{ "ER_NEW_ABORTING_CONNECTION", 1184, "Aborted connection %u to db: \'%-.192s\' user: \'%-.48s\' host: \'%-.64s\' (%-.64s)" }, +{ "ER_DUMP_NOT_IMPLEMENTED", 1185, "The storage engine for the table does not support binary table dump" }, +{ "ER_FLUSH_MASTER_BINLOG_CLOSED", 1186, "Binlog closed, cannot RESET MASTER" }, +{ "ER_INDEX_REBUILD", 1187, "Failed rebuilding the index of dumped table \'%-.192s\'" }, +{ "ER_MASTER", 1188, "Error from master: \'%-.64s\'" }, +{ "ER_MASTER_NET_READ", 1189, "Net error reading from master" }, +{ "ER_MASTER_NET_WRITE", 1190, "Net error writing to master" }, +{ "ER_FT_MATCHING_KEY_NOT_FOUND", 1191, "Can\'t find FULLTEXT index matching the column list" }, +{ "ER_LOCK_OR_ACTIVE_TRANSACTION", 1192, "Can\'t execute the given command because you have active locked tables or an active transaction" }, +{ "ER_UNKNOWN_SYSTEM_VARIABLE", 1193, "Unknown system variable \'%-.64s\'" }, +{ "ER_CRASHED_ON_USAGE", 1194, "Table \'%-.192s\' is marked as crashed and should be repaired" }, +{ "ER_CRASHED_ON_REPAIR", 1195, "Table \'%-.192s\' is marked as crashed and last (automatic?) repair failed" }, +{ "ER_WARNING_NOT_COMPLETE_ROLLBACK", 1196, "Some non-transactional changed tables couldn\'t be rolled back" }, +{ "ER_TRANS_CACHE_FULL", 1197, "Multi-statement transaction required more than \'max_binlog_cache_size\' bytes of storage; increase this mysqld variable and try again" }, +{ "ER_SLAVE_MUST_STOP", 1198, "This operation cannot be performed with a running slave; run STOP SLAVE first" }, +{ "ER_SLAVE_NOT_RUNNING", 1199, "This operation requires a running slave; configure slave and do START SLAVE" }, +{ "ER_BAD_SLAVE", 1200, "The server is not configured as slave; fix in config file or with CHANGE MASTER TO" }, +{ "ER_MASTER_INFO", 1201, "Could not initialize master info structure; more error messages can be found in the MySQL error log" }, +{ "ER_SLAVE_THREAD", 1202, "Could not create slave thread; check system resources" }, +{ "ER_TOO_MANY_USER_CONNECTIONS", 1203, "User %-.64s already has more than \'max_user_connections\' active connections" }, +{ "ER_SET_CONSTANTS_ONLY", 1204, "You may only use constant expressions with SET" }, +{ "ER_LOCK_WAIT_TIMEOUT", 1205, "Lock wait timeout exceeded; try restarting transaction" }, +{ "ER_LOCK_TABLE_FULL", 1206, "The total number of locks exceeds the lock table size" }, +{ "ER_READ_ONLY_TRANSACTION", 1207, "Update locks cannot be acquired during a READ UNCOMMITTED transaction" }, +{ "ER_DROP_DB_WITH_READ_LOCK", 1208, "DROP DATABASE not allowed while thread is holding global read lock" }, +{ "ER_CREATE_DB_WITH_READ_LOCK", 1209, "CREATE DATABASE not allowed while thread is holding global read lock" }, +{ "ER_WRONG_ARGUMENTS", 1210, "Incorrect arguments to %s" }, +{ "ER_NO_PERMISSION_TO_CREATE_USER", 1211, "\'%-.48s\'@\'%-.64s\' is not allowed to create new users" }, +{ "ER_UNION_TABLES_IN_DIFFERENT_DIR", 1212, "Incorrect table definition; all MERGE tables must be in the same database" }, +{ "ER_LOCK_DEADLOCK", 1213, "Deadlock found when trying to get lock; try restarting transaction" }, +{ "ER_TABLE_CANT_HANDLE_FT", 1214, "The used table type doesn\'t support FULLTEXT indexes" }, +{ "ER_CANNOT_ADD_FOREIGN", 1215, "Cannot add foreign key constraint" }, +{ "ER_NO_REFERENCED_ROW", 1216, "Cannot add or update a child row: a foreign key constraint fails" }, +{ "ER_ROW_IS_REFERENCED", 1217, "Cannot delete or update a parent row: a foreign key constraint fails" }, +{ "ER_CONNECT_TO_MASTER", 1218, "Error connecting to master: %-.128s" }, +{ "ER_QUERY_ON_MASTER", 1219, "Error running query on master: %-.128s" }, +{ "ER_ERROR_WHEN_EXECUTING_COMMAND", 1220, "Error when executing command %s: %-.128s" }, +{ "ER_WRONG_USAGE", 1221, "Incorrect usage of %s and %s" }, +{ "ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT", 1222, "The used SELECT statements have a different number of columns" }, +{ "ER_CANT_UPDATE_WITH_READLOCK", 1223, "Can\'t execute the query because you have a conflicting read lock" }, +{ "ER_MIXING_NOT_ALLOWED", 1224, "Mixing of transactional and non-transactional tables is disabled" }, +{ "ER_DUP_ARGUMENT", 1225, "Option \'%s\' used twice in statement" }, +{ "ER_USER_LIMIT_REACHED", 1226, "User \'%-.64s\' has exceeded the \'%s\' resource (current value: %ld)" }, +{ "ER_SPECIFIC_ACCESS_DENIED_ERROR", 1227, "Access denied; you need (at least one of) the %-.128s privilege(s) for this operation" }, +{ "ER_LOCAL_VARIABLE", 1228, "Variable \'%-.64s\' is a SESSION variable and can\'t be used with SET GLOBAL" }, +{ "ER_GLOBAL_VARIABLE", 1229, "Variable \'%-.64s\' is a GLOBAL variable and should be set with SET GLOBAL" }, +{ "ER_NO_DEFAULT", 1230, "Variable \'%-.64s\' doesn\'t have a default value" }, +{ "ER_WRONG_VALUE_FOR_VAR", 1231, "Variable \'%-.64s\' can\'t be set to the value of \'%-.200s\'" }, +{ "ER_WRONG_TYPE_FOR_VAR", 1232, "Incorrect argument type to variable \'%-.64s\'" }, +{ "ER_VAR_CANT_BE_READ", 1233, "Variable \'%-.64s\' can only be set, not read" }, +{ "ER_CANT_USE_OPTION_HERE", 1234, "Incorrect usage/placement of \'%s\'" }, +{ "ER_NOT_SUPPORTED_YET", 1235, "This version of MySQL doesn\'t yet support \'%s\'" }, +{ "ER_MASTER_FATAL_ERROR_READING_BINLOG", 1236, "Got fatal error %d from master when reading data from binary log: \'%-.320s\'" }, +{ "ER_SLAVE_IGNORED_TABLE", 1237, "Slave SQL thread ignored the query because of replicate-*-table rules" }, +{ "ER_INCORRECT_GLOBAL_LOCAL_VAR", 1238, "Variable \'%-.192s\' is a %s variable" }, +{ "ER_WRONG_FK_DEF", 1239, "Incorrect foreign key definition for \'%-.192s\': %s" }, +{ "ER_KEY_REF_DO_NOT_MATCH_TABLE_REF", 1240, "Key reference and table reference don\'t match" }, +{ "ER_OPERAND_COLUMNS", 1241, "Operand should contain %d column(s)" }, +{ "ER_SUBQUERY_NO_1_ROW", 1242, "Subquery returns more than 1 row" }, +{ "ER_UNKNOWN_STMT_HANDLER", 1243, "Unknown prepared statement handler (%.*s) given to %s" }, +{ "ER_CORRUPT_HELP_DB", 1244, "Help database is corrupt or does not exist" }, +{ "ER_CYCLIC_REFERENCE", 1245, "Cyclic reference on subqueries" }, +{ "ER_AUTO_CONVERT", 1246, "Converting column \'%s\' from %s to %s" }, +{ "ER_ILLEGAL_REFERENCE", 1247, "Reference \'%-.64s\' not supported (%s)" }, +{ "ER_DERIVED_MUST_HAVE_ALIAS", 1248, "Every derived table must have its own alias" }, +{ "ER_SELECT_REDUCED", 1249, "Select %u was reduced during optimization" }, +{ "ER_TABLENAME_NOT_ALLOWED_HERE", 1250, "Table \'%-.192s\' from one of the SELECTs cannot be used in %-.32s" }, +{ "ER_NOT_SUPPORTED_AUTH_MODE", 1251, "Client does not support authentication protocol requested by server; consider upgrading MySQL client" }, +{ "ER_SPATIAL_CANT_HAVE_NULL", 1252, "All parts of a SPATIAL index must be NOT NULL" }, +{ "ER_COLLATION_CHARSET_MISMATCH", 1253, "COLLATION \'%s\' is not valid for CHARACTER SET \'%s\'" }, +{ "ER_SLAVE_WAS_RUNNING", 1254, "Slave is already running" }, +{ "ER_SLAVE_WAS_NOT_RUNNING", 1255, "Slave already has been stopped" }, +{ "ER_TOO_BIG_FOR_UNCOMPRESS", 1256, "Uncompressed data size too large; the maximum size is %d (probably, length of uncompressed data was corrupted)" }, +{ "ER_ZLIB_Z_MEM_ERROR", 1257, "ZLIB: Not enough memory" }, +{ "ER_ZLIB_Z_BUF_ERROR", 1258, "ZLIB: Not enough room in the output buffer (probably, length of uncompressed data was corrupted)" }, +{ "ER_ZLIB_Z_DATA_ERROR", 1259, "ZLIB: Input data corrupted" }, +{ "ER_CUT_VALUE_GROUP_CONCAT", 1260, "Row %u was cut by GROUP_CONCAT()" }, +{ "ER_WARN_TOO_FEW_RECORDS", 1261, "Row %ld doesn\'t contain data for all columns" }, +{ "ER_WARN_TOO_MANY_RECORDS", 1262, "Row %ld was truncated; it contained more data than there were input columns" }, +{ "ER_WARN_NULL_TO_NOTNULL", 1263, "Column set to default value; NULL supplied to NOT NULL column \'%s\' at row %ld" }, +{ "ER_WARN_DATA_OUT_OF_RANGE", 1264, "Out of range value for column \'%s\' at row %ld" }, +{ "WARN_DATA_TRUNCATED", 1265, "Data truncated for column \'%s\' at row %ld" }, +{ "ER_WARN_USING_OTHER_HANDLER", 1266, "Using storage engine %s for table \'%s\'" }, +{ "ER_CANT_AGGREGATE_2COLLATIONS", 1267, "Illegal mix of collations (%s,%s) and (%s,%s) for operation \'%s\'" }, +{ "ER_DROP_USER", 1268, "Cannot drop one or more of the requested users" }, +{ "ER_REVOKE_GRANTS", 1269, "Can\'t revoke all privileges for one or more of the requested users" }, +{ "ER_CANT_AGGREGATE_3COLLATIONS", 1270, "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation \'%s\'" }, +{ "ER_CANT_AGGREGATE_NCOLLATIONS", 1271, "Illegal mix of collations for operation \'%s\'" }, +{ "ER_VARIABLE_IS_NOT_STRUCT", 1272, "Variable \'%-.64s\' is not a variable component (can\'t be used as XXXX.variable_name)" }, +{ "ER_UNKNOWN_COLLATION", 1273, "Unknown collation: \'%-.64s\'" }, +{ "ER_SLAVE_IGNORED_SSL_PARAMS", 1274, "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later if MySQL slave with SSL is started" }, +{ "ER_SERVER_IS_IN_SECURE_AUTH_MODE", 1275, "Server is running in --secure-auth mode, but \'%s\'@\'%s\' has a password in the old format; please change the password to the new format" }, +{ "ER_WARN_FIELD_RESOLVED", 1276, "Field or reference \'%-.192s%s%-.192s%s%-.192s\' of SELECT #%d was resolved in SELECT #%d" }, +{ "ER_BAD_SLAVE_UNTIL_COND", 1277, "Incorrect parameter or combination of parameters for START SLAVE UNTIL" }, +{ "ER_MISSING_SKIP_SLAVE", 1278, "It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave\'s mysqld restart" }, +{ "ER_UNTIL_COND_IGNORED", 1279, "SQL thread is not to be started so UNTIL options are ignored" }, +{ "ER_WRONG_NAME_FOR_INDEX", 1280, "Incorrect index name \'%-.100s\'" }, +{ "ER_WRONG_NAME_FOR_CATALOG", 1281, "Incorrect catalog name \'%-.100s\'" }, +{ "ER_WARN_QC_RESIZE", 1282, "Query cache failed to set size %lu; new query cache size is %lu" }, +{ "ER_BAD_FT_COLUMN", 1283, "Column \'%-.192s\' cannot be part of FULLTEXT index" }, +{ "ER_UNKNOWN_KEY_CACHE", 1284, "Unknown key cache \'%-.100s\'" }, +{ "ER_WARN_HOSTNAME_WONT_WORK", 1285, "MySQL is started in --skip-name-resolve mode; you must restart it without this switch for this grant to work" }, +{ "ER_UNKNOWN_STORAGE_ENGINE", 1286, "Unknown storage engine \'%s\'" }, +{ "ER_WARN_DEPRECATED_SYNTAX", 1287, "\'%s\' is deprecated and will be removed in a future release. Please use %s instead" }, +{ "ER_NON_UPDATABLE_TABLE", 1288, "The target table %-.100s of the %s is not updatable" }, +{ "ER_FEATURE_DISABLED", 1289, "The \'%s\' feature is disabled; you need MySQL built with \'%s\' to have it working" }, +{ "ER_OPTION_PREVENTS_STATEMENT", 1290, "The MySQL server is running with the %s option so it cannot execute this statement" }, +{ "ER_DUPLICATED_VALUE_IN_TYPE", 1291, "Column \'%-.100s\' has duplicated value \'%-.64s\' in %s" }, +{ "ER_TRUNCATED_WRONG_VALUE", 1292, "Truncated incorrect %-.32s value: \'%-.128s\'" }, +{ "ER_TOO_MUCH_AUTO_TIMESTAMP_COLS", 1293, "Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause" }, +{ "ER_INVALID_ON_UPDATE", 1294, "Invalid ON UPDATE clause for \'%-.192s\' column" }, +{ "ER_UNSUPPORTED_PS", 1295, "This command is not supported in the prepared statement protocol yet" }, +{ "ER_GET_ERRMSG", 1296, "Got error %d \'%-.100s\' from %s" }, +{ "ER_GET_TEMPORARY_ERRMSG", 1297, "Got temporary error %d \'%-.100s\' from %s" }, +{ "ER_UNKNOWN_TIME_ZONE", 1298, "Unknown or incorrect time zone: \'%-.64s\'" }, +{ "ER_WARN_INVALID_TIMESTAMP", 1299, "Invalid TIMESTAMP value in column \'%s\' at row %ld" }, +{ "ER_INVALID_CHARACTER_STRING", 1300, "Invalid %s character string: \'%.64s\'" }, +{ "ER_WARN_ALLOWED_PACKET_OVERFLOWED", 1301, "Result of %s() was larger than max_allowed_packet (%ld) - truncated" }, +{ "ER_CONFLICTING_DECLARATIONS", 1302, "Conflicting declarations: \'%s%s\' and \'%s%s\'" }, +{ "ER_SP_NO_RECURSIVE_CREATE", 1303, "Can\'t create a %s from within another stored routine" }, +{ "ER_SP_ALREADY_EXISTS", 1304, "%s %s already exists" }, +{ "ER_SP_DOES_NOT_EXIST", 1305, "%s %s does not exist" }, +{ "ER_SP_DROP_FAILED", 1306, "Failed to DROP %s %s" }, +{ "ER_SP_STORE_FAILED", 1307, "Failed to CREATE %s %s" }, +{ "ER_SP_LILABEL_MISMATCH", 1308, "%s with no matching label: %s" }, +{ "ER_SP_LABEL_REDEFINE", 1309, "Redefining label %s" }, +{ "ER_SP_LABEL_MISMATCH", 1310, "End-label %s without match" }, +{ "ER_SP_UNINIT_VAR", 1311, "Referring to uninitialized variable %s" }, +{ "ER_SP_BADSELECT", 1312, "PROCEDURE %s can\'t return a result set in the given context" }, +{ "ER_SP_BADRETURN", 1313, "RETURN is only allowed in a FUNCTION" }, +{ "ER_SP_BADSTATEMENT", 1314, "%s is not allowed in stored procedures" }, +{ "ER_UPDATE_LOG_DEPRECATED_IGNORED", 1315, "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored." }, +{ "ER_UPDATE_LOG_DEPRECATED_TRANSLATED", 1316, "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN." }, +{ "ER_QUERY_INTERRUPTED", 1317, "Query execution was interrupted" }, +{ "ER_SP_WRONG_NO_OF_ARGS", 1318, "Incorrect number of arguments for %s %s; expected %u, got %u" }, +{ "ER_SP_COND_MISMATCH", 1319, "Undefined CONDITION: %s" }, +{ "ER_SP_NORETURN", 1320, "No RETURN found in FUNCTION %s" }, +{ "ER_SP_NORETURNEND", 1321, "FUNCTION %s ended without RETURN" }, +{ "ER_SP_BAD_CURSOR_QUERY", 1322, "Cursor statement must be a SELECT" }, +{ "ER_SP_BAD_CURSOR_SELECT", 1323, "Cursor SELECT must not have INTO" }, +{ "ER_SP_CURSOR_MISMATCH", 1324, "Undefined CURSOR: %s" }, +{ "ER_SP_CURSOR_ALREADY_OPEN", 1325, "Cursor is already open" }, +{ "ER_SP_CURSOR_NOT_OPEN", 1326, "Cursor is not open" }, +{ "ER_SP_UNDECLARED_VAR", 1327, "Undeclared variable: %s" }, +{ "ER_SP_WRONG_NO_OF_FETCH_ARGS", 1328, "Incorrect number of FETCH variables" }, +{ "ER_SP_FETCH_NO_DATA", 1329, "No data - zero rows fetched, selected, or processed" }, +{ "ER_SP_DUP_PARAM", 1330, "Duplicate parameter: %s" }, +{ "ER_SP_DUP_VAR", 1331, "Duplicate variable: %s" }, +{ "ER_SP_DUP_COND", 1332, "Duplicate condition: %s" }, +{ "ER_SP_DUP_CURS", 1333, "Duplicate cursor: %s" }, +{ "ER_SP_CANT_ALTER", 1334, "Failed to ALTER %s %s" }, +{ "ER_SP_SUBSELECT_NYI", 1335, "Subquery value not supported" }, +{ "ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG", 1336, "%s is not allowed in stored function or trigger" }, +{ "ER_SP_VARCOND_AFTER_CURSHNDLR", 1337, "Variable or condition declaration after cursor or handler declaration" }, +{ "ER_SP_CURSOR_AFTER_HANDLER", 1338, "Cursor declaration after handler declaration" }, +{ "ER_SP_CASE_NOT_FOUND", 1339, "Case not found for CASE statement" }, +{ "ER_FPARSER_TOO_BIG_FILE", 1340, "Configuration file \'%-.192s\' is too big" }, +{ "ER_FPARSER_BAD_HEADER", 1341, "Malformed file type header in file \'%-.192s\'" }, +{ "ER_FPARSER_EOF_IN_COMMENT", 1342, "Unexpected end of file while parsing comment \'%-.200s\'" }, +{ "ER_FPARSER_ERROR_IN_PARAMETER", 1343, "Error while parsing parameter \'%-.192s\' (line: \'%-.192s\')" }, +{ "ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER", 1344, "Unexpected end of file while skipping unknown parameter \'%-.192s\'" }, +{ "ER_VIEW_NO_EXPLAIN", 1345, "EXPLAIN/SHOW can not be issued; lacking privileges for underlying table" }, +{ "ER_FRM_UNKNOWN_TYPE", 1346, "File \'%-.192s\' has unknown type \'%-.64s\' in its header" }, +{ "ER_WRONG_OBJECT", 1347, "\'%-.192s.%-.192s\' is not %s" }, +{ "ER_NONUPDATEABLE_COLUMN", 1348, "Column \'%-.192s\' is not updatable" }, +{ "ER_VIEW_SELECT_DERIVED_UNUSED", 1349, "View\'s SELECT contains a subquery in the FROM clause" }, +{ "ER_VIEW_SELECT_CLAUSE", 1350, "View\'s SELECT contains a \'%s\' clause" }, +{ "ER_VIEW_SELECT_VARIABLE", 1351, "View\'s SELECT contains a variable or parameter" }, +{ "ER_VIEW_SELECT_TMPTABLE", 1352, "View\'s SELECT refers to a temporary table \'%-.192s\'" }, +{ "ER_VIEW_WRONG_LIST", 1353, "View\'s SELECT and view\'s field list have different column counts" }, +{ "ER_WARN_VIEW_MERGE", 1354, "View merge algorithm can\'t be used here for now (assumed undefined algorithm)" }, +{ "ER_WARN_VIEW_WITHOUT_KEY", 1355, "View being updated does not have complete key of underlying table in it" }, +{ "ER_VIEW_INVALID", 1356, "View \'%-.192s.%-.192s\' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them" }, +{ "ER_SP_NO_DROP_SP", 1357, "Can\'t drop or alter a %s from within another stored routine" }, +{ "ER_SP_GOTO_IN_HNDLR", 1358, "GOTO is not allowed in a stored procedure handler" }, +{ "ER_TRG_ALREADY_EXISTS", 1359, "Trigger already exists" }, +{ "ER_TRG_DOES_NOT_EXIST", 1360, "Trigger does not exist" }, +{ "ER_TRG_ON_VIEW_OR_TEMP_TABLE", 1361, "Trigger\'s \'%-.192s\' is view or temporary table" }, +{ "ER_TRG_CANT_CHANGE_ROW", 1362, "Updating of %s row is not allowed in %strigger" }, +{ "ER_TRG_NO_SUCH_ROW_IN_TRG", 1363, "There is no %s row in %s trigger" }, +{ "ER_NO_DEFAULT_FOR_FIELD", 1364, "Field \'%-.192s\' doesn\'t have a default value" }, +{ "ER_DIVISION_BY_ZERO", 1365, "Division by 0" }, +{ "ER_TRUNCATED_WRONG_VALUE_FOR_FIELD", 1366, "Incorrect %-.32s value: \'%-.128s\' for column \'%.192s\' at row %ld" }, +{ "ER_ILLEGAL_VALUE_FOR_TYPE", 1367, "Illegal %s \'%-.192s\' value found during parsing" }, +{ "ER_VIEW_NONUPD_CHECK", 1368, "CHECK OPTION on non-updatable view \'%-.192s.%-.192s\'" }, +{ "ER_VIEW_CHECK_FAILED", 1369, "CHECK OPTION failed \'%-.192s.%-.192s\'" }, +{ "ER_PROCACCESS_DENIED_ERROR", 1370, "%-.16s command denied to user \'%-.48s\'@\'%-.64s\' for routine \'%-.192s\'" }, +{ "ER_RELAY_LOG_FAIL", 1371, "Failed purging old relay logs: %s" }, +{ "ER_PASSWD_LENGTH", 1372, "Password hash should be a %d-digit hexadecimal number" }, +{ "ER_UNKNOWN_TARGET_BINLOG", 1373, "Target log not found in binlog index" }, +{ "ER_IO_ERR_LOG_INDEX_READ", 1374, "I/O error reading log index file" }, +{ "ER_BINLOG_PURGE_PROHIBITED", 1375, "Server configuration does not permit binlog purge" }, +{ "ER_FSEEK_FAIL", 1376, "Failed on fseek()" }, +{ "ER_BINLOG_PURGE_FATAL_ERR", 1377, "Fatal error during log purge" }, +{ "ER_LOG_IN_USE", 1378, "A purgeable log is in use, will not purge" }, +{ "ER_LOG_PURGE_UNKNOWN_ERR", 1379, "Unknown error during log purge" }, +{ "ER_RELAY_LOG_INIT", 1380, "Failed initializing relay log position: %s" }, +{ "ER_NO_BINARY_LOGGING", 1381, "You are not using binary logging" }, +{ "ER_RESERVED_SYNTAX", 1382, "The \'%-.64s\' syntax is reserved for purposes internal to the MySQL server" }, +{ "ER_WSAS_FAILED", 1383, "WSAStartup Failed" }, +{ "ER_DIFF_GROUPS_PROC", 1384, "Can\'t handle procedures with different groups yet" }, +{ "ER_NO_GROUP_FOR_PROC", 1385, "Select must have a group with this procedure" }, +{ "ER_ORDER_WITH_PROC", 1386, "Can\'t use ORDER clause with this procedure" }, +{ "ER_LOGGING_PROHIBIT_CHANGING_OF", 1387, "Binary logging and replication forbid changing the global server %s" }, +{ "ER_NO_FILE_MAPPING", 1388, "Can\'t map file: %-.200s, errno: %d" }, +{ "ER_WRONG_MAGIC", 1389, "Wrong magic in %-.64s" }, +{ "ER_PS_MANY_PARAM", 1390, "Prepared statement contains too many placeholders" }, +{ "ER_KEY_PART_0", 1391, "Key part \'%-.192s\' length cannot be 0" }, +{ "ER_VIEW_CHECKSUM", 1392, "View text checksum failed" }, +{ "ER_VIEW_MULTIUPDATE", 1393, "Can not modify more than one base table through a join view \'%-.192s.%-.192s\'" }, +{ "ER_VIEW_NO_INSERT_FIELD_LIST", 1394, "Can not insert into join view \'%-.192s.%-.192s\' without fields list" }, +{ "ER_VIEW_DELETE_MERGE_VIEW", 1395, "Can not delete from join view \'%-.192s.%-.192s\'" }, +{ "ER_CANNOT_USER", 1396, "Operation %s failed for %.256s" }, +{ "ER_XAER_NOTA", 1397, "XAER_NOTA: Unknown XID" }, +{ "ER_XAER_INVAL", 1398, "XAER_INVAL: Invalid arguments (or unsupported command)" }, +{ "ER_XAER_RMFAIL", 1399, "XAER_RMFAIL: The command cannot be executed when global transaction is in the %.64s state" }, +{ "ER_XAER_OUTSIDE", 1400, "XAER_OUTSIDE: Some work is done outside global transaction" }, +{ "ER_XAER_RMERR", 1401, "XAER_RMERR: Fatal error occurred in the transaction branch - check your data for consistency" }, +{ "ER_XA_RBROLLBACK", 1402, "XA_RBROLLBACK: Transaction branch was rolled back" }, +{ "ER_NONEXISTING_PROC_GRANT", 1403, "There is no such grant defined for user \'%-.48s\' on host \'%-.64s\' on routine \'%-.192s\'" }, +{ "ER_PROC_AUTO_GRANT_FAIL", 1404, "Failed to grant EXECUTE and ALTER ROUTINE privileges" }, +{ "ER_PROC_AUTO_REVOKE_FAIL", 1405, "Failed to revoke all privileges to dropped routine" }, +{ "ER_DATA_TOO_LONG", 1406, "Data too long for column \'%s\' at row %ld" }, +{ "ER_SP_BAD_SQLSTATE", 1407, "Bad SQLSTATE: \'%s\'" }, +{ "ER_STARTUP", 1408, "%s: ready for connections.\nVersion: \'%s\' socket: \'%s\' port: %d %s" }, +{ "ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR", 1409, "Can\'t load value from file with fixed size rows to variable" }, +{ "ER_CANT_CREATE_USER_WITH_GRANT", 1410, "You are not allowed to create a user with GRANT" }, +{ "ER_WRONG_VALUE_FOR_TYPE", 1411, "Incorrect %-.32s value: \'%-.128s\' for function %-.32s" }, +{ "ER_TABLE_DEF_CHANGED", 1412, "Table definition has changed, please retry transaction" }, +{ "ER_SP_DUP_HANDLER", 1413, "Duplicate handler declared in the same block" }, +{ "ER_SP_NOT_VAR_ARG", 1414, "OUT or INOUT argument %d for routine %s is not a variable or NEW pseudo-variable in BEFORE trigger" }, +{ "ER_SP_NO_RETSET", 1415, "Not allowed to return a result set from a %s" }, +{ "ER_CANT_CREATE_GEOMETRY_OBJECT", 1416, "Cannot get geometry object from data you send to the GEOMETRY field" }, +{ "ER_FAILED_ROUTINE_BREAK_BINLOG", 1417, "A routine failed and has neither NO SQL nor READS SQL DATA in its declaration and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes" }, +{ "ER_BINLOG_UNSAFE_ROUTINE", 1418, "This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)" }, +{ "ER_BINLOG_CREATE_ROUTINE_NEED_SUPER", 1419, "You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)" }, +{ "ER_EXEC_STMT_WITH_OPEN_CURSOR", 1420, "You can\'t execute a prepared statement which has an open cursor associated with it. Reset the statement to re-execute it." }, +{ "ER_STMT_HAS_NO_OPEN_CURSOR", 1421, "The statement (%lu) has no open cursor." }, +{ "ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG", 1422, "Explicit or implicit commit is not allowed in stored function or trigger." }, +{ "ER_NO_DEFAULT_FOR_VIEW_FIELD", 1423, "Field of view \'%-.192s.%-.192s\' underlying table doesn\'t have a default value" }, +{ "ER_SP_NO_RECURSION", 1424, "Recursive stored functions and triggers are not allowed." }, +{ "ER_TOO_BIG_SCALE", 1425, "Too big scale %d specified for column \'%-.192s\'. Maximum is %lu." }, +{ "ER_TOO_BIG_PRECISION", 1426, "Too-big precision %d specified for \'%-.192s\'. Maximum is %lu." }, +{ "ER_M_BIGGER_THAN_D", 1427, "For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column \'%-.192s\')." }, +{ "ER_WRONG_LOCK_OF_SYSTEM_TABLE", 1428, "You can\'t combine write-locking of system tables with other tables or lock types" }, +{ "ER_CONNECT_TO_FOREIGN_DATA_SOURCE", 1429, "Unable to connect to foreign data source: %.64s" }, +{ "ER_QUERY_ON_FOREIGN_DATA_SOURCE", 1430, "There was a problem processing the query on the foreign data source. Data source error: %-.64s" }, +{ "ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST", 1431, "The foreign data source you are trying to reference does not exist. Data source error: %-.64s" }, +{ "ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE", 1432, "Can\'t create federated table. The data source connection string \'%-.64s\' is not in the correct format" }, +{ "ER_FOREIGN_DATA_STRING_INVALID", 1433, "The data source connection string \'%-.64s\' is not in the correct format" }, +{ "ER_CANT_CREATE_FEDERATED_TABLE", 1434, "Can\'t create federated table. Foreign data src error: %-.64s" }, +{ "ER_TRG_IN_WRONG_SCHEMA", 1435, "Trigger in wrong schema" }, +{ "ER_STACK_OVERRUN_NEED_MORE", 1436, "Thread stack overrun: %ld bytes used of a %ld byte stack, and %ld bytes needed. Use \'mysqld --thread_stack=#\' to specify a bigger stack." }, +{ "ER_TOO_LONG_BODY", 1437, "Routine body for \'%-.100s\' is too long" }, +{ "ER_WARN_CANT_DROP_DEFAULT_KEYCACHE", 1438, "Cannot drop default keycache" }, +{ "ER_TOO_BIG_DISPLAYWIDTH", 1439, "Display width out of range for column \'%-.192s\' (max = %lu)" }, +{ "ER_XAER_DUPID", 1440, "XAER_DUPID: The XID already exists" }, +{ "ER_DATETIME_FUNCTION_OVERFLOW", 1441, "Datetime function: %-.32s field overflow" }, +{ "ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG", 1442, "Can\'t update table \'%-.192s\' in stored function/trigger because it is already used by statement which invoked this stored function/trigger." }, +{ "ER_VIEW_PREVENT_UPDATE", 1443, "The definition of table \'%-.192s\' prevents operation %.192s on table \'%-.192s\'." }, +{ "ER_PS_NO_RECURSION", 1444, "The prepared statement contains a stored routine call that refers to that same statement. It\'s not allowed to execute a prepared statement in such a recursive manner" }, +{ "ER_SP_CANT_SET_AUTOCOMMIT", 1445, "Not allowed to set autocommit from a stored function or trigger" }, +{ "ER_MALFORMED_DEFINER", 1446, "Definer is not fully qualified" }, +{ "ER_VIEW_FRM_NO_USER", 1447, "View \'%-.192s\'.\'%-.192s\' has no definer information (old table format). Current user is used as definer. Please recreate the view!" }, +{ "ER_VIEW_OTHER_USER", 1448, "You need the SUPER privilege for creation view with \'%-.192s\'@\'%-.192s\' definer" }, +{ "ER_NO_SUCH_USER", 1449, "The user specified as a definer (\'%-.64s\'@\'%-.64s\') does not exist" }, +{ "ER_FORBID_SCHEMA_CHANGE", 1450, "Changing schema from \'%-.192s\' to \'%-.192s\' is not allowed." }, +{ "ER_ROW_IS_REFERENCED_2", 1451, "Cannot delete or update a parent row: a foreign key constraint fails (%.192s)" }, +{ "ER_NO_REFERENCED_ROW_2", 1452, "Cannot add or update a child row: a foreign key constraint fails (%.192s)" }, +{ "ER_SP_BAD_VAR_SHADOW", 1453, "Variable \'%-.64s\' must be quoted with `...`, or renamed" }, +{ "ER_TRG_NO_DEFINER", 1454, "No definer attribute for trigger \'%-.192s\'.\'%-.192s\'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger." }, +{ "ER_OLD_FILE_FORMAT", 1455, "\'%-.192s\' has an old format, you should re-create the \'%s\' object(s)" }, +{ "ER_SP_RECURSION_LIMIT", 1456, "Recursive limit %d (as set by the max_sp_recursion_depth variable) was exceeded for routine %.192s" }, +{ "ER_SP_PROC_TABLE_CORRUPT", 1457, "Failed to load routine %-.192s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)" }, +{ "ER_SP_WRONG_NAME", 1458, "Incorrect routine name \'%-.192s\'" }, +{ "ER_TABLE_NEEDS_UPGRADE", 1459, "Table upgrade required. Please do \"REPAIR TABLE `%-.64s`\" or dump/reload to fix it!" }, +{ "ER_SP_NO_AGGREGATE", 1460, "AGGREGATE is not supported for stored functions" }, +{ "ER_MAX_PREPARED_STMT_COUNT_REACHED", 1461, "Can\'t create more than max_prepared_stmt_count statements (current value: %lu)" }, +{ "ER_VIEW_RECURSIVE", 1462, "`%-.192s`.`%-.192s` contains view recursion" }, +{ "ER_NON_GROUPING_FIELD_USED", 1463, "Non-grouping field \'%-.192s\' is used in %-.64s clause" }, +{ "ER_TABLE_CANT_HANDLE_SPKEYS", 1464, "The used table type doesn\'t support SPATIAL indexes" }, +{ "ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA", 1465, "Triggers can not be created on system tables" }, +{ "ER_REMOVED_SPACES", 1466, "Leading spaces are removed from name \'%s\'" }, +{ "ER_AUTOINC_READ_FAILED", 1467, "Failed to read auto-increment value from storage engine" }, +{ "ER_USERNAME", 1468, "user name" }, +{ "ER_HOSTNAME", 1469, "host name" }, +{ "ER_WRONG_STRING_LENGTH", 1470, "String \'%-.70s\' is too long for %s (should be no longer than %d)" }, +{ "ER_NON_INSERTABLE_TABLE", 1471, "The target table %-.100s of the %s is not insertable-into" }, +{ "ER_ADMIN_WRONG_MRG_TABLE", 1472, "Table \'%-.64s\' is differently defined or of non-MyISAM type or doesn\'t exist" }, +{ "ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT", 1473, "Too high level of nesting for select" }, +{ "ER_NAME_BECOMES_EMPTY", 1474, "Name \'%-.64s\' has become \'\'" }, +{ "ER_AMBIGUOUS_FIELD_TERM", 1475, "First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY" }, +{ "ER_FOREIGN_SERVER_EXISTS", 1476, "The foreign server, %s, you are trying to create already exists." }, +{ "ER_FOREIGN_SERVER_DOESNT_EXIST", 1477, "The foreign server name you are trying to reference does not exist. Data source error: %-.64s" }, +{ "ER_ILLEGAL_HA_CREATE_OPTION", 1478, "Table storage engine \'%-.64s\' does not support the create option \'%.64s\'" }, +{ "ER_PARTITION_REQUIRES_VALUES_ERROR", 1479, "Syntax error: %-.64s PARTITIONING requires definition of VALUES %-.64s for each partition" }, +{ "ER_PARTITION_WRONG_VALUES_ERROR", 1480, "Only %-.64s PARTITIONING can use VALUES %-.64s in partition definition" }, +{ "ER_PARTITION_MAXVALUE_ERROR", 1481, "MAXVALUE can only be used in last partition definition" }, +{ "ER_PARTITION_SUBPARTITION_ERROR", 1482, "Subpartitions can only be hash partitions and by key" }, +{ "ER_PARTITION_SUBPART_MIX_ERROR", 1483, "Must define subpartitions on all partitions if on one partition" }, +{ "ER_PARTITION_WRONG_NO_PART_ERROR", 1484, "Wrong number of partitions defined, mismatch with previous setting" }, +{ "ER_PARTITION_WRONG_NO_SUBPART_ERROR", 1485, "Wrong number of subpartitions defined, mismatch with previous setting" }, +{ "ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR", 1486, "Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed" }, +{ "ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR", 1487, "Expression in RANGE/LIST VALUES must be constant" }, +{ "ER_FIELD_NOT_FOUND_PART_ERROR", 1488, "Field in list of fields for partition function not found in table" }, +{ "ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR", 1489, "List of fields is only allowed in KEY partitions" }, +{ "ER_INCONSISTENT_PARTITION_INFO_ERROR", 1490, "The partition info in the frm file is not consistent with what can be written into the frm file" }, +{ "ER_PARTITION_FUNC_NOT_ALLOWED_ERROR", 1491, "The %-.192s function returns the wrong type" }, +{ "ER_PARTITIONS_MUST_BE_DEFINED_ERROR", 1492, "For %-.64s partitions each partition must be defined" }, +{ "ER_RANGE_NOT_INCREASING_ERROR", 1493, "VALUES LESS THAN value must be strictly increasing for each partition" }, +{ "ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR", 1494, "VALUES value must be of same type as partition function" }, +{ "ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR", 1495, "Multiple definition of same constant in list partitioning" }, +{ "ER_PARTITION_ENTRY_ERROR", 1496, "Partitioning can not be used stand-alone in query" }, +{ "ER_MIX_HANDLER_ERROR", 1497, "The mix of handlers in the partitions is not allowed in this version of MySQL" }, +{ "ER_PARTITION_NOT_DEFINED_ERROR", 1498, "For the partitioned engine it is necessary to define all %-.64s" }, +{ "ER_TOO_MANY_PARTITIONS_ERROR", 1499, "Too many partitions (including subpartitions) were defined" }, +{ "ER_SUBPARTITION_ERROR", 1500, "It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning" }, +{ "ER_CANT_CREATE_HANDLER_FILE", 1501, "Failed to create specific handler file" }, +{ "ER_BLOB_FIELD_IN_PART_FUNC_ERROR", 1502, "A BLOB field is not allowed in partition function" }, +{ "ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF", 1503, "A %-.192s must include all columns in the table\'s partitioning function" }, +{ "ER_NO_PARTS_ERROR", 1504, "Number of %-.64s = 0 is not an allowed value" }, +{ "ER_PARTITION_MGMT_ON_NONPARTITIONED", 1505, "Partition management on a not partitioned table is not possible" }, +{ "ER_FOREIGN_KEY_ON_PARTITIONED", 1506, "Foreign keys are not yet supported in conjunction with partitioning" }, +{ "ER_DROP_PARTITION_NON_EXISTENT", 1507, "Error in list of partitions to %-.64s" }, +{ "ER_DROP_LAST_PARTITION", 1508, "Cannot remove all partitions, use DROP TABLE instead" }, +{ "ER_COALESCE_ONLY_ON_HASH_PARTITION", 1509, "COALESCE PARTITION can only be used on HASH/KEY partitions" }, +{ "ER_REORG_HASH_ONLY_ON_SAME_NO", 1510, "REORGANIZE PARTITION can only be used to reorganize partitions not to change their numbers" }, +{ "ER_REORG_NO_PARAM_ERROR", 1511, "REORGANIZE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs" }, +{ "ER_ONLY_ON_RANGE_LIST_PARTITION", 1512, "%-.64s PARTITION can only be used on RANGE/LIST partitions" }, +{ "ER_ADD_PARTITION_SUBPART_ERROR", 1513, "Trying to Add partition(s) with wrong number of subpartitions" }, +{ "ER_ADD_PARTITION_NO_NEW_PARTITION", 1514, "At least one partition must be added" }, +{ "ER_COALESCE_PARTITION_NO_PARTITION", 1515, "At least one partition must be coalesced" }, +{ "ER_REORG_PARTITION_NOT_EXIST", 1516, "More partitions to reorganize than there are partitions" }, +{ "ER_SAME_NAME_PARTITION", 1517, "Duplicate partition name %-.192s" }, +{ "ER_NO_BINLOG_ERROR", 1518, "It is not allowed to shut off binlog on this command" }, +{ "ER_CONSECUTIVE_REORG_PARTITIONS", 1519, "When reorganizing a set of partitions they must be in consecutive order" }, +{ "ER_REORG_OUTSIDE_RANGE", 1520, "Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range" }, +{ "ER_PARTITION_FUNCTION_FAILURE", 1521, "Partition function not supported in this version for this handler" }, +{ "ER_PART_STATE_ERROR", 1522, "Partition state cannot be defined from CREATE/ALTER TABLE" }, +{ "ER_LIMITED_PART_RANGE", 1523, "The %-.64s handler only supports 32 bit integers in VALUES" }, +{ "ER_PLUGIN_IS_NOT_LOADED", 1524, "Plugin \'%-.192s\' is not loaded" }, +{ "ER_WRONG_VALUE", 1525, "Incorrect %-.32s value: \'%-.128s\'" }, +{ "ER_NO_PARTITION_FOR_GIVEN_VALUE", 1526, "Table has no partition for value %-.64s" }, +{ "ER_FILEGROUP_OPTION_ONLY_ONCE", 1527, "It is not allowed to specify %s more than once" }, +{ "ER_CREATE_FILEGROUP_FAILED", 1528, "Failed to create %s" }, +{ "ER_DROP_FILEGROUP_FAILED", 1529, "Failed to drop %s" }, +{ "ER_TABLESPACE_AUTO_EXTEND_ERROR", 1530, "The handler doesn\'t support autoextend of tablespaces" }, +{ "ER_WRONG_SIZE_NUMBER", 1531, "A size parameter was incorrectly specified, either number or on the form 10M" }, +{ "ER_SIZE_OVERFLOW_ERROR", 1532, "The size number was correct but we don\'t allow the digit part to be more than 2 billion" }, +{ "ER_ALTER_FILEGROUP_FAILED", 1533, "Failed to alter: %s" }, +{ "ER_BINLOG_ROW_LOGGING_FAILED", 1534, "Writing one row to the row-based binary log failed" }, +{ "ER_BINLOG_ROW_WRONG_TABLE_DEF", 1535, "Table definition on master and slave does not match: %s" }, +{ "ER_BINLOG_ROW_RBR_TO_SBR", 1536, "Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log events" }, +{ "ER_EVENT_ALREADY_EXISTS", 1537, "Event \'%-.192s\' already exists" }, +{ "ER_EVENT_STORE_FAILED", 1538, "Failed to store event %s. Error code %d from storage engine." }, +{ "ER_EVENT_DOES_NOT_EXIST", 1539, "Unknown event \'%-.192s\'" }, +{ "ER_EVENT_CANT_ALTER", 1540, "Failed to alter event \'%-.192s\'" }, +{ "ER_EVENT_DROP_FAILED", 1541, "Failed to drop %s" }, +{ "ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG", 1542, "INTERVAL is either not positive or too big" }, +{ "ER_EVENT_ENDS_BEFORE_STARTS", 1543, "ENDS is either invalid or before STARTS" }, +{ "ER_EVENT_EXEC_TIME_IN_THE_PAST", 1544, "Event execution time is in the past. Event has been disabled" }, +{ "ER_EVENT_OPEN_TABLE_FAILED", 1545, "Failed to open mysql.event" }, +{ "ER_EVENT_NEITHER_M_EXPR_NOR_M_AT", 1546, "No datetime expression provided" }, +{ "ER_OBSOLETE_COL_COUNT_DOESNT_MATCH_CORRUPTED", 1547, "Column count of mysql.%s is wrong. Expected %d, found %d. The table is probably corrupted" }, +{ "ER_OBSOLETE_CANNOT_LOAD_FROM_TABLE", 1548, "Cannot load from mysql.%s. The table is probably corrupted" }, +{ "ER_EVENT_CANNOT_DELETE", 1549, "Failed to delete the event from mysql.event" }, +{ "ER_EVENT_COMPILE_ERROR", 1550, "Error during compilation of event\'s body" }, +{ "ER_EVENT_SAME_NAME", 1551, "Same old and new event name" }, +{ "ER_EVENT_DATA_TOO_LONG", 1552, "Data for column \'%s\' too long" }, +{ "ER_DROP_INDEX_FK", 1553, "Cannot drop index \'%-.192s\': needed in a foreign key constraint" }, +{ "ER_WARN_DEPRECATED_SYNTAX_WITH_VER", 1554, "The syntax \'%s\' is deprecated and will be removed in MySQL %s. Please use %s instead" }, +{ "ER_CANT_WRITE_LOCK_LOG_TABLE", 1555, "You can\'t write-lock a log table. Only read access is possible" }, +{ "ER_CANT_LOCK_LOG_TABLE", 1556, "You can\'t use locks with log tables." }, +{ "ER_FOREIGN_DUPLICATE_KEY_OLD_UNUSED", 1557, "Upholding foreign key constraints for table \'%.192s\', entry \'%-.192s\', key %d would lead to a duplicate entry" }, +{ "ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE", 1558, "Column count of mysql.%s is wrong. Expected %d, found %d. Created with MySQL %d, now running %d. Please use mysql_upgrade to fix this error." }, +{ "ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR", 1559, "Cannot switch out of the row-based binary log format when the session has open temporary tables" }, +{ "ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT", 1560, "Cannot change the binary logging format inside a stored function or trigger" }, +{ "ER_NDB_CANT_SWITCH_BINLOG_FORMAT", 1561, "The NDB cluster engine does not support changing the binlog format on the fly yet" }, +{ "ER_PARTITION_NO_TEMPORARY", 1562, "Cannot create temporary table with partitions" }, +{ "ER_PARTITION_CONST_DOMAIN_ERROR", 1563, "Partition constant is out of partition function domain" }, +{ "ER_PARTITION_FUNCTION_IS_NOT_ALLOWED", 1564, "This partition function is not allowed" }, +{ "ER_DDL_LOG_ERROR", 1565, "Error in DDL log" }, +{ "ER_NULL_IN_VALUES_LESS_THAN", 1566, "Not allowed to use NULL value in VALUES LESS THAN" }, +{ "ER_WRONG_PARTITION_NAME", 1567, "Incorrect partition name" }, +{ "ER_CANT_CHANGE_TX_CHARACTERISTICS", 1568, "Transaction characteristics can\'t be changed while a transaction is in progress" }, +{ "ER_DUP_ENTRY_AUTOINCREMENT_CASE", 1569, "ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry \'%-.192s\' for key \'%-.192s\'" }, +{ "ER_EVENT_MODIFY_QUEUE_ERROR", 1570, "Internal scheduler error %d" }, +{ "ER_EVENT_SET_VAR_ERROR", 1571, "Error during starting/stopping of the scheduler. Error code %u" }, +{ "ER_PARTITION_MERGE_ERROR", 1572, "Engine cannot be used in partitioned tables" }, +{ "ER_CANT_ACTIVATE_LOG", 1573, "Cannot activate \'%-.64s\' log" }, +{ "ER_RBR_NOT_AVAILABLE", 1574, "The server was not built with row-based replication" }, +{ "ER_BASE64_DECODE_ERROR", 1575, "Decoding of base64 string failed" }, +{ "ER_EVENT_RECURSION_FORBIDDEN", 1576, "Recursion of EVENT DDL statements is forbidden when body is present" }, +{ "ER_EVENTS_DB_ERROR", 1577, "Cannot proceed because system tables used by Event Scheduler were found damaged at server start" }, +{ "ER_ONLY_INTEGERS_ALLOWED", 1578, "Only integers allowed as number here" }, +{ "ER_UNSUPORTED_LOG_ENGINE", 1579, "This storage engine cannot be used for log tables\"" }, +{ "ER_BAD_LOG_STATEMENT", 1580, "You cannot \'%s\' a log table if logging is enabled" }, +{ "ER_CANT_RENAME_LOG_TABLE", 1581, "Cannot rename \'%s\'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to \'%s\'" }, +{ "ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT", 1582, "Incorrect parameter count in the call to native function \'%-.192s\'" }, +{ "ER_WRONG_PARAMETERS_TO_NATIVE_FCT", 1583, "Incorrect parameters in the call to native function \'%-.192s\'" }, +{ "ER_WRONG_PARAMETERS_TO_STORED_FCT", 1584, "Incorrect parameters in the call to stored function %-.192s" }, +{ "ER_NATIVE_FCT_NAME_COLLISION", 1585, "This function \'%-.192s\' has the same name as a native function" }, +{ "ER_DUP_ENTRY_WITH_KEY_NAME", 1586, "Duplicate entry \'%-.64s\' for key \'%-.192s\'" }, +{ "ER_BINLOG_PURGE_EMFILE", 1587, "Too many files opened, please execute the command again" }, +{ "ER_EVENT_CANNOT_CREATE_IN_THE_PAST", 1588, "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation." }, +{ "ER_EVENT_CANNOT_ALTER_IN_THE_PAST", 1589, "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future." }, +{ "ER_SLAVE_INCIDENT", 1590, "The incident %s occured on the master. Message: %s" }, +{ "ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT", 1591, "Table has no partition for some existing values" }, +{ "ER_BINLOG_UNSAFE_STATEMENT", 1592, "Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. %s" }, +{ "ER_SLAVE_FATAL_ERROR", 1593, "Fatal error: %s" }, +{ "ER_SLAVE_RELAY_LOG_READ_FAILURE", 1594, "Relay log read failure: %s" }, +{ "ER_SLAVE_RELAY_LOG_WRITE_FAILURE", 1595, "Relay log write failure: %s" }, +{ "ER_SLAVE_CREATE_EVENT_FAILURE", 1596, "Failed to create %s" }, +{ "ER_SLAVE_MASTER_COM_FAILURE", 1597, "Master command %s failed: %s" }, +{ "ER_BINLOG_LOGGING_IMPOSSIBLE", 1598, "Binary logging not possible. Message: %s" }, +{ "ER_VIEW_NO_CREATION_CTX", 1599, "View `%-.64s`.`%-.64s` has no creation context" }, +{ "ER_VIEW_INVALID_CREATION_CTX", 1600, "Creation context of view `%-.64s`.`%-.64s\' is invalid" }, +{ "ER_SR_INVALID_CREATION_CTX", 1601, "Creation context of stored routine `%-.64s`.`%-.64s` is invalid" }, +{ "ER_TRG_CORRUPTED_FILE", 1602, "Corrupted TRG file for table `%-.64s`.`%-.64s`" }, +{ "ER_TRG_NO_CREATION_CTX", 1603, "Triggers for table `%-.64s`.`%-.64s` have no creation context" }, +{ "ER_TRG_INVALID_CREATION_CTX", 1604, "Trigger creation context of table `%-.64s`.`%-.64s` is invalid" }, +{ "ER_EVENT_INVALID_CREATION_CTX", 1605, "Creation context of event `%-.64s`.`%-.64s` is invalid" }, +{ "ER_TRG_CANT_OPEN_TABLE", 1606, "Cannot open table for trigger `%-.64s`.`%-.64s`" }, +{ "ER_CANT_CREATE_SROUTINE", 1607, "Cannot create stored routine `%-.64s`. Check warnings" }, +{ "ER_NEVER_USED", 1608, "Ambiguous slave modes combination. %s" }, +{ "ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT", 1609, "The BINLOG statement of type `%s` was not preceded by a format description BINLOG statement." }, +{ "ER_SLAVE_CORRUPT_EVENT", 1610, "Corrupted replication event was detected" }, +{ "ER_LOAD_DATA_INVALID_COLUMN_UNUSED", 1611, "Invalid column reference (%-.64s) in LOAD DATA" }, +{ "ER_LOG_PURGE_NO_FILE", 1612, "Being purged log %s was not found" }, +{ "ER_XA_RBTIMEOUT", 1613, "XA_RBTIMEOUT: Transaction branch was rolled back: took too long" }, +{ "ER_XA_RBDEADLOCK", 1614, "XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected" }, +{ "ER_NEED_REPREPARE", 1615, "Prepared statement needs to be re-prepared" }, +{ "ER_DELAYED_NOT_SUPPORTED", 1616, "DELAYED option not supported for table \'%-.192s\'" }, +{ "WARN_NO_MASTER_INFO", 1617, "The master info structure does not exist" }, +{ "WARN_OPTION_IGNORED", 1618, "<%-.64s> option ignored" }, +{ "ER_PLUGIN_DELETE_BUILTIN", 1619, "Built-in plugins cannot be deleted" }, +{ "WARN_PLUGIN_BUSY", 1620, "Plugin is busy and will be uninstalled on shutdown" }, +{ "ER_VARIABLE_IS_READONLY", 1621, "%s variable \'%s\' is read-only. Use SET %s to assign the value" }, +{ "ER_WARN_ENGINE_TRANSACTION_ROLLBACK", 1622, "Storage engine %s does not support rollback for this statement. Transaction rolled back and must be restarted" }, +{ "ER_SLAVE_HEARTBEAT_FAILURE", 1623, "Unexpected master\'s heartbeat data: %s" }, +{ "ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE", 1624, "The requested value for the heartbeat period is either negative or exceeds the maximum allowed (%s seconds)." }, +{ "ER_NDB_REPLICATION_SCHEMA_ERROR", 1625, "Bad schema for mysql.ndb_replication table. Message: %-.64s" }, +{ "ER_CONFLICT_FN_PARSE_ERROR", 1626, "Error in parsing conflict function. Message: %-.64s" }, +{ "ER_EXCEPTIONS_WRITE_ERROR", 1627, "Write to exceptions table failed. Message: %-.128s\"" }, +{ "ER_TOO_LONG_TABLE_COMMENT", 1628, "Comment for table \'%-.64s\' is too long (max = %lu)" }, +{ "ER_TOO_LONG_FIELD_COMMENT", 1629, "Comment for field \'%-.64s\' is too long (max = %lu)" }, +{ "ER_FUNC_INEXISTENT_NAME_COLLISION", 1630, "FUNCTION %s does not exist. Check the \'Function Name Parsing and Resolution\' section in the Reference Manual" }, +{ "ER_DATABASE_NAME", 1631, "Database" }, +{ "ER_TABLE_NAME", 1632, "Table" }, +{ "ER_PARTITION_NAME", 1633, "Partition" }, +{ "ER_SUBPARTITION_NAME", 1634, "Subpartition" }, +{ "ER_TEMPORARY_NAME", 1635, "Temporary" }, +{ "ER_RENAMED_NAME", 1636, "Renamed" }, +{ "ER_TOO_MANY_CONCURRENT_TRXS", 1637, "Too many active concurrent transactions" }, +{ "WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED", 1638, "Non-ASCII separator arguments are not fully supported" }, +{ "ER_DEBUG_SYNC_TIMEOUT", 1639, "debug sync point wait timed out" }, +{ "ER_DEBUG_SYNC_HIT_LIMIT", 1640, "debug sync point hit limit reached" }, +{ "ER_DUP_SIGNAL_SET", 1641, "Duplicate condition information item \'%s\'" }, +{ "ER_SIGNAL_WARN", 1642, "Unhandled user-defined warning condition" }, +{ "ER_SIGNAL_NOT_FOUND", 1643, "Unhandled user-defined not found condition" }, +{ "ER_SIGNAL_EXCEPTION", 1644, "Unhandled user-defined exception condition" }, +{ "ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER", 1645, "RESIGNAL when handler not active" }, +{ "ER_SIGNAL_BAD_CONDITION_TYPE", 1646, "SIGNAL/RESIGNAL can only use a CONDITION defined with SQLSTATE" }, +{ "WARN_COND_ITEM_TRUNCATED", 1647, "Data truncated for condition item \'%s\'" }, +{ "ER_COND_ITEM_TOO_LONG", 1648, "Data too long for condition item \'%s\'" }, +{ "ER_UNKNOWN_LOCALE", 1649, "Unknown locale: \'%-.64s\'" }, +{ "ER_SLAVE_IGNORE_SERVER_IDS", 1650, "The requested server id %d clashes with the slave startup option --replicate-same-server-id" }, +{ "ER_QUERY_CACHE_DISABLED", 1651, "Query cache is disabled; restart the server with query_cache_type=1 to enable it" }, +{ "ER_SAME_NAME_PARTITION_FIELD", 1652, "Duplicate partition field name \'%-.192s\'" }, +{ "ER_PARTITION_COLUMN_LIST_ERROR", 1653, "Inconsistency in usage of column lists for partitioning" }, +{ "ER_WRONG_TYPE_COLUMN_VALUE_ERROR", 1654, "Partition column values of incorrect type" }, +{ "ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR", 1655, "Too many fields in \'%-.192s\'" }, +{ "ER_MAXVALUE_IN_VALUES_IN", 1656, "Cannot use MAXVALUE as value in VALUES IN" }, +{ "ER_TOO_MANY_VALUES_ERROR", 1657, "Cannot have more than one value for this type of %-.64s partitioning" }, +{ "ER_ROW_SINGLE_PARTITION_FIELD_ERROR", 1658, "Row expressions in VALUES IN only allowed for multi-field column partitioning" }, +{ "ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD", 1659, "Field \'%-.192s\' is of a not allowed type for this type of partitioning" }, +{ "ER_PARTITION_FIELDS_TOO_LONG", 1660, "The total length of the partitioning fields is too large" }, +{ "ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE", 1661, "Cannot execute statement: impossible to write to binary log since both row-incapable engines and statement-incapable engines are involved." }, +{ "ER_BINLOG_ROW_MODE_AND_STMT_ENGINE", 1662, "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging." }, +{ "ER_BINLOG_UNSAFE_AND_STMT_ENGINE", 1663, "Cannot execute statement: impossible to write to binary log since statement is unsafe, storage engine is limited to statement-based logging, and BINLOG_FORMAT = MIXED. %s" }, +{ "ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE", 1664, "Cannot execute statement: impossible to write to binary log since statement is in row format and at least one table uses a storage engine limited to statement-based logging." }, +{ "ER_BINLOG_STMT_MODE_AND_ROW_ENGINE", 1665, "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging.%s" }, +{ "ER_BINLOG_ROW_INJECTION_AND_STMT_MODE", 1666, "Cannot execute statement: impossible to write to binary log since statement is in row format and BINLOG_FORMAT = STATEMENT." }, +{ "ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE", 1667, "Cannot execute statement: impossible to write to binary log since more than one engine is involved and at least one engine is self-logging." }, +{ "ER_BINLOG_UNSAFE_LIMIT", 1668, "The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted." }, +{ "ER_UNUSED4", 1669, "The statement is unsafe because it uses INSERT DELAYED. This is unsafe because the times when rows are inserted cannot be predicted." }, +{ "ER_BINLOG_UNSAFE_SYSTEM_TABLE", 1670, "The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves." }, +{ "ER_BINLOG_UNSAFE_AUTOINC_COLUMNS", 1671, "Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly." }, +{ "ER_BINLOG_UNSAFE_UDF", 1672, "Statement is unsafe because it uses a UDF which may not return the same value on the slave." }, +{ "ER_BINLOG_UNSAFE_SYSTEM_VARIABLE", 1673, "Statement is unsafe because it uses a system variable that may have a different value on the slave." }, +{ "ER_BINLOG_UNSAFE_SYSTEM_FUNCTION", 1674, "Statement is unsafe because it uses a system function that may return a different value on the slave." }, +{ "ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS", 1675, "Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction." }, +{ "ER_MESSAGE_AND_STATEMENT", 1676, "%s Statement: %s" }, +{ "ER_SLAVE_CONVERSION_FAILED", 1677, "Column %d of table \'%-.192s.%-.192s\' cannot be converted from type \'%-.32s\' to type \'%-.32s\'" }, +{ "ER_SLAVE_CANT_CREATE_CONVERSION", 1678, "Can\'t create conversion table for table \'%-.192s.%-.192s\'" }, +{ "ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT", 1679, "Cannot modify @@session.binlog_format inside a transaction" }, +{ "ER_PATH_LENGTH", 1680, "The path specified for %.64s is too long." }, +{ "ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT", 1681, "\'%s\' is deprecated and will be removed in a future release." }, +{ "ER_WRONG_NATIVE_TABLE_STRUCTURE", 1682, "Native table \'%-.64s\'.\'%-.64s\' has the wrong structure" }, +{ "ER_WRONG_PERFSCHEMA_USAGE", 1683, "Invalid performance_schema usage." }, +{ "ER_WARN_I_S_SKIPPED_TABLE", 1684, "Table \'%s\'.\'%s\' was skipped since its definition is being modified by concurrent DDL statement" }, +{ "ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT", 1685, "Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction" }, +{ "ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT", 1686, "Cannot change the binlog direct flag inside a stored function or trigger" }, +{ "ER_SPATIAL_MUST_HAVE_GEOM_COL", 1687, "A SPATIAL index may only contain a geometrical type column" }, +{ "ER_TOO_LONG_INDEX_COMMENT", 1688, "Comment for index \'%-.64s\' is too long (max = %lu)" }, +{ "ER_LOCK_ABORTED", 1689, "Wait on a lock was aborted due to a pending exclusive lock" }, +{ "ER_DATA_OUT_OF_RANGE", 1690, "%s value is out of range in \'%s\'" }, +{ "ER_WRONG_SPVAR_TYPE_IN_LIMIT", 1691, "A variable of a non-integer based type in LIMIT clause" }, +{ "ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE", 1692, "Mixing self-logging and non-self-logging engines in a statement is unsafe." }, +{ "ER_BINLOG_UNSAFE_MIXED_STATEMENT", 1693, "Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them." }, +{ "ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN", 1694, "Cannot modify @@session.sql_log_bin inside a transaction" }, +{ "ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN", 1695, "Cannot change the sql_log_bin inside a stored function or trigger" }, +{ "ER_FAILED_READ_FROM_PAR_FILE", 1696, "Failed to read from the .par file" }, +{ "ER_VALUES_IS_NOT_INT_TYPE_ERROR", 1697, "VALUES value for partition \'%-.64s\' must have type INT" }, +{ "ER_ACCESS_DENIED_NO_PASSWORD_ERROR", 1698, "Access denied for user \'%-.48s\'@\'%-.64s\'" }, +{ "ER_SET_PASSWORD_AUTH_PLUGIN", 1699, "SET PASSWORD has no significance for users authenticating via plugins" }, +{ "ER_GRANT_PLUGIN_USER_EXISTS", 1700, "GRANT with IDENTIFIED WITH is illegal because the user %-.*s already exists" }, +{ "ER_TRUNCATE_ILLEGAL_FK", 1701, "Cannot truncate a table referenced in a foreign key constraint (%.192s)" }, +{ "ER_PLUGIN_IS_PERMANENT", 1702, "Plugin \'%s\' is force_plus_permanent and can not be unloaded" }, +{ "ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN", 1703, "The requested value for the heartbeat period is less than 1 millisecond. The value is reset to 0, meaning that heartbeating will effectively be disabled." }, +{ "ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX", 1704, "The requested value for the heartbeat period exceeds the value of `slave_net_timeout\' seconds. A sensible value for the period should be less than the timeout." }, +{ "ER_STMT_CACHE_FULL", 1705, "Multi-row statements required more than \'max_binlog_stmt_cache_size\' bytes of storage; increase this mysqld variable and try again" }, +{ "ER_MULTI_UPDATE_KEY_CONFLICT", 1706, "Primary key/partition key update is not allowed since the table is updated both as \'%-.192s\' and \'%-.192s\'." }, +{ "ER_TABLE_NEEDS_REBUILD", 1707, "Table rebuild required. Please do \"ALTER TABLE `%-.64s` FORCE\" or dump/reload to fix it!" }, +{ "WARN_OPTION_BELOW_LIMIT", 1708, "The value of \'%s\' should be no less than the value of \'%s\'" }, +{ "ER_INDEX_COLUMN_TOO_LONG", 1709, "Index column size too large. The maximum column size is %lu bytes." }, +{ "ER_ERROR_IN_TRIGGER_BODY", 1710, "Trigger \'%-.64s\' has an error in its body: \'%-.256s\'" }, +{ "ER_ERROR_IN_UNKNOWN_TRIGGER_BODY", 1711, "Unknown trigger has an error in its body: \'%-.256s\'" }, +{ "ER_INDEX_CORRUPT", 1712, "Index %s is corrupted" }, +{ "ER_UNDO_RECORD_TOO_BIG", 1713, "Undo log record is too big." }, +{ "ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT", 1714, "INSERT IGNORE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave." }, +{ "ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE", 1715, "INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. This order cannot be predicted and may differ on master and the slave." }, +{ "ER_BINLOG_UNSAFE_REPLACE_SELECT", 1716, "REPLACE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave." }, +{ "ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT", 1717, "CREATE... IGNORE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave." }, +{ "ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT", 1718, "CREATE... REPLACE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave." }, +{ "ER_BINLOG_UNSAFE_UPDATE_IGNORE", 1719, "UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave." }, +{ "ER_PLUGIN_NO_UNINSTALL", 1720, "Plugin \'%s\' is marked as not dynamically uninstallable. You have to stop the server to uninstall it." }, +{ "ER_PLUGIN_NO_INSTALL", 1721, "Plugin \'%s\' is marked as not dynamically installable. You have to stop the server to install it." }, +{ "ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT", 1722, "Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave." }, +{ "ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC", 1723, "CREATE TABLE... SELECT... on a table with an auto-increment column is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are inserted. This order cannot be predicted and may differ on master and the slave." }, +{ "ER_BINLOG_UNSAFE_INSERT_TWO_KEYS", 1724, "INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe" }, +{ "ER_TABLE_IN_FK_CHECK", 1725, "Table is being used in foreign key check." }, +{ "ER_UNSUPPORTED_ENGINE", 1726, "Storage engine \'%s\' does not support system tables. [%s.%s]" }, +{ "ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST", 1727, "INSERT into autoincrement field which is not the first part in the composed primary key is unsafe." }, +{ "ER_CANNOT_LOAD_FROM_TABLE_V2", 1728, "Cannot load from %s.%s. The table is probably corrupted" }, +{ "ER_MASTER_DELAY_VALUE_OUT_OF_RANGE", 1729, "The requested value %s for the master delay exceeds the maximum %u" }, +{ "ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT", 1730, "Only Format_description_log_event and row events are allowed in BINLOG statements (but %s was provided)" }, +{ "ER_PARTITION_EXCHANGE_DIFFERENT_OPTION", 1731, "Non matching attribute \'%-.64s\' between partition and table" }, +{ "ER_PARTITION_EXCHANGE_PART_TABLE", 1732, "Table to exchange with partition is partitioned: \'%-.64s\'" }, +{ "ER_PARTITION_EXCHANGE_TEMP_TABLE", 1733, "Table to exchange with partition is temporary: \'%-.64s\'" }, +{ "ER_PARTITION_INSTEAD_OF_SUBPARTITION", 1734, "Subpartitioned table, use subpartition instead of partition" }, +{ "ER_UNKNOWN_PARTITION", 1735, "Unknown partition \'%-.64s\' in table \'%-.64s\'" }, +{ "ER_TABLES_DIFFERENT_METADATA", 1736, "Tables have different definitions" }, +{ "ER_ROW_DOES_NOT_MATCH_PARTITION", 1737, "Found a row that does not match the partition" }, +{ "ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX", 1738, "Option binlog_cache_size (%lu) is greater than max_binlog_cache_size (%lu); setting binlog_cache_size equal to max_binlog_cache_size." }, +{ "ER_WARN_INDEX_NOT_APPLICABLE", 1739, "Cannot use %-.64s access on index \'%-.64s\' due to type or collation conversion on field \'%-.64s\'" }, +{ "ER_PARTITION_EXCHANGE_FOREIGN_KEY", 1740, "Table to exchange with partition has foreign key references: \'%-.64s\'" }, +{ "ER_NO_SUCH_KEY_VALUE", 1741, "Key value \'%-.192s\' was not found in table \'%-.192s.%-.192s\'" }, +{ "ER_RPL_INFO_DATA_TOO_LONG", 1742, "Data for column \'%s\' too long" }, +{ "ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE", 1743, "Replication event checksum verification failed while reading from network." }, +{ "ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE", 1744, "Replication event checksum verification failed while reading from a log file." }, +{ "ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX", 1745, "Option binlog_stmt_cache_size (%lu) is greater than max_binlog_stmt_cache_size (%lu); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size." }, +{ "ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT", 1746, "Can\'t update table \'%-.192s\' while \'%-.192s\' is being created." }, +{ "ER_PARTITION_CLAUSE_ON_NONPARTITIONED", 1747, "PARTITION () clause on non partitioned table" }, +{ "ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET", 1748, "Found a row not matching the given partition set" }, +{ "ER_NO_SUCH_PARTITION__UNUSED", 1749, "partition \'%-.64s\' doesn\'t exist" }, +{ "ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE", 1750, "Failure while changing the type of replication repository: %s." }, +{ "ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE", 1751, "The creation of some temporary tables could not be rolled back." }, +{ "ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE", 1752, "Some temporary tables were dropped, but these operations could not be rolled back." }, +{ "ER_MTS_FEATURE_IS_NOT_SUPPORTED", 1753, "%s is not supported in multi-threaded slave mode. %s" }, +{ "ER_MTS_UPDATED_DBS_GREATER_MAX", 1754, "The number of modified databases exceeds the maximum %d; the database names will not be included in the replication event metadata." }, +{ "ER_MTS_CANT_PARALLEL", 1755, "Cannot execute the current event group in the parallel mode. Encountered event %s, relay-log name %s, position %s which prevents execution of this event group in parallel mode. Reason: %s." }, +{ "ER_MTS_INCONSISTENT_DATA", 1756, "%s" }, +{ "ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING", 1757, "FULLTEXT index is not supported for partitioned tables." }, +{ "ER_DA_INVALID_CONDITION_NUMBER", 1758, "Invalid condition number" }, +{ "ER_INSECURE_PLAIN_TEXT", 1759, "Sending passwords in plain text without SSL/TLS is extremely insecure." }, +{ "ER_INSECURE_CHANGE_MASTER", 1760, "Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the \'START SLAVE Syntax\' in the MySQL Manual for more information." }, +{ "ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO", 1761, "Foreign key constraint for table \'%.192s\', record \'%-.192s\' would lead to a duplicate entry in table \'%.192s\', key \'%.192s\'" }, +{ "ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO", 1762, "Foreign key constraint for table \'%.192s\', record \'%-.192s\' would lead to a duplicate entry in a child table" }, +{ "ER_SQLTHREAD_WITH_SECURE_SLAVE", 1763, "Setting authentication options is not possible when only the Slave SQL Thread is being started." }, +{ "ER_TABLE_HAS_NO_FT", 1764, "The table does not have FULLTEXT index to support this query" }, +{ "ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER", 1765, "The system variable %.200s cannot be set in stored functions or triggers." }, +{ "ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION", 1766, "The system variable %.200s cannot be set when there is an ongoing transaction." }, +{ "ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST", 1767, "The system variable @@SESSION.GTID_NEXT has the value %.200s, which is not listed in @@SESSION.GTID_NEXT_LIST." }, +{ "ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION", 1768, "The system variable @@SESSION.GTID_NEXT cannot change inside a transaction." }, +{ "ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION", 1769, "The statement \'SET %.200s\' cannot invoke a stored function." }, +{ "ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL", 1770, "The system variable @@SESSION.GTID_NEXT cannot be \'AUTOMATIC\' when @@SESSION.GTID_NEXT_LIST is non-NULL." }, +{ "ER_SKIPPING_LOGGED_TRANSACTION", 1771, "Skipping transaction %.200s because it has already been executed and logged." }, +{ "ER_MALFORMED_GTID_SET_SPECIFICATION", 1772, "Malformed GTID set specification \'%.200s\'." }, +{ "ER_MALFORMED_GTID_SET_ENCODING", 1773, "Malformed GTID set encoding." }, +{ "ER_MALFORMED_GTID_SPECIFICATION", 1774, "Malformed GTID specification \'%.200s\'." }, +{ "ER_GNO_EXHAUSTED", 1775, "Impossible to generate Global Transaction Identifier: the integer component reached the maximal value. Restart the server with a new server_uuid." }, +{ "ER_BAD_SLAVE_AUTO_POSITION", 1776, "Parameters MASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE and RELAY_LOG_POS cannot be set when MASTER_AUTO_POSITION is active." }, +{ "ER_AUTO_POSITION_REQUIRES_GTID_MODE_NOT_OFF", 1777, "CHANGE MASTER TO MASTER_AUTO_POSITION = 1 cannot be executed because @@GLOBAL.GTID_MODE = OFF." }, +{ "ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET", 1778, "Cannot execute statements with implicit commit inside a transaction when @@SESSION.GTID_NEXT == \'UUID:NUMBER\'." }, +{ "ER_GTID_MODE_ON_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON", 1779, "GTID_MODE = ON requires ENFORCE_GTID_CONSISTENCY = ON." }, +{ "ER_GTID_MODE_REQUIRES_BINLOG", 1780, "@@GLOBAL.GTID_MODE = ON or ON_PERMISSIVE or OFF_PERMISSIVE requires --log-bin and --log-slave-updates." }, +{ "ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF", 1781, "@@SESSION.GTID_NEXT cannot be set to UUID:NUMBER when @@GLOBAL.GTID_MODE = OFF." }, +{ "ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON", 1782, "@@SESSION.GTID_NEXT cannot be set to ANONYMOUS when @@GLOBAL.GTID_MODE = ON." }, +{ "ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF", 1783, "@@SESSION.GTID_NEXT_LIST cannot be set to a non-NULL value when @@GLOBAL.GTID_MODE = OFF." }, +{ "ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF__UNUSED", 1784, "Found a Gtid_log_event when @@GLOBAL.GTID_MODE = OFF." }, +{ "ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE", 1785, "Statement violates GTID consistency: Updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables." }, +{ "ER_GTID_UNSAFE_CREATE_SELECT", 1786, "Statement violates GTID consistency: CREATE TABLE ... SELECT." }, +{ "ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION", 1787, "Statement violates GTID consistency: CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can only be executed outside transactional context. These statements are also not allowed in a function or trigger because functions and triggers are also considered to be multi-statement transactions." }, +{ "ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME", 1788, "The value of @@GLOBAL.GTID_MODE can only be changed one step at a time: OFF <-> OFF_PERMISSIVE <-> ON_PERMISSIVE <-> ON. Also note that this value must be stepped up or down simultaneously on all servers. See the Manual for instructions." }, +{ "ER_MASTER_HAS_PURGED_REQUIRED_GTIDS", 1789, "The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires." }, +{ "ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID", 1790, "@@SESSION.GTID_NEXT cannot be changed by a client that owns a GTID. The client owns %s. Ownership is released on COMMIT or ROLLBACK." }, +{ "ER_UNKNOWN_EXPLAIN_FORMAT", 1791, "Unknown EXPLAIN format name: \'%s\'" }, +{ "ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION", 1792, "Cannot execute statement in a READ ONLY transaction." }, +{ "ER_TOO_LONG_TABLE_PARTITION_COMMENT", 1793, "Comment for table partition \'%-.64s\' is too long (max = %lu)" }, +{ "ER_SLAVE_CONFIGURATION", 1794, "Slave is not configured or failed to initialize properly. You must at least set --server-id to enable either a master or a slave. Additional error messages can be found in the MySQL error log." }, +{ "ER_INNODB_FT_LIMIT", 1795, "InnoDB presently supports one FULLTEXT index creation at a time" }, +{ "ER_INNODB_NO_FT_TEMP_TABLE", 1796, "Cannot create FULLTEXT index on temporary InnoDB table" }, +{ "ER_INNODB_FT_WRONG_DOCID_COLUMN", 1797, "Column \'%-.192s\' is of wrong type for an InnoDB FULLTEXT index" }, +{ "ER_INNODB_FT_WRONG_DOCID_INDEX", 1798, "Index \'%-.192s\' is of wrong type for an InnoDB FULLTEXT index" }, +{ "ER_INNODB_ONLINE_LOG_TOO_BIG", 1799, "Creating index \'%-.192s\' required more than \'innodb_online_alter_log_max_size\' bytes of modification log. Please try again." }, +{ "ER_UNKNOWN_ALTER_ALGORITHM", 1800, "Unknown ALGORITHM \'%s\'" }, +{ "ER_UNKNOWN_ALTER_LOCK", 1801, "Unknown LOCK type \'%s\'" }, +{ "ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS", 1802, "CHANGE MASTER cannot be executed when the slave was stopped with an error or killed in MTS mode. Consider using RESET SLAVE or START SLAVE UNTIL." }, +{ "ER_MTS_RECOVERY_FAILURE", 1803, "Cannot recover after SLAVE errored out in parallel execution mode. Additional error messages can be found in the MySQL error log." }, +{ "ER_MTS_RESET_WORKERS", 1804, "Cannot clean up worker info tables. Additional error messages can be found in the MySQL error log." }, +{ "ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2", 1805, "Column count of %s.%s is wrong. Expected %d, found %d. The table is probably corrupted" }, +{ "ER_SLAVE_SILENT_RETRY_TRANSACTION", 1806, "Slave must silently retry current transaction" }, +{ "ER_DISCARD_FK_CHECKS_RUNNING", 1807, "There is a foreign key check running on table \'%-.192s\'. Cannot discard the table." }, +{ "ER_TABLE_SCHEMA_MISMATCH", 1808, "Schema mismatch (%s)" }, +{ "ER_TABLE_IN_SYSTEM_TABLESPACE", 1809, "Table \'%-.192s\' in system tablespace" }, +{ "ER_IO_READ_ERROR", 1810, "IO Read error: (%lu, %s) %s" }, +{ "ER_IO_WRITE_ERROR", 1811, "IO Write error: (%lu, %s) %s" }, +{ "ER_TABLESPACE_MISSING", 1812, "Tablespace is missing for table %s." }, +{ "ER_TABLESPACE_EXISTS", 1813, "Tablespace \'%-.192s\' exists." }, +{ "ER_TABLESPACE_DISCARDED", 1814, "Tablespace has been discarded for table \'%-.192s\'" }, +{ "ER_INTERNAL_ERROR", 1815, "Internal error: %s" }, +{ "ER_INNODB_IMPORT_ERROR", 1816, "ALTER TABLE %-.192s IMPORT TABLESPACE failed with error %lu : \'%s\'" }, +{ "ER_INNODB_INDEX_CORRUPT", 1817, "Index corrupt: %s" }, +{ "ER_INVALID_YEAR_COLUMN_LENGTH", 1818, "Supports only YEAR or YEAR(4) column." }, +{ "ER_NOT_VALID_PASSWORD", 1819, "Your password does not satisfy the current policy requirements" }, +{ "ER_MUST_CHANGE_PASSWORD", 1820, "You must reset your password using ALTER USER statement before executing this statement." }, +{ "ER_FK_NO_INDEX_CHILD", 1821, "Failed to add the foreign key constaint. Missing index for constraint \'%s\' in the foreign table \'%s\'" }, +{ "ER_FK_NO_INDEX_PARENT", 1822, "Failed to add the foreign key constaint. Missing index for constraint \'%s\' in the referenced table \'%s\'" }, +{ "ER_FK_FAIL_ADD_SYSTEM", 1823, "Failed to add the foreign key constraint \'%s\' to system tables" }, +{ "ER_FK_CANNOT_OPEN_PARENT", 1824, "Failed to open the referenced table \'%s\'" }, +{ "ER_FK_INCORRECT_OPTION", 1825, "Failed to add the foreign key constraint on table \'%s\'. Incorrect options in FOREIGN KEY constraint \'%s\'" }, +{ "ER_FK_DUP_NAME", 1826, "Duplicate foreign key constraint name \'%s\'" }, +{ "ER_PASSWORD_FORMAT", 1827, "The password hash doesn\'t have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function." }, +{ "ER_FK_COLUMN_CANNOT_DROP", 1828, "Cannot drop column \'%-.192s\': needed in a foreign key constraint \'%-.192s\'" }, +{ "ER_FK_COLUMN_CANNOT_DROP_CHILD", 1829, "Cannot drop column \'%-.192s\': needed in a foreign key constraint \'%-.192s\' of table \'%-.192s\'" }, +{ "ER_FK_COLUMN_NOT_NULL", 1830, "Column \'%-.192s\' cannot be NOT NULL: needed in a foreign key constraint \'%-.192s\' SET NULL" }, +{ "ER_DUP_INDEX", 1831, "Duplicate index \'%-.64s\' defined on the table \'%-.64s.%-.64s\'. This is deprecated and will be disallowed in a future release." }, +{ "ER_FK_COLUMN_CANNOT_CHANGE", 1832, "Cannot change column \'%-.192s\': used in a foreign key constraint \'%-.192s\'" }, +{ "ER_FK_COLUMN_CANNOT_CHANGE_CHILD", 1833, "Cannot change column \'%-.192s\': used in a foreign key constraint \'%-.192s\' of table \'%-.192s\'" }, +{ "ER_UNUSED5", 1834, "Cannot delete rows from table which is parent in a foreign key constraint \'%-.192s\' of table \'%-.192s\'" }, +{ "ER_MALFORMED_PACKET", 1835, "Malformed communication packet." }, +{ "ER_READ_ONLY_MODE", 1836, "Running in read-only mode" }, +{ "ER_GTID_NEXT_TYPE_UNDEFINED_GROUP", 1837, "When @@SESSION.GTID_NEXT is set to a GTID, you must explicitly set it to a different value after a COMMIT or ROLLBACK. Please check GTID_NEXT variable manual page for detailed explanation. Current @@SESSION.GTID_NEXT is \'%s\'." }, +{ "ER_VARIABLE_NOT_SETTABLE_IN_SP", 1838, "The system variable %.200s cannot be set in stored procedures." }, +{ "ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF", 1839, "@@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_MODE = ON." }, +{ "ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY", 1840, "@@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty." }, +{ "ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY", 1841, "@@GLOBAL.GTID_PURGED can only be set when there are no ongoing transactions (not even in other clients)." }, +{ "ER_GTID_PURGED_WAS_CHANGED", 1842, "@@GLOBAL.GTID_PURGED was changed from \'%s\' to \'%s\'." }, +{ "ER_GTID_EXECUTED_WAS_CHANGED", 1843, "@@GLOBAL.GTID_EXECUTED was changed from \'%s\' to \'%s\'." }, +{ "ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES", 1844, "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT, and both replicated and non replicated tables are written to." }, +{ "ER_ALTER_OPERATION_NOT_SUPPORTED", 1845, "%s is not supported for this operation. Try %s." }, +{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON", 1846, "%s is not supported. Reason: %s. Try %s." }, +{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY", 1847, "COPY algorithm requires a lock" }, +{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION", 1848, "Partition specific operations do not yet support LOCK/ALGORITHM" }, +{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME", 1849, "Columns participating in a foreign key are renamed" }, +{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE", 1850, "Cannot change column type INPLACE" }, +{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK", 1851, "Adding foreign keys needs foreign_key_checks=OFF" }, +{ "ER_UNUSED6", 1852, "Creating unique indexes with IGNORE requires COPY algorithm to remove duplicate rows" }, +{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK", 1853, "Dropping a primary key is not allowed without also adding a new primary key" }, +{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC", 1854, "Adding an auto-increment column requires a lock" }, +{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS", 1855, "Cannot replace hidden FTS_DOC_ID with a user-visible one" }, +{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS", 1856, "Cannot drop or rename FTS_DOC_ID" }, +{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS", 1857, "Fulltext index creation requires a lock" }, +{ "ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE", 1858, "sql_slave_skip_counter can not be set when the server is running with @@GLOBAL.GTID_MODE = ON. Instead, for each transaction that you want to skip, generate an empty transaction with the same GTID as the transaction" }, +{ "ER_DUP_UNKNOWN_IN_INDEX", 1859, "Duplicate entry for key \'%-.192s\'" }, +{ "ER_IDENT_CAUSES_TOO_LONG_PATH", 1860, "Long database name and identifier for object resulted in path length exceeding %d characters. Path: \'%s\'." }, +{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL", 1861, "cannot silently convert NULL values, as required in this SQL_MODE" }, +{ "ER_MUST_CHANGE_PASSWORD_LOGIN", 1862, "Your password has expired. To log in you must change it using a client that supports expired passwords." }, +{ "ER_ROW_IN_WRONG_PARTITION", 1863, "Found a row in wrong partition %s" }, +{ "ER_MTS_EVENT_BIGGER_PENDING_JOBS_SIZE_MAX", 1864, "Cannot schedule event %s, relay-log name %s, position %s to Worker thread because its size %lu exceeds %lu of slave_pending_jobs_size_max." }, +{ "ER_INNODB_NO_FT_USES_PARSER", 1865, "Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table" }, +{ "ER_BINLOG_LOGICAL_CORRUPTION", 1866, "The binary log file \'%s\' is logically corrupted: %s" }, +{ "ER_WARN_PURGE_LOG_IN_USE", 1867, "file %s was not purged because it was being read by %d thread(s), purged only %d out of %d files." }, +{ "ER_WARN_PURGE_LOG_IS_ACTIVE", 1868, "file %s was not purged because it is the active log file." }, +{ "ER_AUTO_INCREMENT_CONFLICT", 1869, "Auto-increment value in UPDATE conflicts with internally generated values" }, +{ "WARN_ON_BLOCKHOLE_IN_RBR", 1870, "Row events are not logged for %s statements that modify BLACKHOLE tables in row format. Table(s): \'%-.192s\'" }, +{ "ER_SLAVE_MI_INIT_REPOSITORY", 1871, "Slave failed to initialize master info structure from the repository" }, +{ "ER_SLAVE_RLI_INIT_REPOSITORY", 1872, "Slave failed to initialize relay log info structure from the repository" }, +{ "ER_ACCESS_DENIED_CHANGE_USER_ERROR", 1873, "Access denied trying to change to user \'%-.48s\'@\'%-.64s\' (using password: %s). Disconnecting." }, +{ "ER_INNODB_READ_ONLY", 1874, "InnoDB is in read only mode." }, +{ "ER_STOP_SLAVE_SQL_THREAD_TIMEOUT", 1875, "STOP SLAVE command execution is incomplete: Slave SQL thread got the stop signal, thread is busy, SQL thread will stop once the current task is complete." }, +{ "ER_STOP_SLAVE_IO_THREAD_TIMEOUT", 1876, "STOP SLAVE command execution is incomplete: Slave IO thread got the stop signal, thread is busy, IO thread will stop once the current task is complete." }, +{ "ER_TABLE_CORRUPT", 1877, "Operation cannot be performed. The table \'%-.64s.%-.64s\' is missing, corrupt or contains bad data." }, +{ "ER_TEMP_FILE_WRITE_FAILURE", 1878, "Temporary file write failure." }, +{ "ER_INNODB_FT_AUX_NOT_HEX_ID", 1879, "Upgrade index name failed, please use create index(alter table) algorithm copy to rebuild index." }, +{ "ER_OLD_TEMPORALS_UPGRADED", 1880, "TIME/TIMESTAMP/DATETIME columns of old format have been upgraded to the new format." }, +{ "ER_INNODB_FORCED_RECOVERY", 1881, "Operation not allowed when innodb_forced_recovery > 0." }, +{ "ER_AES_INVALID_IV", 1882, "The initialization vector supplied to %s is too short. Must be at least %d bytes long" }, +{ "ER_PLUGIN_CANNOT_BE_UNINSTALLED", 1883, "Plugin \'%s\' cannot be uninstalled now. %s" }, +{ "ER_GTID_UNSAFE_BINLOG_SPLITTABLE_STATEMENT_AND_GTID_GROUP", 1884, "Cannot execute statement because it needs to be written to the binary log as multiple statements, and this is not allowed when @@SESSION.GTID_NEXT == \'UUID:NUMBER\'." }, +{ "ER_SLAVE_HAS_MORE_GTIDS_THAN_MASTER", 1885, "Slave has more GTIDs than the master has, using the master\'s SERVER_UUID. This may indicate that the end of the binary log was truncated or that the last binary log file was lost, e.g., after a power or disk failure when sync_binlog != 1. The master may or may not have rolled back transactions that were already replicated to the slave. Suggest to replicate any transactions that master has rolled back from slave to master, and/or commit empty transactions on master to account for transactions that have been committed on master but are not included in GTID_EXECUTED." }, +{ "ER_FILE_CORRUPT", 3000, "File %s is corrupted" }, +{ "ER_ERROR_ON_MASTER", 3001, "Query partially completed on the master (error on master: %d) and was aborted. There is a chance that your master is inconsistent at this point. If you are sure that your master is ok, run this query manually on the slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;. Query:\'%s\'" }, +{ "ER_INCONSISTENT_ERROR", 3002, "Query caused different errors on master and slave. Error on master: message (format)=\'%s\' error code=%d; Error on slave:actual message=\'%s\', error code=%d. Default database:\'%s\'. Query:\'%s\'" }, +{ "ER_STORAGE_ENGINE_NOT_LOADED", 3003, "Storage engine for table \'%s\'.\'%s\' is not loaded." }, +{ "ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER", 3004, "GET STACKED DIAGNOSTICS when handler not active" }, +{ "ER_WARN_LEGACY_SYNTAX_CONVERTED", 3005, "%s is no longer supported. The statement was converted to %s." }, +{ "ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN", 3006, "Statement is unsafe because it uses a fulltext parser plugin which may not return the same value on the slave." }, +{ "ER_CANNOT_DISCARD_TEMPORARY_TABLE", 3007, "Cannot DISCARD/IMPORT tablespace associated with temporary table" }, +{ "ER_FK_DEPTH_EXCEEDED", 3008, "Foreign key cascade delete/update exceeds max depth of %d." }, +{ "ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2", 3009, "Column count of %s.%s is wrong. Expected %d, found %d. Created with MySQL %d, now running %d. Please use mysql_upgrade to fix this error." }, +{ "ER_WARN_TRIGGER_DOESNT_HAVE_CREATED", 3010, "Trigger %s.%s.%s does not have CREATED attribute." }, +{ "ER_REFERENCED_TRG_DOES_NOT_EXIST", 3011, "Referenced trigger \'%s\' for the given action time and event type does not exist." }, +{ "ER_EXPLAIN_NOT_SUPPORTED", 3012, "EXPLAIN FOR CONNECTION command is supported only for SELECT/UPDATE/INSERT/DELETE/REPLACE" }, +{ "ER_INVALID_FIELD_SIZE", 3013, "Invalid size for column \'%-.192s\'." }, +{ "ER_MISSING_HA_CREATE_OPTION", 3014, "Table storage engine \'%-.64s\' found required create option missing" }, +{ "ER_ENGINE_OUT_OF_MEMORY", 3015, "Out of memory in storage engine \'%-.64s\'." }, +{ "ER_PASSWORD_EXPIRE_ANONYMOUS_USER", 3016, "The password for anonymous user cannot be expired." }, +{ "ER_SLAVE_SQL_THREAD_MUST_STOP", 3017, "This operation cannot be performed with a running slave sql thread; run STOP SLAVE SQL_THREAD first" }, +{ "ER_NO_FT_MATERIALIZED_SUBQUERY", 3018, "Cannot create FULLTEXT index on materialized subquery" }, +{ "ER_INNODB_UNDO_LOG_FULL", 3019, "Undo Log error: %s" }, +{ "ER_INVALID_ARGUMENT_FOR_LOGARITHM", 3020, "Invalid argument for logarithm" }, +{ "ER_SLAVE_CHANNEL_IO_THREAD_MUST_STOP", 3021, "This operation cannot be performed with a running slave io thread; run STOP SLAVE IO_THREAD FOR CHANNEL \'%s\' first." }, +{ "ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO", 3022, "This operation may not be safe when the slave has temporary tables. The tables will be kept open until the server restarts or until the tables are deleted by any replicated DROP statement. Suggest to wait until slave_open_temp_tables = 0." }, +{ "ER_WARN_ONLY_MASTER_LOG_FILE_NO_POS", 3023, "CHANGE MASTER TO with a MASTER_LOG_FILE clause but no MASTER_LOG_POS clause may not be safe. The old position value may not be valid for the new binary log file." }, +{ "ER_QUERY_TIMEOUT", 3024, "Query execution was interrupted, maximum statement execution time exceeded" }, +{ "ER_NON_RO_SELECT_DISABLE_TIMER", 3025, "Select is not a read only statement, disabling timer" }, +{ "ER_DUP_LIST_ENTRY", 3026, "Duplicate entry \'%-.192s\'." }, +{ "ER_SQL_MODE_NO_EFFECT", 3027, "\'%s\' mode no longer has any effect. Use STRICT_ALL_TABLES or STRICT_TRANS_TABLES instead." }, +{ "ER_AGGREGATE_ORDER_FOR_UNION", 3028, "Expression #%u of ORDER BY contains aggregate function and applies to a UNION" }, +{ "ER_AGGREGATE_ORDER_NON_AGG_QUERY", 3029, "Expression #%u of ORDER BY contains aggregate function and applies to the result of a non-aggregated query" }, +{ "ER_SLAVE_WORKER_STOPPED_PREVIOUS_THD_ERROR", 3030, "Slave worker has stopped after at least one previous worker encountered an error when slave-preserve-commit-order was enabled. To preserve commit order, the last transaction executed by this thread has not been committed. When restarting the slave after fixing any failed threads, you should fix this worker as well." }, +{ "ER_DONT_SUPPORT_SLAVE_PRESERVE_COMMIT_ORDER", 3031, "slave_preserve_commit_order is not supported %s." }, +{ "ER_SERVER_OFFLINE_MODE", 3032, "The server is currently in offline mode" }, +{ "ER_GIS_DIFFERENT_SRIDS", 3033, "Binary geometry function %s given two geometries of different srids: %u and %u, which should have been identical." }, +{ "ER_GIS_UNSUPPORTED_ARGUMENT", 3034, "Calling geometry function %s with unsupported types of arguments." }, +{ "ER_GIS_UNKNOWN_ERROR", 3035, "Unknown GIS error occured in function %s." }, +{ "ER_GIS_UNKNOWN_EXCEPTION", 3036, "Unknown exception caught in GIS function %s." }, +{ "ER_GIS_INVALID_DATA", 3037, "Invalid GIS data provided to function %s." }, +{ "ER_BOOST_GEOMETRY_EMPTY_INPUT_EXCEPTION", 3038, "The geometry has no data in function %s." }, +{ "ER_BOOST_GEOMETRY_CENTROID_EXCEPTION", 3039, "Unable to calculate centroid because geometry is empty in function %s." }, +{ "ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION", 3040, "Geometry overlay calculation error: geometry data is invalid in function %s." }, +{ "ER_BOOST_GEOMETRY_TURN_INFO_EXCEPTION", 3041, "Geometry turn info calculation error: geometry data is invalid in function %s." }, +{ "ER_BOOST_GEOMETRY_SELF_INTERSECTION_POINT_EXCEPTION", 3042, "Analysis procedures of intersection points interrupted unexpectedly in function %s." }, +{ "ER_BOOST_GEOMETRY_UNKNOWN_EXCEPTION", 3043, "Unknown exception thrown in function %s." }, +{ "ER_STD_BAD_ALLOC_ERROR", 3044, "Memory allocation error: %-.256s in function %s." }, +{ "ER_STD_DOMAIN_ERROR", 3045, "Domain error: %-.256s in function %s." }, +{ "ER_STD_LENGTH_ERROR", 3046, "Length error: %-.256s in function %s." }, +{ "ER_STD_INVALID_ARGUMENT", 3047, "Invalid argument error: %-.256s in function %s." }, +{ "ER_STD_OUT_OF_RANGE_ERROR", 3048, "Out of range error: %-.256s in function %s." }, +{ "ER_STD_OVERFLOW_ERROR", 3049, "Overflow error error: %-.256s in function %s." }, +{ "ER_STD_RANGE_ERROR", 3050, "Range error: %-.256s in function %s." }, +{ "ER_STD_UNDERFLOW_ERROR", 3051, "Underflow error: %-.256s in function %s." }, +{ "ER_STD_LOGIC_ERROR", 3052, "Logic error: %-.256s in function %s." }, +{ "ER_STD_RUNTIME_ERROR", 3053, "Runtime error: %-.256s in function %s." }, +{ "ER_STD_UNKNOWN_EXCEPTION", 3054, "Unknown exception: %-.384s in function %s." }, +{ "ER_GIS_DATA_WRONG_ENDIANESS", 3055, "Geometry byte string must be little endian." }, +{ "ER_CHANGE_MASTER_PASSWORD_LENGTH", 3056, "The password provided for the replication user exceeds the maximum length of 32 characters" }, +{ "ER_USER_LOCK_WRONG_NAME", 3057, "Incorrect user-level lock name \'%-.192s\'." }, +{ "ER_USER_LOCK_DEADLOCK", 3058, "Deadlock found when trying to get user-level lock; try rolling back transaction/releasing locks and restarting lock acquisition." }, +{ "ER_REPLACE_INACCESSIBLE_ROWS", 3059, "REPLACE cannot be executed as it requires deleting rows that are not in the view" }, +{ "ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS", 3060, "Do not support online operation on table with GIS index" }, +{ "ER_ILLEGAL_USER_VAR", 3061, "User variable name \'%-.100s\' is illegal" }, +{ "ER_GTID_MODE_OFF", 3062, "Cannot %s when GTID_MODE = OFF." }, +{ "ER_UNSUPPORTED_BY_REPLICATION_THREAD", 3063, "Cannot %s from a replication slave thread." }, +{ "ER_INCORRECT_TYPE", 3064, "Incorrect type for argument %s in function %s." }, +{ "ER_FIELD_IN_ORDER_NOT_SELECT", 3065, "Expression #%u of ORDER BY clause is not in SELECT list, references column \'%-.192s\' which is not in SELECT list; this is incompatible with %s" }, +{ "ER_AGGREGATE_IN_ORDER_NOT_SELECT", 3066, "Expression #%u of ORDER BY clause is not in SELECT list, contains aggregate function; this is incompatible with %s" }, +{ "ER_INVALID_RPL_WILD_TABLE_FILTER_PATTERN", 3067, "Supplied filter list contains a value which is not in the required format \'db_pattern.table_pattern\'" }, +{ "ER_NET_OK_PACKET_TOO_LARGE", 3068, "OK packet too large" }, +{ "ER_INVALID_JSON_DATA", 3069, "Invalid JSON data provided to function %s: %s" }, +{ "ER_INVALID_GEOJSON_MISSING_MEMBER", 3070, "Invalid GeoJSON data provided to function %s: Missing required member \'%s\'" }, +{ "ER_INVALID_GEOJSON_WRONG_TYPE", 3071, "Invalid GeoJSON data provided to function %s: Member \'%s\' must be of type \'%s\'" }, +{ "ER_INVALID_GEOJSON_UNSPECIFIED", 3072, "Invalid GeoJSON data provided to function %s" }, +{ "ER_DIMENSION_UNSUPPORTED", 3073, "Unsupported number of coordinate dimensions in function %s: Found %u, expected %u" }, +{ "ER_SLAVE_CHANNEL_DOES_NOT_EXIST", 3074, "Slave channel \'%s\' does not exist." }, +{ "ER_SLAVE_MULTIPLE_CHANNELS_HOST_PORT", 3075, "A slave channel \'%s\' already exists for the given host and port combination." }, +{ "ER_SLAVE_CHANNEL_NAME_INVALID_OR_TOO_LONG", 3076, "Couldn\'t create channel: Channel name is either invalid or too long." }, +{ "ER_SLAVE_NEW_CHANNEL_WRONG_REPOSITORY", 3077, "To have multiple channels, repository cannot be of type FILE; Please check the repository configuration and convert them to TABLE." }, +{ "ER_SLAVE_CHANNEL_DELETE", 3078, "Cannot delete slave info objects for channel \'%s\'." }, +{ "ER_SLAVE_MULTIPLE_CHANNELS_CMD", 3079, "Multiple channels exist on the slave. Please provide channel name as an argument." }, +{ "ER_SLAVE_MAX_CHANNELS_EXCEEDED", 3080, "Maximum number of replication channels allowed exceeded." }, +{ "ER_SLAVE_CHANNEL_MUST_STOP", 3081, "This operation cannot be performed with running replication threads; run STOP SLAVE FOR CHANNEL \'%s\' first" }, +{ "ER_SLAVE_CHANNEL_NOT_RUNNING", 3082, "This operation requires running replication threads; configure slave and run START SLAVE FOR CHANNEL \'%s\'" }, +{ "ER_SLAVE_CHANNEL_WAS_RUNNING", 3083, "Replication thread(s) for channel \'%s\' are already runnning." }, +{ "ER_SLAVE_CHANNEL_WAS_NOT_RUNNING", 3084, "Replication thread(s) for channel \'%s\' are already stopped." }, +{ "ER_SLAVE_CHANNEL_SQL_THREAD_MUST_STOP", 3085, "This operation cannot be performed with a running slave sql thread; run STOP SLAVE SQL_THREAD FOR CHANNEL \'%s\' first." }, +{ "ER_SLAVE_CHANNEL_SQL_SKIP_COUNTER", 3086, "When sql_slave_skip_counter > 0, it is not allowed to start more than one SQL thread by using \'START SLAVE [SQL_THREAD]\'. Value of sql_slave_skip_counter can only be used by one SQL thread at a time. Please use \'START SLAVE [SQL_THREAD] FOR CHANNEL\' to start the SQL thread which will use the value of sql_slave_skip_counter." }, +{ "ER_WRONG_FIELD_WITH_GROUP_V2", 3087, "Expression #%u of %s is not in GROUP BY clause and contains nonaggregated column \'%-.192s\' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by" }, +{ "ER_MIX_OF_GROUP_FUNC_AND_FIELDS_V2", 3088, "In aggregated query without GROUP BY, expression #%u of %s contains nonaggregated column \'%-.192s\'; this is incompatible with sql_mode=only_full_group_by" }, +{ "ER_WARN_DEPRECATED_SYSVAR_UPDATE", 3089, "Updating \'%s\' is deprecated. It will be made read-only in a future release." }, +{ "ER_WARN_DEPRECATED_SQLMODE", 3090, "Changing sql mode \'%s\' is deprecated. It will be removed in a future release." }, +{ "ER_CANNOT_LOG_PARTIAL_DROP_DATABASE_WITH_GTID", 3091, "DROP DATABASE failed; some tables may have been dropped but the database directory remains. The GTID has not been added to GTID_EXECUTED and the statement was not written to the binary log. Fix this as follows: (1) remove all files from the database directory %-.192s; (2) SET GTID_NEXT=\'%-.192s\'; (3) DROP DATABASE `%-.192s`." }, +{ "ER_GROUP_REPLICATION_CONFIGURATION", 3092, "The server is not configured properly to be an active member of the group. Please see more details on error log." }, +{ "ER_GROUP_REPLICATION_RUNNING", 3093, "The START GROUP_REPLICATION command failed since the group is already running." }, +{ "ER_GROUP_REPLICATION_APPLIER_INIT_ERROR", 3094, "The START GROUP_REPLICATION command failed as the applier module failed to start." }, +{ "ER_GROUP_REPLICATION_STOP_APPLIER_THREAD_TIMEOUT", 3095, "The STOP GROUP_REPLICATION command execution is incomplete: The applier thread got the stop signal while it was busy. The applier thread will stop once the current task is complete." }, +{ "ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR", 3096, "The START GROUP_REPLICATION command failed as there was an error when initializing the group communication layer." }, +{ "ER_GROUP_REPLICATION_COMMUNICATION_LAYER_JOIN_ERROR", 3097, "The START GROUP_REPLICATION command failed as there was an error when joining the communication group." }, +{ "ER_BEFORE_DML_VALIDATION_ERROR", 3098, "The table does not comply with the requirements by an external plugin." }, +{ "ER_PREVENTS_VARIABLE_WITHOUT_RBR", 3099, "Cannot change the value of variable %s without binary log format as ROW." }, +{ "ER_RUN_HOOK_ERROR", 3100, "Error on observer while running replication hook \'%s\'." }, +{ "ER_TRANSACTION_ROLLBACK_DURING_COMMIT", 3101, "Plugin instructed the server to rollback the current transaction." }, +{ "ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED", 3102, "Expression of generated column \'%s\' contains a disallowed function." }, +{ "ER_UNSUPPORTED_ALTER_INPLACE_ON_VIRTUAL_COLUMN", 3103, "INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions" }, +{ "ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN", 3104, "Cannot define foreign key with %s clause on a generated column." }, +{ "ER_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN", 3105, "The value specified for generated column \'%s\' in table \'%s\' is not allowed." }, +{ "ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN", 3106, "\'%s\' is not supported for generated columns." }, +{ "ER_GENERATED_COLUMN_NON_PRIOR", 3107, "Generated column can refer only to generated columns defined prior to it." }, +{ "ER_DEPENDENT_BY_GENERATED_COLUMN", 3108, "Column \'%s\' has a generated column dependency." }, +{ "ER_GENERATED_COLUMN_REF_AUTO_INC", 3109, "Generated column \'%s\' cannot refer to auto-increment column." }, +{ "ER_FEATURE_NOT_AVAILABLE", 3110, "The \'%-.64s\' feature is not available; you need to remove \'%-.64s\' or use MySQL built with \'%-.64s\'" }, +{ "ER_CANT_SET_GTID_MODE", 3111, "SET @@GLOBAL.GTID_MODE = %-.64s is not allowed because %-.384s." }, +{ "ER_CANT_USE_AUTO_POSITION_WITH_GTID_MODE_OFF", 3112, "The replication receiver thread%-.192s cannot start in AUTO_POSITION mode: this server uses @@GLOBAL.GTID_MODE = OFF." }, +{ "ER_CANT_REPLICATE_ANONYMOUS_WITH_AUTO_POSITION", 3113, "Cannot replicate anonymous transaction when AUTO_POSITION = 1, at file %.512s, position %lld." }, +{ "ER_CANT_REPLICATE_ANONYMOUS_WITH_GTID_MODE_ON", 3114, "Cannot replicate anonymous transaction when @@GLOBAL.GTID_MODE = ON, at file %.512s, position %lld." }, +{ "ER_CANT_REPLICATE_GTID_WITH_GTID_MODE_OFF", 3115, "Cannot replicate GTID-transaction when @@GLOBAL.GTID_MODE = OFF, at file %.512s, position %lld." }, +{ "ER_CANT_SET_ENFORCE_GTID_CONSISTENCY_ON_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS", 3116, "Cannot set ENFORCE_GTID_CONSISTENCY = ON because there are ongoing transactions that violate GTID consistency." }, +{ "ER_SET_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS", 3117, "There are ongoing transactions that violate GTID consistency." }, +{ "ER_ACCOUNT_HAS_BEEN_LOCKED", 3118, "Access denied for user \'%-.48s\'@\'%-.64s\'. Account is locked." }, +{ "ER_WRONG_TABLESPACE_NAME", 3119, "Incorrect tablespace name `%-.192s`" }, +{ "ER_TABLESPACE_IS_NOT_EMPTY", 3120, "Tablespace `%-.192s` is not empty." }, +{ "ER_WRONG_FILE_NAME", 3121, "Incorrect File Name \'%s\'." }, +{ "ER_BOOST_GEOMETRY_INCONSISTENT_TURNS_EXCEPTION", 3122, "Inconsistent intersection points." }, +{ "ER_WARN_OPTIMIZER_HINT_SYNTAX_ERROR", 3123, "Optimizer hint syntax error" }, +{ "ER_WARN_BAD_MAX_EXECUTION_TIME", 3124, "Unsupported MAX_EXECUTION_TIME" }, +{ "ER_WARN_UNSUPPORTED_MAX_EXECUTION_TIME", 3125, "MAX_EXECUTION_TIME hint is supported by top-level standalone SELECT statements only" }, +{ "ER_WARN_CONFLICTING_HINT", 3126, "Hint %s is ignored as conflicting/duplicated" }, +{ "ER_WARN_UNKNOWN_QB_NAME", 3127, "Query block name %s is not found for %s hint" }, +{ "ER_UNRESOLVED_HINT_NAME", 3128, "Unresolved name %s for %s hint" }, +{ "ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE", 3129, "Please do not modify the %s table. This is a mysql internal system table to store GTIDs for committed transactions. Modifying it can lead to an inconsistent GTID state." }, +{ "ER_PLUGGABLE_PROTOCOL_COMMAND_NOT_SUPPORTED", 3130, "Command not supported by pluggable protocols" }, +{ "ER_LOCKING_SERVICE_WRONG_NAME", 3131, "Incorrect locking service lock name \'%-.192s\'." }, +{ "ER_LOCKING_SERVICE_DEADLOCK", 3132, "Deadlock found when trying to get locking service lock; try releasing locks and restarting lock acquisition." }, +{ "ER_LOCKING_SERVICE_TIMEOUT", 3133, "Service lock wait timeout exceeded." }, +{ "ER_GIS_MAX_POINTS_IN_GEOMETRY_OVERFLOWED", 3134, "Parameter %s exceeds the maximum number of points in a geometry (%lu) in function %s." }, +{ "ER_SQL_MODE_MERGED", 3135, "\'NO_ZERO_DATE\', \'NO_ZERO_IN_DATE\' and \'ERROR_FOR_DIVISION_BY_ZERO\' sql modes should be used with strict mode. They will be merged with strict mode in a future release." }, +{ "ER_VTOKEN_PLUGIN_TOKEN_MISMATCH", 3136, "Version token mismatch for %.*s. Correct value %.*s" }, +{ "ER_VTOKEN_PLUGIN_TOKEN_NOT_FOUND", 3137, "Version token %.*s not found." }, +{ "ER_CANT_SET_VARIABLE_WHEN_OWNING_GTID", 3138, "Variable %-.192s cannot be changed by a client that owns a GTID. The client owns %s. Ownership is released on COMMIT or ROLLBACK." }, +{ "ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED", 3139, "%-.192s cannot be performed on channel \'%-.192s\'." }, +{ "ER_INVALID_JSON_TEXT", 3140, "Invalid JSON text: \"%s\" at position %u in value for column \'%-.200s\'." }, +{ "ER_INVALID_JSON_TEXT_IN_PARAM", 3141, "Invalid JSON text in argument %u to function %s: \"%s\" at position %u.%-.0s" }, +{ "ER_INVALID_JSON_BINARY_DATA", 3142, "The JSON binary value contains invalid data." }, +{ "ER_INVALID_JSON_PATH", 3143, "Invalid JSON path expression. The error is around character position %u.%-.200s" }, +{ "ER_INVALID_JSON_CHARSET", 3144, "Cannot create a JSON value from a string with CHARACTER SET \'%s\'." }, +{ "ER_INVALID_JSON_CHARSET_IN_FUNCTION", 3145, "Invalid JSON character data provided to function %s: \'%s\'; utf8 is required." }, +{ "ER_INVALID_TYPE_FOR_JSON", 3146, "Invalid data type for JSON data in argument %u to function %s; a JSON string or JSON type is required." }, +{ "ER_INVALID_CAST_TO_JSON", 3147, "Cannot CAST value to JSON." }, +{ "ER_INVALID_JSON_PATH_CHARSET", 3148, "A path expression must be encoded in the utf8 character set. The path expression \'%-.200s\' is encoded in character set \'%-.200s\'." }, +{ "ER_INVALID_JSON_PATH_WILDCARD", 3149, "In this situation, path expressions may not contain the * and ** tokens." }, +{ "ER_JSON_VALUE_TOO_BIG", 3150, "The JSON value is too big to be stored in a JSON column." }, +{ "ER_JSON_KEY_TOO_BIG", 3151, "The JSON object contains a key name that is too long." }, +{ "ER_JSON_USED_AS_KEY", 3152, "JSON column \'%-.192s\' cannot be used in key specification." }, +{ "ER_JSON_VACUOUS_PATH", 3153, "The path expression \'$\' is not allowed in this context." }, +{ "ER_JSON_BAD_ONE_OR_ALL_ARG", 3154, "The oneOrAll argument to %s may take these values: \'one\' or \'all\'." }, +{ "ER_NUMERIC_JSON_VALUE_OUT_OF_RANGE", 3155, "Out of range JSON value for CAST to %s%-.0s from column %s at row %ld" }, +{ "ER_INVALID_JSON_VALUE_FOR_CAST", 3156, "Invalid JSON value for CAST to %s%-.0s from column %s at row %ld" }, +{ "ER_JSON_DOCUMENT_TOO_DEEP", 3157, "The JSON document exceeds the maximum depth." }, +{ "ER_JSON_DOCUMENT_NULL_KEY", 3158, "JSON documents may not contain NULL member names." }, +{ "ER_SECURE_TRANSPORT_REQUIRED", 3159, "Connections using insecure transport are prohibited while --require_secure_transport=ON." }, +{ "ER_NO_SECURE_TRANSPORTS_CONFIGURED", 3160, "No secure transports (SSL or Shared Memory) are configured, unable to set --require_secure_transport=ON." }, +{ "ER_DISABLED_STORAGE_ENGINE", 3161, "Storage engine %s is disabled (Table creation is disallowed)." }, +{ "ER_USER_DOES_NOT_EXIST", 3162, "User %s does not exist." }, +{ "ER_USER_ALREADY_EXISTS", 3163, "User %s already exists." }, +{ "ER_AUDIT_API_ABORT", 3164, "Aborted by Audit API (\'%-.48s\';%d)." }, +{ "ER_INVALID_JSON_PATH_ARRAY_CELL", 3165, "A path expression is not a path to a cell in an array." }, +{ "ER_BUFPOOL_RESIZE_INPROGRESS", 3166, "Another buffer pool resize is already in progress." }, +{ "ER_FEATURE_DISABLED_SEE_DOC", 3167, "The \'%s\' feature is disabled; see the documentation for \'%s\'" }, +{ "ER_SERVER_ISNT_AVAILABLE", 3168, "Server isn\'t available" }, +{ "ER_SESSION_WAS_KILLED", 3169, "Session was killed" }, +{ "ER_CAPACITY_EXCEEDED", 3170, "Memory capacity of %llu bytes for \'%s\' exceeded. %s" }, +{ "ER_CAPACITY_EXCEEDED_IN_RANGE_OPTIMIZER", 3171, "Range optimization was not done for this query." }, +{ "ER_TABLE_NEEDS_UPG_PART", 3172, "Partitioning upgrade required. Please dump/reload to fix it or do: ALTER TABLE `%-.192s`.`%-.192s` UPGRADE PARTITIONING" }, +{ "ER_CANT_WAIT_FOR_EXECUTED_GTID_SET_WHILE_OWNING_A_GTID", 3173, "The client holds ownership of the GTID %s. Therefore, WAIT_FOR_EXECUTED_GTID_SET cannot wait for this GTID." }, +{ "ER_CANNOT_ADD_FOREIGN_BASE_COL_VIRTUAL", 3174, "Cannot add foreign key on the base column of indexed virtual column." }, +{ "ER_CANNOT_CREATE_VIRTUAL_INDEX_CONSTRAINT", 3175, "Cannot create index on virtual column whose base column has foreign constraint." }, +{ "ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE", 3176, "Please do not modify the %s table with an XA transaction. This is an internal system table used to store GTIDs for committed transactions. Although modifying it can lead to an inconsistent GTID state, if neccessary you can modify it with a non-XA transaction." }, +{ "ER_LOCK_REFUSED_BY_ENGINE", 3177, "Lock acquisition refused by storage engine." }, +{ "ER_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN", 3178, "ADD COLUMN col...VIRTUAL, ADD INDEX(col)" }, +{ "ER_MASTER_KEY_ROTATION_NOT_SUPPORTED_BY_SE", 3179, "Master key rotation is not supported by storage engine." }, +{ "ER_MASTER_KEY_ROTATION_ERROR_BY_SE", 3180, "Encryption key rotation error reported by SE: %s" }, +{ "ER_MASTER_KEY_ROTATION_BINLOG_FAILED", 3181, "Write to binlog failed. However, master key rotation has been completed successfully." }, +{ "ER_MASTER_KEY_ROTATION_SE_UNAVAILABLE", 3182, "Storage engine is not available." }, +{ "ER_TABLESPACE_CANNOT_ENCRYPT", 3183, "This tablespace can\'t be encrypted." }, +{ "ER_INVALID_ENCRYPTION_OPTION", 3184, "Invalid encryption option." }, +{ "ER_CANNOT_FIND_KEY_IN_KEYRING", 3185, "Can\'t find master key from keyring, please check keyring plugin is loaded." }, +{ "ER_CAPACITY_EXCEEDED_IN_PARSER", 3186, "Parser bailed out for this query." }, +{ "ER_UNSUPPORTED_ALTER_ENCRYPTION_INPLACE", 3187, "Cannot alter encryption attribute by inplace algorithm." }, +{ "ER_KEYRING_UDF_KEYRING_SERVICE_ERROR", 3188, "Function \'%s\' failed because underlying keyring service returned an error. Please check if a keyring plugin is installed and that provided arguments are valid for the keyring you are using." }, +{ "ER_USER_COLUMN_OLD_LENGTH", 3189, "It seems that your db schema is old. The %s column is 77 characters long and should be 93 characters long. Please run mysql_upgrade." }, +{ "ER_CANT_RESET_MASTER", 3190, "RESET MASTER is not allowed because %-.384s." }, +{ "ER_GROUP_REPLICATION_MAX_GROUP_SIZE", 3191, "The START GROUP_REPLICATION command failed since the group already has 9 members." }, +{ "ER_CANNOT_ADD_FOREIGN_BASE_COL_STORED", 3192, "Cannot add foreign key on the base column of stored column. " }, +{ "ER_TABLE_REFERENCED", 3193, "Cannot complete the operation because table is referenced by another connection." }, diff --git a/3rdparty/mysql/include/mysqld_error.h b/3rdparty/mysql/include/mysqld_error.h new file mode 100644 index 0000000000..99d0a1ec27 --- /dev/null +++ b/3rdparty/mysql/include/mysqld_error.h @@ -0,0 +1,1089 @@ +/* Autogenerated file, please don't edit */ + +#ifndef MYSQLD_ERROR_INCLUDED +#define MYSQLD_ERROR_INCLUDED + +static const int errmsg_section_start[] = { 1000, 3000 }; +static const int errmsg_section_size[] = { 886, 194 }; + +#define ER_HASHCHK 1000 +#define ER_NISAMCHK 1001 +#define ER_NO 1002 +#define ER_YES 1003 +#define ER_CANT_CREATE_FILE 1004 +#define ER_CANT_CREATE_TABLE 1005 +#define ER_CANT_CREATE_DB 1006 +#define ER_DB_CREATE_EXISTS 1007 +#define ER_DB_DROP_EXISTS 1008 +#define ER_DB_DROP_DELETE 1009 +#define ER_DB_DROP_RMDIR 1010 +#define ER_CANT_DELETE_FILE 1011 +#define ER_CANT_FIND_SYSTEM_REC 1012 +#define ER_CANT_GET_STAT 1013 +#define ER_CANT_GET_WD 1014 +#define ER_CANT_LOCK 1015 +#define ER_CANT_OPEN_FILE 1016 +#define ER_FILE_NOT_FOUND 1017 +#define ER_CANT_READ_DIR 1018 +#define ER_CANT_SET_WD 1019 +#define ER_CHECKREAD 1020 +#define ER_DISK_FULL 1021 +#define ER_DUP_KEY 1022 +#define ER_ERROR_ON_CLOSE 1023 +#define ER_ERROR_ON_READ 1024 +#define ER_ERROR_ON_RENAME 1025 +#define ER_ERROR_ON_WRITE 1026 +#define ER_FILE_USED 1027 +#define ER_FILSORT_ABORT 1028 +#define ER_FORM_NOT_FOUND 1029 +#define ER_GET_ERRNO 1030 +#define ER_ILLEGAL_HA 1031 +#define ER_KEY_NOT_FOUND 1032 +#define ER_NOT_FORM_FILE 1033 +#define ER_NOT_KEYFILE 1034 +#define ER_OLD_KEYFILE 1035 +#define ER_OPEN_AS_READONLY 1036 +#define ER_OUTOFMEMORY 1037 +#define ER_OUT_OF_SORTMEMORY 1038 +#define ER_UNEXPECTED_EOF 1039 +#define ER_CON_COUNT_ERROR 1040 +#define ER_OUT_OF_RESOURCES 1041 +#define ER_BAD_HOST_ERROR 1042 +#define ER_HANDSHAKE_ERROR 1043 +#define ER_DBACCESS_DENIED_ERROR 1044 +#define ER_ACCESS_DENIED_ERROR 1045 +#define ER_NO_DB_ERROR 1046 +#define ER_UNKNOWN_COM_ERROR 1047 +#define ER_BAD_NULL_ERROR 1048 +#define ER_BAD_DB_ERROR 1049 +#define ER_TABLE_EXISTS_ERROR 1050 +#define ER_BAD_TABLE_ERROR 1051 +#define ER_NON_UNIQ_ERROR 1052 +#define ER_SERVER_SHUTDOWN 1053 +#define ER_BAD_FIELD_ERROR 1054 +#define ER_WRONG_FIELD_WITH_GROUP 1055 +#define ER_WRONG_GROUP_FIELD 1056 +#define ER_WRONG_SUM_SELECT 1057 +#define ER_WRONG_VALUE_COUNT 1058 +#define ER_TOO_LONG_IDENT 1059 +#define ER_DUP_FIELDNAME 1060 +#define ER_DUP_KEYNAME 1061 +#define ER_DUP_ENTRY 1062 +#define ER_WRONG_FIELD_SPEC 1063 +#define ER_PARSE_ERROR 1064 +#define ER_EMPTY_QUERY 1065 +#define ER_NONUNIQ_TABLE 1066 +#define ER_INVALID_DEFAULT 1067 +#define ER_MULTIPLE_PRI_KEY 1068 +#define ER_TOO_MANY_KEYS 1069 +#define ER_TOO_MANY_KEY_PARTS 1070 +#define ER_TOO_LONG_KEY 1071 +#define ER_KEY_COLUMN_DOES_NOT_EXITS 1072 +#define ER_BLOB_USED_AS_KEY 1073 +#define ER_TOO_BIG_FIELDLENGTH 1074 +#define ER_WRONG_AUTO_KEY 1075 +#define ER_READY 1076 +#define ER_NORMAL_SHUTDOWN 1077 +#define ER_GOT_SIGNAL 1078 +#define ER_SHUTDOWN_COMPLETE 1079 +#define ER_FORCING_CLOSE 1080 +#define ER_IPSOCK_ERROR 1081 +#define ER_NO_SUCH_INDEX 1082 +#define ER_WRONG_FIELD_TERMINATORS 1083 +#define ER_BLOBS_AND_NO_TERMINATED 1084 +#define ER_TEXTFILE_NOT_READABLE 1085 +#define ER_FILE_EXISTS_ERROR 1086 +#define ER_LOAD_INFO 1087 +#define ER_ALTER_INFO 1088 +#define ER_WRONG_SUB_KEY 1089 +#define ER_CANT_REMOVE_ALL_FIELDS 1090 +#define ER_CANT_DROP_FIELD_OR_KEY 1091 +#define ER_INSERT_INFO 1092 +#define ER_UPDATE_TABLE_USED 1093 +#define ER_NO_SUCH_THREAD 1094 +#define ER_KILL_DENIED_ERROR 1095 +#define ER_NO_TABLES_USED 1096 +#define ER_TOO_BIG_SET 1097 +#define ER_NO_UNIQUE_LOGFILE 1098 +#define ER_TABLE_NOT_LOCKED_FOR_WRITE 1099 +#define ER_TABLE_NOT_LOCKED 1100 +#define ER_BLOB_CANT_HAVE_DEFAULT 1101 +#define ER_WRONG_DB_NAME 1102 +#define ER_WRONG_TABLE_NAME 1103 +#define ER_TOO_BIG_SELECT 1104 +#define ER_UNKNOWN_ERROR 1105 +#define ER_UNKNOWN_PROCEDURE 1106 +#define ER_WRONG_PARAMCOUNT_TO_PROCEDURE 1107 +#define ER_WRONG_PARAMETERS_TO_PROCEDURE 1108 +#define ER_UNKNOWN_TABLE 1109 +#define ER_FIELD_SPECIFIED_TWICE 1110 +#define ER_INVALID_GROUP_FUNC_USE 1111 +#define ER_UNSUPPORTED_EXTENSION 1112 +#define ER_TABLE_MUST_HAVE_COLUMNS 1113 +#define ER_RECORD_FILE_FULL 1114 +#define ER_UNKNOWN_CHARACTER_SET 1115 +#define ER_TOO_MANY_TABLES 1116 +#define ER_TOO_MANY_FIELDS 1117 +#define ER_TOO_BIG_ROWSIZE 1118 +#define ER_STACK_OVERRUN 1119 +#define ER_WRONG_OUTER_JOIN 1120 +#define ER_NULL_COLUMN_IN_INDEX 1121 +#define ER_CANT_FIND_UDF 1122 +#define ER_CANT_INITIALIZE_UDF 1123 +#define ER_UDF_NO_PATHS 1124 +#define ER_UDF_EXISTS 1125 +#define ER_CANT_OPEN_LIBRARY 1126 +#define ER_CANT_FIND_DL_ENTRY 1127 +#define ER_FUNCTION_NOT_DEFINED 1128 +#define ER_HOST_IS_BLOCKED 1129 +#define ER_HOST_NOT_PRIVILEGED 1130 +#define ER_PASSWORD_ANONYMOUS_USER 1131 +#define ER_PASSWORD_NOT_ALLOWED 1132 +#define ER_PASSWORD_NO_MATCH 1133 +#define ER_UPDATE_INFO 1134 +#define ER_CANT_CREATE_THREAD 1135 +#define ER_WRONG_VALUE_COUNT_ON_ROW 1136 +#define ER_CANT_REOPEN_TABLE 1137 +#define ER_INVALID_USE_OF_NULL 1138 +#define ER_REGEXP_ERROR 1139 +#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS 1140 +#define ER_NONEXISTING_GRANT 1141 +#define ER_TABLEACCESS_DENIED_ERROR 1142 +#define ER_COLUMNACCESS_DENIED_ERROR 1143 +#define ER_ILLEGAL_GRANT_FOR_TABLE 1144 +#define ER_GRANT_WRONG_HOST_OR_USER 1145 +#define ER_NO_SUCH_TABLE 1146 +#define ER_NONEXISTING_TABLE_GRANT 1147 +#define ER_NOT_ALLOWED_COMMAND 1148 +#define ER_SYNTAX_ERROR 1149 +#define ER_UNUSED1 1150 +#define ER_UNUSED2 1151 +#define ER_ABORTING_CONNECTION 1152 +#define ER_NET_PACKET_TOO_LARGE 1153 +#define ER_NET_READ_ERROR_FROM_PIPE 1154 +#define ER_NET_FCNTL_ERROR 1155 +#define ER_NET_PACKETS_OUT_OF_ORDER 1156 +#define ER_NET_UNCOMPRESS_ERROR 1157 +#define ER_NET_READ_ERROR 1158 +#define ER_NET_READ_INTERRUPTED 1159 +#define ER_NET_ERROR_ON_WRITE 1160 +#define ER_NET_WRITE_INTERRUPTED 1161 +#define ER_TOO_LONG_STRING 1162 +#define ER_TABLE_CANT_HANDLE_BLOB 1163 +#define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164 +#define ER_UNUSED3 1165 +#define ER_WRONG_COLUMN_NAME 1166 +#define ER_WRONG_KEY_COLUMN 1167 +#define ER_WRONG_MRG_TABLE 1168 +#define ER_DUP_UNIQUE 1169 +#define ER_BLOB_KEY_WITHOUT_LENGTH 1170 +#define ER_PRIMARY_CANT_HAVE_NULL 1171 +#define ER_TOO_MANY_ROWS 1172 +#define ER_REQUIRES_PRIMARY_KEY 1173 +#define ER_NO_RAID_COMPILED 1174 +#define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175 +#define ER_KEY_DOES_NOT_EXITS 1176 +#define ER_CHECK_NO_SUCH_TABLE 1177 +#define ER_CHECK_NOT_IMPLEMENTED 1178 +#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179 +#define ER_ERROR_DURING_COMMIT 1180 +#define ER_ERROR_DURING_ROLLBACK 1181 +#define ER_ERROR_DURING_FLUSH_LOGS 1182 +#define ER_ERROR_DURING_CHECKPOINT 1183 +#define ER_NEW_ABORTING_CONNECTION 1184 +#define ER_DUMP_NOT_IMPLEMENTED 1185 +#define ER_FLUSH_MASTER_BINLOG_CLOSED 1186 +#define ER_INDEX_REBUILD 1187 +#define ER_MASTER 1188 +#define ER_MASTER_NET_READ 1189 +#define ER_MASTER_NET_WRITE 1190 +#define ER_FT_MATCHING_KEY_NOT_FOUND 1191 +#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192 +#define ER_UNKNOWN_SYSTEM_VARIABLE 1193 +#define ER_CRASHED_ON_USAGE 1194 +#define ER_CRASHED_ON_REPAIR 1195 +#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196 +#define ER_TRANS_CACHE_FULL 1197 +#define ER_SLAVE_MUST_STOP 1198 +#define ER_SLAVE_NOT_RUNNING 1199 +#define ER_BAD_SLAVE 1200 +#define ER_MASTER_INFO 1201 +#define ER_SLAVE_THREAD 1202 +#define ER_TOO_MANY_USER_CONNECTIONS 1203 +#define ER_SET_CONSTANTS_ONLY 1204 +#define ER_LOCK_WAIT_TIMEOUT 1205 +#define ER_LOCK_TABLE_FULL 1206 +#define ER_READ_ONLY_TRANSACTION 1207 +#define ER_DROP_DB_WITH_READ_LOCK 1208 +#define ER_CREATE_DB_WITH_READ_LOCK 1209 +#define ER_WRONG_ARGUMENTS 1210 +#define ER_NO_PERMISSION_TO_CREATE_USER 1211 +#define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212 +#define ER_LOCK_DEADLOCK 1213 +#define ER_TABLE_CANT_HANDLE_FT 1214 +#define ER_CANNOT_ADD_FOREIGN 1215 +#define ER_NO_REFERENCED_ROW 1216 +#define ER_ROW_IS_REFERENCED 1217 +#define ER_CONNECT_TO_MASTER 1218 +#define ER_QUERY_ON_MASTER 1219 +#define ER_ERROR_WHEN_EXECUTING_COMMAND 1220 +#define ER_WRONG_USAGE 1221 +#define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1222 +#define ER_CANT_UPDATE_WITH_READLOCK 1223 +#define ER_MIXING_NOT_ALLOWED 1224 +#define ER_DUP_ARGUMENT 1225 +#define ER_USER_LIMIT_REACHED 1226 +#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227 +#define ER_LOCAL_VARIABLE 1228 +#define ER_GLOBAL_VARIABLE 1229 +#define ER_NO_DEFAULT 1230 +#define ER_WRONG_VALUE_FOR_VAR 1231 +#define ER_WRONG_TYPE_FOR_VAR 1232 +#define ER_VAR_CANT_BE_READ 1233 +#define ER_CANT_USE_OPTION_HERE 1234 +#define ER_NOT_SUPPORTED_YET 1235 +#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236 +#define ER_SLAVE_IGNORED_TABLE 1237 +#define ER_INCORRECT_GLOBAL_LOCAL_VAR 1238 +#define ER_WRONG_FK_DEF 1239 +#define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1240 +#define ER_OPERAND_COLUMNS 1241 +#define ER_SUBQUERY_NO_1_ROW 1242 +#define ER_UNKNOWN_STMT_HANDLER 1243 +#define ER_CORRUPT_HELP_DB 1244 +#define ER_CYCLIC_REFERENCE 1245 +#define ER_AUTO_CONVERT 1246 +#define ER_ILLEGAL_REFERENCE 1247 +#define ER_DERIVED_MUST_HAVE_ALIAS 1248 +#define ER_SELECT_REDUCED 1249 +#define ER_TABLENAME_NOT_ALLOWED_HERE 1250 +#define ER_NOT_SUPPORTED_AUTH_MODE 1251 +#define ER_SPATIAL_CANT_HAVE_NULL 1252 +#define ER_COLLATION_CHARSET_MISMATCH 1253 +#define ER_SLAVE_WAS_RUNNING 1254 +#define ER_SLAVE_WAS_NOT_RUNNING 1255 +#define ER_TOO_BIG_FOR_UNCOMPRESS 1256 +#define ER_ZLIB_Z_MEM_ERROR 1257 +#define ER_ZLIB_Z_BUF_ERROR 1258 +#define ER_ZLIB_Z_DATA_ERROR 1259 +#define ER_CUT_VALUE_GROUP_CONCAT 1260 +#define ER_WARN_TOO_FEW_RECORDS 1261 +#define ER_WARN_TOO_MANY_RECORDS 1262 +#define ER_WARN_NULL_TO_NOTNULL 1263 +#define ER_WARN_DATA_OUT_OF_RANGE 1264 +#define WARN_DATA_TRUNCATED 1265 +#define ER_WARN_USING_OTHER_HANDLER 1266 +#define ER_CANT_AGGREGATE_2COLLATIONS 1267 +#define ER_DROP_USER 1268 +#define ER_REVOKE_GRANTS 1269 +#define ER_CANT_AGGREGATE_3COLLATIONS 1270 +#define ER_CANT_AGGREGATE_NCOLLATIONS 1271 +#define ER_VARIABLE_IS_NOT_STRUCT 1272 +#define ER_UNKNOWN_COLLATION 1273 +#define ER_SLAVE_IGNORED_SSL_PARAMS 1274 +#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1275 +#define ER_WARN_FIELD_RESOLVED 1276 +#define ER_BAD_SLAVE_UNTIL_COND 1277 +#define ER_MISSING_SKIP_SLAVE 1278 +#define ER_UNTIL_COND_IGNORED 1279 +#define ER_WRONG_NAME_FOR_INDEX 1280 +#define ER_WRONG_NAME_FOR_CATALOG 1281 +#define ER_WARN_QC_RESIZE 1282 +#define ER_BAD_FT_COLUMN 1283 +#define ER_UNKNOWN_KEY_CACHE 1284 +#define ER_WARN_HOSTNAME_WONT_WORK 1285 +#define ER_UNKNOWN_STORAGE_ENGINE 1286 +#define ER_WARN_DEPRECATED_SYNTAX 1287 +#define ER_NON_UPDATABLE_TABLE 1288 +#define ER_FEATURE_DISABLED 1289 +#define ER_OPTION_PREVENTS_STATEMENT 1290 +#define ER_DUPLICATED_VALUE_IN_TYPE 1291 +#define ER_TRUNCATED_WRONG_VALUE 1292 +#define ER_TOO_MUCH_AUTO_TIMESTAMP_COLS 1293 +#define ER_INVALID_ON_UPDATE 1294 +#define ER_UNSUPPORTED_PS 1295 +#define ER_GET_ERRMSG 1296 +#define ER_GET_TEMPORARY_ERRMSG 1297 +#define ER_UNKNOWN_TIME_ZONE 1298 +#define ER_WARN_INVALID_TIMESTAMP 1299 +#define ER_INVALID_CHARACTER_STRING 1300 +#define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301 +#define ER_CONFLICTING_DECLARATIONS 1302 +#define ER_SP_NO_RECURSIVE_CREATE 1303 +#define ER_SP_ALREADY_EXISTS 1304 +#define ER_SP_DOES_NOT_EXIST 1305 +#define ER_SP_DROP_FAILED 1306 +#define ER_SP_STORE_FAILED 1307 +#define ER_SP_LILABEL_MISMATCH 1308 +#define ER_SP_LABEL_REDEFINE 1309 +#define ER_SP_LABEL_MISMATCH 1310 +#define ER_SP_UNINIT_VAR 1311 +#define ER_SP_BADSELECT 1312 +#define ER_SP_BADRETURN 1313 +#define ER_SP_BADSTATEMENT 1314 +#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1315 +#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1316 +#define ER_QUERY_INTERRUPTED 1317 +#define ER_SP_WRONG_NO_OF_ARGS 1318 +#define ER_SP_COND_MISMATCH 1319 +#define ER_SP_NORETURN 1320 +#define ER_SP_NORETURNEND 1321 +#define ER_SP_BAD_CURSOR_QUERY 1322 +#define ER_SP_BAD_CURSOR_SELECT 1323 +#define ER_SP_CURSOR_MISMATCH 1324 +#define ER_SP_CURSOR_ALREADY_OPEN 1325 +#define ER_SP_CURSOR_NOT_OPEN 1326 +#define ER_SP_UNDECLARED_VAR 1327 +#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1328 +#define ER_SP_FETCH_NO_DATA 1329 +#define ER_SP_DUP_PARAM 1330 +#define ER_SP_DUP_VAR 1331 +#define ER_SP_DUP_COND 1332 +#define ER_SP_DUP_CURS 1333 +#define ER_SP_CANT_ALTER 1334 +#define ER_SP_SUBSELECT_NYI 1335 +#define ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG 1336 +#define ER_SP_VARCOND_AFTER_CURSHNDLR 1337 +#define ER_SP_CURSOR_AFTER_HANDLER 1338 +#define ER_SP_CASE_NOT_FOUND 1339 +#define ER_FPARSER_TOO_BIG_FILE 1340 +#define ER_FPARSER_BAD_HEADER 1341 +#define ER_FPARSER_EOF_IN_COMMENT 1342 +#define ER_FPARSER_ERROR_IN_PARAMETER 1343 +#define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1344 +#define ER_VIEW_NO_EXPLAIN 1345 +#define ER_FRM_UNKNOWN_TYPE 1346 +#define ER_WRONG_OBJECT 1347 +#define ER_NONUPDATEABLE_COLUMN 1348 +#define ER_VIEW_SELECT_DERIVED_UNUSED 1349 +#define ER_VIEW_SELECT_CLAUSE 1350 +#define ER_VIEW_SELECT_VARIABLE 1351 +#define ER_VIEW_SELECT_TMPTABLE 1352 +#define ER_VIEW_WRONG_LIST 1353 +#define ER_WARN_VIEW_MERGE 1354 +#define ER_WARN_VIEW_WITHOUT_KEY 1355 +#define ER_VIEW_INVALID 1356 +#define ER_SP_NO_DROP_SP 1357 +#define ER_SP_GOTO_IN_HNDLR 1358 +#define ER_TRG_ALREADY_EXISTS 1359 +#define ER_TRG_DOES_NOT_EXIST 1360 +#define ER_TRG_ON_VIEW_OR_TEMP_TABLE 1361 +#define ER_TRG_CANT_CHANGE_ROW 1362 +#define ER_TRG_NO_SUCH_ROW_IN_TRG 1363 +#define ER_NO_DEFAULT_FOR_FIELD 1364 +#define ER_DIVISION_BY_ZERO 1365 +#define ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 1366 +#define ER_ILLEGAL_VALUE_FOR_TYPE 1367 +#define ER_VIEW_NONUPD_CHECK 1368 +#define ER_VIEW_CHECK_FAILED 1369 +#define ER_PROCACCESS_DENIED_ERROR 1370 +#define ER_RELAY_LOG_FAIL 1371 +#define ER_PASSWD_LENGTH 1372 +#define ER_UNKNOWN_TARGET_BINLOG 1373 +#define ER_IO_ERR_LOG_INDEX_READ 1374 +#define ER_BINLOG_PURGE_PROHIBITED 1375 +#define ER_FSEEK_FAIL 1376 +#define ER_BINLOG_PURGE_FATAL_ERR 1377 +#define ER_LOG_IN_USE 1378 +#define ER_LOG_PURGE_UNKNOWN_ERR 1379 +#define ER_RELAY_LOG_INIT 1380 +#define ER_NO_BINARY_LOGGING 1381 +#define ER_RESERVED_SYNTAX 1382 +#define ER_WSAS_FAILED 1383 +#define ER_DIFF_GROUPS_PROC 1384 +#define ER_NO_GROUP_FOR_PROC 1385 +#define ER_ORDER_WITH_PROC 1386 +#define ER_LOGGING_PROHIBIT_CHANGING_OF 1387 +#define ER_NO_FILE_MAPPING 1388 +#define ER_WRONG_MAGIC 1389 +#define ER_PS_MANY_PARAM 1390 +#define ER_KEY_PART_0 1391 +#define ER_VIEW_CHECKSUM 1392 +#define ER_VIEW_MULTIUPDATE 1393 +#define ER_VIEW_NO_INSERT_FIELD_LIST 1394 +#define ER_VIEW_DELETE_MERGE_VIEW 1395 +#define ER_CANNOT_USER 1396 +#define ER_XAER_NOTA 1397 +#define ER_XAER_INVAL 1398 +#define ER_XAER_RMFAIL 1399 +#define ER_XAER_OUTSIDE 1400 +#define ER_XAER_RMERR 1401 +#define ER_XA_RBROLLBACK 1402 +#define ER_NONEXISTING_PROC_GRANT 1403 +#define ER_PROC_AUTO_GRANT_FAIL 1404 +#define ER_PROC_AUTO_REVOKE_FAIL 1405 +#define ER_DATA_TOO_LONG 1406 +#define ER_SP_BAD_SQLSTATE 1407 +#define ER_STARTUP 1408 +#define ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR 1409 +#define ER_CANT_CREATE_USER_WITH_GRANT 1410 +#define ER_WRONG_VALUE_FOR_TYPE 1411 +#define ER_TABLE_DEF_CHANGED 1412 +#define ER_SP_DUP_HANDLER 1413 +#define ER_SP_NOT_VAR_ARG 1414 +#define ER_SP_NO_RETSET 1415 +#define ER_CANT_CREATE_GEOMETRY_OBJECT 1416 +#define ER_FAILED_ROUTINE_BREAK_BINLOG 1417 +#define ER_BINLOG_UNSAFE_ROUTINE 1418 +#define ER_BINLOG_CREATE_ROUTINE_NEED_SUPER 1419 +#define ER_EXEC_STMT_WITH_OPEN_CURSOR 1420 +#define ER_STMT_HAS_NO_OPEN_CURSOR 1421 +#define ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG 1422 +#define ER_NO_DEFAULT_FOR_VIEW_FIELD 1423 +#define ER_SP_NO_RECURSION 1424 +#define ER_TOO_BIG_SCALE 1425 +#define ER_TOO_BIG_PRECISION 1426 +#define ER_M_BIGGER_THAN_D 1427 +#define ER_WRONG_LOCK_OF_SYSTEM_TABLE 1428 +#define ER_CONNECT_TO_FOREIGN_DATA_SOURCE 1429 +#define ER_QUERY_ON_FOREIGN_DATA_SOURCE 1430 +#define ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST 1431 +#define ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE 1432 +#define ER_FOREIGN_DATA_STRING_INVALID 1433 +#define ER_CANT_CREATE_FEDERATED_TABLE 1434 +#define ER_TRG_IN_WRONG_SCHEMA 1435 +#define ER_STACK_OVERRUN_NEED_MORE 1436 +#define ER_TOO_LONG_BODY 1437 +#define ER_WARN_CANT_DROP_DEFAULT_KEYCACHE 1438 +#define ER_TOO_BIG_DISPLAYWIDTH 1439 +#define ER_XAER_DUPID 1440 +#define ER_DATETIME_FUNCTION_OVERFLOW 1441 +#define ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG 1442 +#define ER_VIEW_PREVENT_UPDATE 1443 +#define ER_PS_NO_RECURSION 1444 +#define ER_SP_CANT_SET_AUTOCOMMIT 1445 +#define ER_MALFORMED_DEFINER 1446 +#define ER_VIEW_FRM_NO_USER 1447 +#define ER_VIEW_OTHER_USER 1448 +#define ER_NO_SUCH_USER 1449 +#define ER_FORBID_SCHEMA_CHANGE 1450 +#define ER_ROW_IS_REFERENCED_2 1451 +#define ER_NO_REFERENCED_ROW_2 1452 +#define ER_SP_BAD_VAR_SHADOW 1453 +#define ER_TRG_NO_DEFINER 1454 +#define ER_OLD_FILE_FORMAT 1455 +#define ER_SP_RECURSION_LIMIT 1456 +#define ER_SP_PROC_TABLE_CORRUPT 1457 +#define ER_SP_WRONG_NAME 1458 +#define ER_TABLE_NEEDS_UPGRADE 1459 +#define ER_SP_NO_AGGREGATE 1460 +#define ER_MAX_PREPARED_STMT_COUNT_REACHED 1461 +#define ER_VIEW_RECURSIVE 1462 +#define ER_NON_GROUPING_FIELD_USED 1463 +#define ER_TABLE_CANT_HANDLE_SPKEYS 1464 +#define ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA 1465 +#define ER_REMOVED_SPACES 1466 +#define ER_AUTOINC_READ_FAILED 1467 +#define ER_USERNAME 1468 +#define ER_HOSTNAME 1469 +#define ER_WRONG_STRING_LENGTH 1470 +#define ER_NON_INSERTABLE_TABLE 1471 +#define ER_ADMIN_WRONG_MRG_TABLE 1472 +#define ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT 1473 +#define ER_NAME_BECOMES_EMPTY 1474 +#define ER_AMBIGUOUS_FIELD_TERM 1475 +#define ER_FOREIGN_SERVER_EXISTS 1476 +#define ER_FOREIGN_SERVER_DOESNT_EXIST 1477 +#define ER_ILLEGAL_HA_CREATE_OPTION 1478 +#define ER_PARTITION_REQUIRES_VALUES_ERROR 1479 +#define ER_PARTITION_WRONG_VALUES_ERROR 1480 +#define ER_PARTITION_MAXVALUE_ERROR 1481 +#define ER_PARTITION_SUBPARTITION_ERROR 1482 +#define ER_PARTITION_SUBPART_MIX_ERROR 1483 +#define ER_PARTITION_WRONG_NO_PART_ERROR 1484 +#define ER_PARTITION_WRONG_NO_SUBPART_ERROR 1485 +#define ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR 1486 +#define ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR 1487 +#define ER_FIELD_NOT_FOUND_PART_ERROR 1488 +#define ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR 1489 +#define ER_INCONSISTENT_PARTITION_INFO_ERROR 1490 +#define ER_PARTITION_FUNC_NOT_ALLOWED_ERROR 1491 +#define ER_PARTITIONS_MUST_BE_DEFINED_ERROR 1492 +#define ER_RANGE_NOT_INCREASING_ERROR 1493 +#define ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR 1494 +#define ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR 1495 +#define ER_PARTITION_ENTRY_ERROR 1496 +#define ER_MIX_HANDLER_ERROR 1497 +#define ER_PARTITION_NOT_DEFINED_ERROR 1498 +#define ER_TOO_MANY_PARTITIONS_ERROR 1499 +#define ER_SUBPARTITION_ERROR 1500 +#define ER_CANT_CREATE_HANDLER_FILE 1501 +#define ER_BLOB_FIELD_IN_PART_FUNC_ERROR 1502 +#define ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF 1503 +#define ER_NO_PARTS_ERROR 1504 +#define ER_PARTITION_MGMT_ON_NONPARTITIONED 1505 +#define ER_FOREIGN_KEY_ON_PARTITIONED 1506 +#define ER_DROP_PARTITION_NON_EXISTENT 1507 +#define ER_DROP_LAST_PARTITION 1508 +#define ER_COALESCE_ONLY_ON_HASH_PARTITION 1509 +#define ER_REORG_HASH_ONLY_ON_SAME_NO 1510 +#define ER_REORG_NO_PARAM_ERROR 1511 +#define ER_ONLY_ON_RANGE_LIST_PARTITION 1512 +#define ER_ADD_PARTITION_SUBPART_ERROR 1513 +#define ER_ADD_PARTITION_NO_NEW_PARTITION 1514 +#define ER_COALESCE_PARTITION_NO_PARTITION 1515 +#define ER_REORG_PARTITION_NOT_EXIST 1516 +#define ER_SAME_NAME_PARTITION 1517 +#define ER_NO_BINLOG_ERROR 1518 +#define ER_CONSECUTIVE_REORG_PARTITIONS 1519 +#define ER_REORG_OUTSIDE_RANGE 1520 +#define ER_PARTITION_FUNCTION_FAILURE 1521 +#define ER_PART_STATE_ERROR 1522 +#define ER_LIMITED_PART_RANGE 1523 +#define ER_PLUGIN_IS_NOT_LOADED 1524 +#define ER_WRONG_VALUE 1525 +#define ER_NO_PARTITION_FOR_GIVEN_VALUE 1526 +#define ER_FILEGROUP_OPTION_ONLY_ONCE 1527 +#define ER_CREATE_FILEGROUP_FAILED 1528 +#define ER_DROP_FILEGROUP_FAILED 1529 +#define ER_TABLESPACE_AUTO_EXTEND_ERROR 1530 +#define ER_WRONG_SIZE_NUMBER 1531 +#define ER_SIZE_OVERFLOW_ERROR 1532 +#define ER_ALTER_FILEGROUP_FAILED 1533 +#define ER_BINLOG_ROW_LOGGING_FAILED 1534 +#define ER_BINLOG_ROW_WRONG_TABLE_DEF 1535 +#define ER_BINLOG_ROW_RBR_TO_SBR 1536 +#define ER_EVENT_ALREADY_EXISTS 1537 +#define ER_EVENT_STORE_FAILED 1538 +#define ER_EVENT_DOES_NOT_EXIST 1539 +#define ER_EVENT_CANT_ALTER 1540 +#define ER_EVENT_DROP_FAILED 1541 +#define ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG 1542 +#define ER_EVENT_ENDS_BEFORE_STARTS 1543 +#define ER_EVENT_EXEC_TIME_IN_THE_PAST 1544 +#define ER_EVENT_OPEN_TABLE_FAILED 1545 +#define ER_EVENT_NEITHER_M_EXPR_NOR_M_AT 1546 +#define ER_OBSOLETE_COL_COUNT_DOESNT_MATCH_CORRUPTED 1547 +#define ER_OBSOLETE_CANNOT_LOAD_FROM_TABLE 1548 +#define ER_EVENT_CANNOT_DELETE 1549 +#define ER_EVENT_COMPILE_ERROR 1550 +#define ER_EVENT_SAME_NAME 1551 +#define ER_EVENT_DATA_TOO_LONG 1552 +#define ER_DROP_INDEX_FK 1553 +#define ER_WARN_DEPRECATED_SYNTAX_WITH_VER 1554 +#define ER_CANT_WRITE_LOCK_LOG_TABLE 1555 +#define ER_CANT_LOCK_LOG_TABLE 1556 +#define ER_FOREIGN_DUPLICATE_KEY_OLD_UNUSED 1557 +#define ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE 1558 +#define ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR 1559 +#define ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT 1560 +#define ER_NDB_CANT_SWITCH_BINLOG_FORMAT 1561 +#define ER_PARTITION_NO_TEMPORARY 1562 +#define ER_PARTITION_CONST_DOMAIN_ERROR 1563 +#define ER_PARTITION_FUNCTION_IS_NOT_ALLOWED 1564 +#define ER_DDL_LOG_ERROR 1565 +#define ER_NULL_IN_VALUES_LESS_THAN 1566 +#define ER_WRONG_PARTITION_NAME 1567 +#define ER_CANT_CHANGE_TX_CHARACTERISTICS 1568 +#define ER_DUP_ENTRY_AUTOINCREMENT_CASE 1569 +#define ER_EVENT_MODIFY_QUEUE_ERROR 1570 +#define ER_EVENT_SET_VAR_ERROR 1571 +#define ER_PARTITION_MERGE_ERROR 1572 +#define ER_CANT_ACTIVATE_LOG 1573 +#define ER_RBR_NOT_AVAILABLE 1574 +#define ER_BASE64_DECODE_ERROR 1575 +#define ER_EVENT_RECURSION_FORBIDDEN 1576 +#define ER_EVENTS_DB_ERROR 1577 +#define ER_ONLY_INTEGERS_ALLOWED 1578 +#define ER_UNSUPORTED_LOG_ENGINE 1579 +#define ER_BAD_LOG_STATEMENT 1580 +#define ER_CANT_RENAME_LOG_TABLE 1581 +#define ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT 1582 +#define ER_WRONG_PARAMETERS_TO_NATIVE_FCT 1583 +#define ER_WRONG_PARAMETERS_TO_STORED_FCT 1584 +#define ER_NATIVE_FCT_NAME_COLLISION 1585 +#define ER_DUP_ENTRY_WITH_KEY_NAME 1586 +#define ER_BINLOG_PURGE_EMFILE 1587 +#define ER_EVENT_CANNOT_CREATE_IN_THE_PAST 1588 +#define ER_EVENT_CANNOT_ALTER_IN_THE_PAST 1589 +#define ER_SLAVE_INCIDENT 1590 +#define ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT 1591 +#define ER_BINLOG_UNSAFE_STATEMENT 1592 +#define ER_SLAVE_FATAL_ERROR 1593 +#define ER_SLAVE_RELAY_LOG_READ_FAILURE 1594 +#define ER_SLAVE_RELAY_LOG_WRITE_FAILURE 1595 +#define ER_SLAVE_CREATE_EVENT_FAILURE 1596 +#define ER_SLAVE_MASTER_COM_FAILURE 1597 +#define ER_BINLOG_LOGGING_IMPOSSIBLE 1598 +#define ER_VIEW_NO_CREATION_CTX 1599 +#define ER_VIEW_INVALID_CREATION_CTX 1600 +#define ER_SR_INVALID_CREATION_CTX 1601 +#define ER_TRG_CORRUPTED_FILE 1602 +#define ER_TRG_NO_CREATION_CTX 1603 +#define ER_TRG_INVALID_CREATION_CTX 1604 +#define ER_EVENT_INVALID_CREATION_CTX 1605 +#define ER_TRG_CANT_OPEN_TABLE 1606 +#define ER_CANT_CREATE_SROUTINE 1607 +#define ER_NEVER_USED 1608 +#define ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT 1609 +#define ER_SLAVE_CORRUPT_EVENT 1610 +#define ER_LOAD_DATA_INVALID_COLUMN_UNUSED 1611 +#define ER_LOG_PURGE_NO_FILE 1612 +#define ER_XA_RBTIMEOUT 1613 +#define ER_XA_RBDEADLOCK 1614 +#define ER_NEED_REPREPARE 1615 +#define ER_DELAYED_NOT_SUPPORTED 1616 +#define WARN_NO_MASTER_INFO 1617 +#define WARN_OPTION_IGNORED 1618 +#define ER_PLUGIN_DELETE_BUILTIN 1619 +#define WARN_PLUGIN_BUSY 1620 +#define ER_VARIABLE_IS_READONLY 1621 +#define ER_WARN_ENGINE_TRANSACTION_ROLLBACK 1622 +#define ER_SLAVE_HEARTBEAT_FAILURE 1623 +#define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE 1624 +#define ER_NDB_REPLICATION_SCHEMA_ERROR 1625 +#define ER_CONFLICT_FN_PARSE_ERROR 1626 +#define ER_EXCEPTIONS_WRITE_ERROR 1627 +#define ER_TOO_LONG_TABLE_COMMENT 1628 +#define ER_TOO_LONG_FIELD_COMMENT 1629 +#define ER_FUNC_INEXISTENT_NAME_COLLISION 1630 +#define ER_DATABASE_NAME 1631 +#define ER_TABLE_NAME 1632 +#define ER_PARTITION_NAME 1633 +#define ER_SUBPARTITION_NAME 1634 +#define ER_TEMPORARY_NAME 1635 +#define ER_RENAMED_NAME 1636 +#define ER_TOO_MANY_CONCURRENT_TRXS 1637 +#define WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED 1638 +#define ER_DEBUG_SYNC_TIMEOUT 1639 +#define ER_DEBUG_SYNC_HIT_LIMIT 1640 +#define ER_DUP_SIGNAL_SET 1641 +#define ER_SIGNAL_WARN 1642 +#define ER_SIGNAL_NOT_FOUND 1643 +#define ER_SIGNAL_EXCEPTION 1644 +#define ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER 1645 +#define ER_SIGNAL_BAD_CONDITION_TYPE 1646 +#define WARN_COND_ITEM_TRUNCATED 1647 +#define ER_COND_ITEM_TOO_LONG 1648 +#define ER_UNKNOWN_LOCALE 1649 +#define ER_SLAVE_IGNORE_SERVER_IDS 1650 +#define ER_QUERY_CACHE_DISABLED 1651 +#define ER_SAME_NAME_PARTITION_FIELD 1652 +#define ER_PARTITION_COLUMN_LIST_ERROR 1653 +#define ER_WRONG_TYPE_COLUMN_VALUE_ERROR 1654 +#define ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR 1655 +#define ER_MAXVALUE_IN_VALUES_IN 1656 +#define ER_TOO_MANY_VALUES_ERROR 1657 +#define ER_ROW_SINGLE_PARTITION_FIELD_ERROR 1658 +#define ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD 1659 +#define ER_PARTITION_FIELDS_TOO_LONG 1660 +#define ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE 1661 +#define ER_BINLOG_ROW_MODE_AND_STMT_ENGINE 1662 +#define ER_BINLOG_UNSAFE_AND_STMT_ENGINE 1663 +#define ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE 1664 +#define ER_BINLOG_STMT_MODE_AND_ROW_ENGINE 1665 +#define ER_BINLOG_ROW_INJECTION_AND_STMT_MODE 1666 +#define ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE 1667 +#define ER_BINLOG_UNSAFE_LIMIT 1668 +#define ER_UNUSED4 1669 +#define ER_BINLOG_UNSAFE_SYSTEM_TABLE 1670 +#define ER_BINLOG_UNSAFE_AUTOINC_COLUMNS 1671 +#define ER_BINLOG_UNSAFE_UDF 1672 +#define ER_BINLOG_UNSAFE_SYSTEM_VARIABLE 1673 +#define ER_BINLOG_UNSAFE_SYSTEM_FUNCTION 1674 +#define ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS 1675 +#define ER_MESSAGE_AND_STATEMENT 1676 +#define ER_SLAVE_CONVERSION_FAILED 1677 +#define ER_SLAVE_CANT_CREATE_CONVERSION 1678 +#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT 1679 +#define ER_PATH_LENGTH 1680 +#define ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT 1681 +#define ER_WRONG_NATIVE_TABLE_STRUCTURE 1682 +#define ER_WRONG_PERFSCHEMA_USAGE 1683 +#define ER_WARN_I_S_SKIPPED_TABLE 1684 +#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT 1685 +#define ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT 1686 +#define ER_SPATIAL_MUST_HAVE_GEOM_COL 1687 +#define ER_TOO_LONG_INDEX_COMMENT 1688 +#define ER_LOCK_ABORTED 1689 +#define ER_DATA_OUT_OF_RANGE 1690 +#define ER_WRONG_SPVAR_TYPE_IN_LIMIT 1691 +#define ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE 1692 +#define ER_BINLOG_UNSAFE_MIXED_STATEMENT 1693 +#define ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN 1694 +#define ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN 1695 +#define ER_FAILED_READ_FROM_PAR_FILE 1696 +#define ER_VALUES_IS_NOT_INT_TYPE_ERROR 1697 +#define ER_ACCESS_DENIED_NO_PASSWORD_ERROR 1698 +#define ER_SET_PASSWORD_AUTH_PLUGIN 1699 +#define ER_GRANT_PLUGIN_USER_EXISTS 1700 +#define ER_TRUNCATE_ILLEGAL_FK 1701 +#define ER_PLUGIN_IS_PERMANENT 1702 +#define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN 1703 +#define ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX 1704 +#define ER_STMT_CACHE_FULL 1705 +#define ER_MULTI_UPDATE_KEY_CONFLICT 1706 +#define ER_TABLE_NEEDS_REBUILD 1707 +#define WARN_OPTION_BELOW_LIMIT 1708 +#define ER_INDEX_COLUMN_TOO_LONG 1709 +#define ER_ERROR_IN_TRIGGER_BODY 1710 +#define ER_ERROR_IN_UNKNOWN_TRIGGER_BODY 1711 +#define ER_INDEX_CORRUPT 1712 +#define ER_UNDO_RECORD_TOO_BIG 1713 +#define ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT 1714 +#define ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE 1715 +#define ER_BINLOG_UNSAFE_REPLACE_SELECT 1716 +#define ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT 1717 +#define ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT 1718 +#define ER_BINLOG_UNSAFE_UPDATE_IGNORE 1719 +#define ER_PLUGIN_NO_UNINSTALL 1720 +#define ER_PLUGIN_NO_INSTALL 1721 +#define ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT 1722 +#define ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC 1723 +#define ER_BINLOG_UNSAFE_INSERT_TWO_KEYS 1724 +#define ER_TABLE_IN_FK_CHECK 1725 +#define ER_UNSUPPORTED_ENGINE 1726 +#define ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST 1727 +#define ER_CANNOT_LOAD_FROM_TABLE_V2 1728 +#define ER_MASTER_DELAY_VALUE_OUT_OF_RANGE 1729 +#define ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT 1730 +#define ER_PARTITION_EXCHANGE_DIFFERENT_OPTION 1731 +#define ER_PARTITION_EXCHANGE_PART_TABLE 1732 +#define ER_PARTITION_EXCHANGE_TEMP_TABLE 1733 +#define ER_PARTITION_INSTEAD_OF_SUBPARTITION 1734 +#define ER_UNKNOWN_PARTITION 1735 +#define ER_TABLES_DIFFERENT_METADATA 1736 +#define ER_ROW_DOES_NOT_MATCH_PARTITION 1737 +#define ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX 1738 +#define ER_WARN_INDEX_NOT_APPLICABLE 1739 +#define ER_PARTITION_EXCHANGE_FOREIGN_KEY 1740 +#define ER_NO_SUCH_KEY_VALUE 1741 +#define ER_RPL_INFO_DATA_TOO_LONG 1742 +#define ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE 1743 +#define ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE 1744 +#define ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX 1745 +#define ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT 1746 +#define ER_PARTITION_CLAUSE_ON_NONPARTITIONED 1747 +#define ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET 1748 +#define ER_NO_SUCH_PARTITION__UNUSED 1749 +#define ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE 1750 +#define ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE 1751 +#define ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE 1752 +#define ER_MTS_FEATURE_IS_NOT_SUPPORTED 1753 +#define ER_MTS_UPDATED_DBS_GREATER_MAX 1754 +#define ER_MTS_CANT_PARALLEL 1755 +#define ER_MTS_INCONSISTENT_DATA 1756 +#define ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING 1757 +#define ER_DA_INVALID_CONDITION_NUMBER 1758 +#define ER_INSECURE_PLAIN_TEXT 1759 +#define ER_INSECURE_CHANGE_MASTER 1760 +#define ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO 1761 +#define ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO 1762 +#define ER_SQLTHREAD_WITH_SECURE_SLAVE 1763 +#define ER_TABLE_HAS_NO_FT 1764 +#define ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER 1765 +#define ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION 1766 +#define ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST 1767 +#define ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION 1768 +#define ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION 1769 +#define ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL 1770 +#define ER_SKIPPING_LOGGED_TRANSACTION 1771 +#define ER_MALFORMED_GTID_SET_SPECIFICATION 1772 +#define ER_MALFORMED_GTID_SET_ENCODING 1773 +#define ER_MALFORMED_GTID_SPECIFICATION 1774 +#define ER_GNO_EXHAUSTED 1775 +#define ER_BAD_SLAVE_AUTO_POSITION 1776 +#define ER_AUTO_POSITION_REQUIRES_GTID_MODE_NOT_OFF 1777 +#define ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET 1778 +#define ER_GTID_MODE_ON_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON 1779 +#define ER_GTID_MODE_REQUIRES_BINLOG 1780 +#define ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF 1781 +#define ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON 1782 +#define ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF 1783 +#define ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF__UNUSED 1784 +#define ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE 1785 +#define ER_GTID_UNSAFE_CREATE_SELECT 1786 +#define ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION 1787 +#define ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME 1788 +#define ER_MASTER_HAS_PURGED_REQUIRED_GTIDS 1789 +#define ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID 1790 +#define ER_UNKNOWN_EXPLAIN_FORMAT 1791 +#define ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION 1792 +#define ER_TOO_LONG_TABLE_PARTITION_COMMENT 1793 +#define ER_SLAVE_CONFIGURATION 1794 +#define ER_INNODB_FT_LIMIT 1795 +#define ER_INNODB_NO_FT_TEMP_TABLE 1796 +#define ER_INNODB_FT_WRONG_DOCID_COLUMN 1797 +#define ER_INNODB_FT_WRONG_DOCID_INDEX 1798 +#define ER_INNODB_ONLINE_LOG_TOO_BIG 1799 +#define ER_UNKNOWN_ALTER_ALGORITHM 1800 +#define ER_UNKNOWN_ALTER_LOCK 1801 +#define ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS 1802 +#define ER_MTS_RECOVERY_FAILURE 1803 +#define ER_MTS_RESET_WORKERS 1804 +#define ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 1805 +#define ER_SLAVE_SILENT_RETRY_TRANSACTION 1806 +#define ER_DISCARD_FK_CHECKS_RUNNING 1807 +#define ER_TABLE_SCHEMA_MISMATCH 1808 +#define ER_TABLE_IN_SYSTEM_TABLESPACE 1809 +#define ER_IO_READ_ERROR 1810 +#define ER_IO_WRITE_ERROR 1811 +#define ER_TABLESPACE_MISSING 1812 +#define ER_TABLESPACE_EXISTS 1813 +#define ER_TABLESPACE_DISCARDED 1814 +#define ER_INTERNAL_ERROR 1815 +#define ER_INNODB_IMPORT_ERROR 1816 +#define ER_INNODB_INDEX_CORRUPT 1817 +#define ER_INVALID_YEAR_COLUMN_LENGTH 1818 +#define ER_NOT_VALID_PASSWORD 1819 +#define ER_MUST_CHANGE_PASSWORD 1820 +#define ER_FK_NO_INDEX_CHILD 1821 +#define ER_FK_NO_INDEX_PARENT 1822 +#define ER_FK_FAIL_ADD_SYSTEM 1823 +#define ER_FK_CANNOT_OPEN_PARENT 1824 +#define ER_FK_INCORRECT_OPTION 1825 +#define ER_FK_DUP_NAME 1826 +#define ER_PASSWORD_FORMAT 1827 +#define ER_FK_COLUMN_CANNOT_DROP 1828 +#define ER_FK_COLUMN_CANNOT_DROP_CHILD 1829 +#define ER_FK_COLUMN_NOT_NULL 1830 +#define ER_DUP_INDEX 1831 +#define ER_FK_COLUMN_CANNOT_CHANGE 1832 +#define ER_FK_COLUMN_CANNOT_CHANGE_CHILD 1833 +#define ER_UNUSED5 1834 +#define ER_MALFORMED_PACKET 1835 +#define ER_READ_ONLY_MODE 1836 +#define ER_GTID_NEXT_TYPE_UNDEFINED_GROUP 1837 +#define ER_VARIABLE_NOT_SETTABLE_IN_SP 1838 +#define ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF 1839 +#define ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY 1840 +#define ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY 1841 +#define ER_GTID_PURGED_WAS_CHANGED 1842 +#define ER_GTID_EXECUTED_WAS_CHANGED 1843 +#define ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES 1844 +#define ER_ALTER_OPERATION_NOT_SUPPORTED 1845 +#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON 1846 +#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY 1847 +#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION 1848 +#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME 1849 +#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE 1850 +#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK 1851 +#define ER_UNUSED6 1852 +#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK 1853 +#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC 1854 +#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS 1855 +#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS 1856 +#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS 1857 +#define ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE 1858 +#define ER_DUP_UNKNOWN_IN_INDEX 1859 +#define ER_IDENT_CAUSES_TOO_LONG_PATH 1860 +#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL 1861 +#define ER_MUST_CHANGE_PASSWORD_LOGIN 1862 +#define ER_ROW_IN_WRONG_PARTITION 1863 +#define ER_MTS_EVENT_BIGGER_PENDING_JOBS_SIZE_MAX 1864 +#define ER_INNODB_NO_FT_USES_PARSER 1865 +#define ER_BINLOG_LOGICAL_CORRUPTION 1866 +#define ER_WARN_PURGE_LOG_IN_USE 1867 +#define ER_WARN_PURGE_LOG_IS_ACTIVE 1868 +#define ER_AUTO_INCREMENT_CONFLICT 1869 +#define WARN_ON_BLOCKHOLE_IN_RBR 1870 +#define ER_SLAVE_MI_INIT_REPOSITORY 1871 +#define ER_SLAVE_RLI_INIT_REPOSITORY 1872 +#define ER_ACCESS_DENIED_CHANGE_USER_ERROR 1873 +#define ER_INNODB_READ_ONLY 1874 +#define ER_STOP_SLAVE_SQL_THREAD_TIMEOUT 1875 +#define ER_STOP_SLAVE_IO_THREAD_TIMEOUT 1876 +#define ER_TABLE_CORRUPT 1877 +#define ER_TEMP_FILE_WRITE_FAILURE 1878 +#define ER_INNODB_FT_AUX_NOT_HEX_ID 1879 +#define ER_OLD_TEMPORALS_UPGRADED 1880 +#define ER_INNODB_FORCED_RECOVERY 1881 +#define ER_AES_INVALID_IV 1882 +#define ER_PLUGIN_CANNOT_BE_UNINSTALLED 1883 +#define ER_GTID_UNSAFE_BINLOG_SPLITTABLE_STATEMENT_AND_GTID_GROUP 1884 +#define ER_SLAVE_HAS_MORE_GTIDS_THAN_MASTER 1885 +#define ER_FILE_CORRUPT 3000 +#define ER_ERROR_ON_MASTER 3001 +#define ER_INCONSISTENT_ERROR 3002 +#define ER_STORAGE_ENGINE_NOT_LOADED 3003 +#define ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER 3004 +#define ER_WARN_LEGACY_SYNTAX_CONVERTED 3005 +#define ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN 3006 +#define ER_CANNOT_DISCARD_TEMPORARY_TABLE 3007 +#define ER_FK_DEPTH_EXCEEDED 3008 +#define ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2 3009 +#define ER_WARN_TRIGGER_DOESNT_HAVE_CREATED 3010 +#define ER_REFERENCED_TRG_DOES_NOT_EXIST 3011 +#define ER_EXPLAIN_NOT_SUPPORTED 3012 +#define ER_INVALID_FIELD_SIZE 3013 +#define ER_MISSING_HA_CREATE_OPTION 3014 +#define ER_ENGINE_OUT_OF_MEMORY 3015 +#define ER_PASSWORD_EXPIRE_ANONYMOUS_USER 3016 +#define ER_SLAVE_SQL_THREAD_MUST_STOP 3017 +#define ER_NO_FT_MATERIALIZED_SUBQUERY 3018 +#define ER_INNODB_UNDO_LOG_FULL 3019 +#define ER_INVALID_ARGUMENT_FOR_LOGARITHM 3020 +#define ER_SLAVE_CHANNEL_IO_THREAD_MUST_STOP 3021 +#define ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO 3022 +#define ER_WARN_ONLY_MASTER_LOG_FILE_NO_POS 3023 +#define ER_QUERY_TIMEOUT 3024 +#define ER_NON_RO_SELECT_DISABLE_TIMER 3025 +#define ER_DUP_LIST_ENTRY 3026 +#define ER_SQL_MODE_NO_EFFECT 3027 +#define ER_AGGREGATE_ORDER_FOR_UNION 3028 +#define ER_AGGREGATE_ORDER_NON_AGG_QUERY 3029 +#define ER_SLAVE_WORKER_STOPPED_PREVIOUS_THD_ERROR 3030 +#define ER_DONT_SUPPORT_SLAVE_PRESERVE_COMMIT_ORDER 3031 +#define ER_SERVER_OFFLINE_MODE 3032 +#define ER_GIS_DIFFERENT_SRIDS 3033 +#define ER_GIS_UNSUPPORTED_ARGUMENT 3034 +#define ER_GIS_UNKNOWN_ERROR 3035 +#define ER_GIS_UNKNOWN_EXCEPTION 3036 +#define ER_GIS_INVALID_DATA 3037 +#define ER_BOOST_GEOMETRY_EMPTY_INPUT_EXCEPTION 3038 +#define ER_BOOST_GEOMETRY_CENTROID_EXCEPTION 3039 +#define ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION 3040 +#define ER_BOOST_GEOMETRY_TURN_INFO_EXCEPTION 3041 +#define ER_BOOST_GEOMETRY_SELF_INTERSECTION_POINT_EXCEPTION 3042 +#define ER_BOOST_GEOMETRY_UNKNOWN_EXCEPTION 3043 +#define ER_STD_BAD_ALLOC_ERROR 3044 +#define ER_STD_DOMAIN_ERROR 3045 +#define ER_STD_LENGTH_ERROR 3046 +#define ER_STD_INVALID_ARGUMENT 3047 +#define ER_STD_OUT_OF_RANGE_ERROR 3048 +#define ER_STD_OVERFLOW_ERROR 3049 +#define ER_STD_RANGE_ERROR 3050 +#define ER_STD_UNDERFLOW_ERROR 3051 +#define ER_STD_LOGIC_ERROR 3052 +#define ER_STD_RUNTIME_ERROR 3053 +#define ER_STD_UNKNOWN_EXCEPTION 3054 +#define ER_GIS_DATA_WRONG_ENDIANESS 3055 +#define ER_CHANGE_MASTER_PASSWORD_LENGTH 3056 +#define ER_USER_LOCK_WRONG_NAME 3057 +#define ER_USER_LOCK_DEADLOCK 3058 +#define ER_REPLACE_INACCESSIBLE_ROWS 3059 +#define ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS 3060 +#define ER_ILLEGAL_USER_VAR 3061 +#define ER_GTID_MODE_OFF 3062 +#define ER_UNSUPPORTED_BY_REPLICATION_THREAD 3063 +#define ER_INCORRECT_TYPE 3064 +#define ER_FIELD_IN_ORDER_NOT_SELECT 3065 +#define ER_AGGREGATE_IN_ORDER_NOT_SELECT 3066 +#define ER_INVALID_RPL_WILD_TABLE_FILTER_PATTERN 3067 +#define ER_NET_OK_PACKET_TOO_LARGE 3068 +#define ER_INVALID_JSON_DATA 3069 +#define ER_INVALID_GEOJSON_MISSING_MEMBER 3070 +#define ER_INVALID_GEOJSON_WRONG_TYPE 3071 +#define ER_INVALID_GEOJSON_UNSPECIFIED 3072 +#define ER_DIMENSION_UNSUPPORTED 3073 +#define ER_SLAVE_CHANNEL_DOES_NOT_EXIST 3074 +#define ER_SLAVE_MULTIPLE_CHANNELS_HOST_PORT 3075 +#define ER_SLAVE_CHANNEL_NAME_INVALID_OR_TOO_LONG 3076 +#define ER_SLAVE_NEW_CHANNEL_WRONG_REPOSITORY 3077 +#define ER_SLAVE_CHANNEL_DELETE 3078 +#define ER_SLAVE_MULTIPLE_CHANNELS_CMD 3079 +#define ER_SLAVE_MAX_CHANNELS_EXCEEDED 3080 +#define ER_SLAVE_CHANNEL_MUST_STOP 3081 +#define ER_SLAVE_CHANNEL_NOT_RUNNING 3082 +#define ER_SLAVE_CHANNEL_WAS_RUNNING 3083 +#define ER_SLAVE_CHANNEL_WAS_NOT_RUNNING 3084 +#define ER_SLAVE_CHANNEL_SQL_THREAD_MUST_STOP 3085 +#define ER_SLAVE_CHANNEL_SQL_SKIP_COUNTER 3086 +#define ER_WRONG_FIELD_WITH_GROUP_V2 3087 +#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS_V2 3088 +#define ER_WARN_DEPRECATED_SYSVAR_UPDATE 3089 +#define ER_WARN_DEPRECATED_SQLMODE 3090 +#define ER_CANNOT_LOG_PARTIAL_DROP_DATABASE_WITH_GTID 3091 +#define ER_GROUP_REPLICATION_CONFIGURATION 3092 +#define ER_GROUP_REPLICATION_RUNNING 3093 +#define ER_GROUP_REPLICATION_APPLIER_INIT_ERROR 3094 +#define ER_GROUP_REPLICATION_STOP_APPLIER_THREAD_TIMEOUT 3095 +#define ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR 3096 +#define ER_GROUP_REPLICATION_COMMUNICATION_LAYER_JOIN_ERROR 3097 +#define ER_BEFORE_DML_VALIDATION_ERROR 3098 +#define ER_PREVENTS_VARIABLE_WITHOUT_RBR 3099 +#define ER_RUN_HOOK_ERROR 3100 +#define ER_TRANSACTION_ROLLBACK_DURING_COMMIT 3101 +#define ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED 3102 +#define ER_UNSUPPORTED_ALTER_INPLACE_ON_VIRTUAL_COLUMN 3103 +#define ER_WRONG_FK_OPTION_FOR_GENERATED_COLUMN 3104 +#define ER_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN 3105 +#define ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN 3106 +#define ER_GENERATED_COLUMN_NON_PRIOR 3107 +#define ER_DEPENDENT_BY_GENERATED_COLUMN 3108 +#define ER_GENERATED_COLUMN_REF_AUTO_INC 3109 +#define ER_FEATURE_NOT_AVAILABLE 3110 +#define ER_CANT_SET_GTID_MODE 3111 +#define ER_CANT_USE_AUTO_POSITION_WITH_GTID_MODE_OFF 3112 +#define ER_CANT_REPLICATE_ANONYMOUS_WITH_AUTO_POSITION 3113 +#define ER_CANT_REPLICATE_ANONYMOUS_WITH_GTID_MODE_ON 3114 +#define ER_CANT_REPLICATE_GTID_WITH_GTID_MODE_OFF 3115 +#define ER_CANT_SET_ENFORCE_GTID_CONSISTENCY_ON_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS 3116 +#define ER_SET_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS 3117 +#define ER_ACCOUNT_HAS_BEEN_LOCKED 3118 +#define ER_WRONG_TABLESPACE_NAME 3119 +#define ER_TABLESPACE_IS_NOT_EMPTY 3120 +#define ER_WRONG_FILE_NAME 3121 +#define ER_BOOST_GEOMETRY_INCONSISTENT_TURNS_EXCEPTION 3122 +#define ER_WARN_OPTIMIZER_HINT_SYNTAX_ERROR 3123 +#define ER_WARN_BAD_MAX_EXECUTION_TIME 3124 +#define ER_WARN_UNSUPPORTED_MAX_EXECUTION_TIME 3125 +#define ER_WARN_CONFLICTING_HINT 3126 +#define ER_WARN_UNKNOWN_QB_NAME 3127 +#define ER_UNRESOLVED_HINT_NAME 3128 +#define ER_WARN_ON_MODIFYING_GTID_EXECUTED_TABLE 3129 +#define ER_PLUGGABLE_PROTOCOL_COMMAND_NOT_SUPPORTED 3130 +#define ER_LOCKING_SERVICE_WRONG_NAME 3131 +#define ER_LOCKING_SERVICE_DEADLOCK 3132 +#define ER_LOCKING_SERVICE_TIMEOUT 3133 +#define ER_GIS_MAX_POINTS_IN_GEOMETRY_OVERFLOWED 3134 +#define ER_SQL_MODE_MERGED 3135 +#define ER_VTOKEN_PLUGIN_TOKEN_MISMATCH 3136 +#define ER_VTOKEN_PLUGIN_TOKEN_NOT_FOUND 3137 +#define ER_CANT_SET_VARIABLE_WHEN_OWNING_GTID 3138 +#define ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED 3139 +#define ER_INVALID_JSON_TEXT 3140 +#define ER_INVALID_JSON_TEXT_IN_PARAM 3141 +#define ER_INVALID_JSON_BINARY_DATA 3142 +#define ER_INVALID_JSON_PATH 3143 +#define ER_INVALID_JSON_CHARSET 3144 +#define ER_INVALID_JSON_CHARSET_IN_FUNCTION 3145 +#define ER_INVALID_TYPE_FOR_JSON 3146 +#define ER_INVALID_CAST_TO_JSON 3147 +#define ER_INVALID_JSON_PATH_CHARSET 3148 +#define ER_INVALID_JSON_PATH_WILDCARD 3149 +#define ER_JSON_VALUE_TOO_BIG 3150 +#define ER_JSON_KEY_TOO_BIG 3151 +#define ER_JSON_USED_AS_KEY 3152 +#define ER_JSON_VACUOUS_PATH 3153 +#define ER_JSON_BAD_ONE_OR_ALL_ARG 3154 +#define ER_NUMERIC_JSON_VALUE_OUT_OF_RANGE 3155 +#define ER_INVALID_JSON_VALUE_FOR_CAST 3156 +#define ER_JSON_DOCUMENT_TOO_DEEP 3157 +#define ER_JSON_DOCUMENT_NULL_KEY 3158 +#define ER_SECURE_TRANSPORT_REQUIRED 3159 +#define ER_NO_SECURE_TRANSPORTS_CONFIGURED 3160 +#define ER_DISABLED_STORAGE_ENGINE 3161 +#define ER_USER_DOES_NOT_EXIST 3162 +#define ER_USER_ALREADY_EXISTS 3163 +#define ER_AUDIT_API_ABORT 3164 +#define ER_INVALID_JSON_PATH_ARRAY_CELL 3165 +#define ER_BUFPOOL_RESIZE_INPROGRESS 3166 +#define ER_FEATURE_DISABLED_SEE_DOC 3167 +#define ER_SERVER_ISNT_AVAILABLE 3168 +#define ER_SESSION_WAS_KILLED 3169 +#define ER_CAPACITY_EXCEEDED 3170 +#define ER_CAPACITY_EXCEEDED_IN_RANGE_OPTIMIZER 3171 +#define ER_TABLE_NEEDS_UPG_PART 3172 +#define ER_CANT_WAIT_FOR_EXECUTED_GTID_SET_WHILE_OWNING_A_GTID 3173 +#define ER_CANNOT_ADD_FOREIGN_BASE_COL_VIRTUAL 3174 +#define ER_CANNOT_CREATE_VIRTUAL_INDEX_CONSTRAINT 3175 +#define ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE 3176 +#define ER_LOCK_REFUSED_BY_ENGINE 3177 +#define ER_UNSUPPORTED_ALTER_ONLINE_ON_VIRTUAL_COLUMN 3178 +#define ER_MASTER_KEY_ROTATION_NOT_SUPPORTED_BY_SE 3179 +#define ER_MASTER_KEY_ROTATION_ERROR_BY_SE 3180 +#define ER_MASTER_KEY_ROTATION_BINLOG_FAILED 3181 +#define ER_MASTER_KEY_ROTATION_SE_UNAVAILABLE 3182 +#define ER_TABLESPACE_CANNOT_ENCRYPT 3183 +#define ER_INVALID_ENCRYPTION_OPTION 3184 +#define ER_CANNOT_FIND_KEY_IN_KEYRING 3185 +#define ER_CAPACITY_EXCEEDED_IN_PARSER 3186 +#define ER_UNSUPPORTED_ALTER_ENCRYPTION_INPLACE 3187 +#define ER_KEYRING_UDF_KEYRING_SERVICE_ERROR 3188 +#define ER_USER_COLUMN_OLD_LENGTH 3189 +#define ER_CANT_RESET_MASTER 3190 +#define ER_GROUP_REPLICATION_MAX_GROUP_SIZE 3191 +#define ER_CANNOT_ADD_FOREIGN_BASE_COL_STORED 3192 +#define ER_TABLE_REFERENCED 3193 +#endif diff --git a/3rdparty/mysql/include/raid.h b/3rdparty/mysql/include/raid.h deleted file mode 100644 index c840afcbaa..0000000000 --- a/3rdparty/mysql/include/raid.h +++ /dev/null @@ -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 */ diff --git a/3rdparty/mysql/include/sql_common.h b/3rdparty/mysql/include/sql_common.h new file mode 100644 index 0000000000..8d5768c2e0 --- /dev/null +++ b/3rdparty/mysql/include/sql_common.h @@ -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 +#include + +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 */ diff --git a/3rdparty/mysql/include/sql_state.h b/3rdparty/mysql/include/sql_state.h new file mode 100644 index 0000000000..9295cabae1 --- /dev/null +++ b/3rdparty/mysql/include/sql_state.h @@ -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", "" }, diff --git a/3rdparty/mysql/include/sslopt-case.h b/3rdparty/mysql/include/sslopt-case.h new file mode 100644 index 0000000000..745196a9c9 --- /dev/null +++ b/3rdparty/mysql/include/sslopt-case.h @@ -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 */ diff --git a/3rdparty/mysql/include/sslopt-longopts.h b/3rdparty/mysql/include/sslopt-longopts.h new file mode 100644 index 0000000000..416cea7376 --- /dev/null +++ b/3rdparty/mysql/include/sslopt-longopts.h @@ -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 */ diff --git a/3rdparty/mysql/include/sslopt-vars.h b/3rdparty/mysql/include/sslopt-vars.h new file mode 100644 index 0000000000..aef761668a --- /dev/null +++ b/3rdparty/mysql/include/sslopt-vars.h @@ -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 */ diff --git a/3rdparty/mysql/include/thr_cond.h b/3rdparty/mysql/include/thr_cond.h new file mode 100644 index 0000000000..95df29d11c --- /dev/null +++ b/3rdparty/mysql/include/thr_cond.h @@ -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 */ diff --git a/3rdparty/mysql/include/thr_mutex.h b/3rdparty/mysql/include/thr_mutex.h new file mode 100644 index 0000000000..1b8c9d879d --- /dev/null +++ b/3rdparty/mysql/include/thr_mutex.h @@ -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 +#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 */ diff --git a/3rdparty/mysql/include/thr_rwlock.h b/3rdparty/mysql/include/thr_rwlock.h new file mode 100644 index 0000000000..c177e29e3d --- /dev/null +++ b/3rdparty/mysql/include/thr_rwlock.h @@ -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 */ diff --git a/3rdparty/mysql/include/typelib.h b/3rdparty/mysql/include/typelib.h index 4d6a90ad51..919dd69d6d 100644 --- a/3rdparty/mysql/include/typelib.h +++ b/3rdparty/mysql/include/typelib.h @@ -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 */ diff --git a/3rdparty/mysql/lib/Win32/libmysql.dll b/3rdparty/mysql/lib/Win32/libmysql.dll new file mode 100644 index 0000000000..c278384c45 Binary files /dev/null and b/3rdparty/mysql/lib/Win32/libmysql.dll differ diff --git a/3rdparty/mysql/lib/Win32/libmysql.lib b/3rdparty/mysql/lib/Win32/libmysql.lib new file mode 100644 index 0000000000..d791415e14 Binary files /dev/null and b/3rdparty/mysql/lib/Win32/libmysql.lib differ diff --git a/3rdparty/mysql/lib/libmysql.lib b/3rdparty/mysql/lib/libmysql.lib deleted file mode 100644 index aa99dc3b8b..0000000000 Binary files a/3rdparty/mysql/lib/libmysql.lib and /dev/null differ diff --git a/3rdparty/mysql/lib/x64/libmysql.dll b/3rdparty/mysql/lib/x64/libmysql.dll new file mode 100644 index 0000000000..d2783859f6 Binary files /dev/null and b/3rdparty/mysql/lib/x64/libmysql.dll differ diff --git a/3rdparty/mysql/lib/x64/libmysql.lib b/3rdparty/mysql/lib/x64/libmysql.lib new file mode 100644 index 0000000000..e841718fe1 Binary files /dev/null and b/3rdparty/mysql/lib/x64/libmysql.lib differ diff --git a/3rdparty/mysql/mysql-5.0.20 b/3rdparty/mysql/mysql-6.1.9 similarity index 100% rename from 3rdparty/mysql/mysql-5.0.20 rename to 3rdparty/mysql/mysql-6.1.9 diff --git a/3rdparty/pcre/include/pcre.h b/3rdparty/pcre/include/pcre.h index 712bd3d714..0e47966767 100644 --- a/3rdparty/pcre/include/pcre.h +++ b/3rdparty/pcre/include/pcre.h @@ -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" */ diff --git a/3rdparty/pcre/lib/Win32/pcre8.dll b/3rdparty/pcre/lib/Win32/pcre8.dll new file mode 100644 index 0000000000..d1969540ee Binary files /dev/null and b/3rdparty/pcre/lib/Win32/pcre8.dll differ diff --git a/3rdparty/pcre/lib/Win32/pcre8.lib b/3rdparty/pcre/lib/Win32/pcre8.lib new file mode 100644 index 0000000000..bc38ff1a49 Binary files /dev/null and b/3rdparty/pcre/lib/Win32/pcre8.lib differ diff --git a/3rdparty/pcre/lib/libpcre.dll.a b/3rdparty/pcre/lib/libpcre.dll.a deleted file mode 100644 index af121d08dc..0000000000 Binary files a/3rdparty/pcre/lib/libpcre.dll.a and /dev/null differ diff --git a/3rdparty/pcre/lib/pcre.lib b/3rdparty/pcre/lib/pcre.lib deleted file mode 100644 index e9ed140bdd..0000000000 Binary files a/3rdparty/pcre/lib/pcre.lib and /dev/null differ diff --git a/3rdparty/pcre/lib/x64/pcre8.dll b/3rdparty/pcre/lib/x64/pcre8.dll new file mode 100644 index 0000000000..bd2182c6a9 Binary files /dev/null and b/3rdparty/pcre/lib/x64/pcre8.dll differ diff --git a/3rdparty/pcre/lib/x64/pcre8.lib b/3rdparty/pcre/lib/x64/pcre8.lib new file mode 100644 index 0000000000..dd84b87efa Binary files /dev/null and b/3rdparty/pcre/lib/x64/pcre8.lib differ diff --git a/3rdparty/pcre/pcre-8.30 b/3rdparty/pcre/pcre-8.33.0.1.utf8 similarity index 100% rename from 3rdparty/pcre/pcre-8.30 rename to 3rdparty/pcre/pcre-8.33.0.1.utf8 diff --git a/3rdparty/zlib/include/zconf.h b/3rdparty/zlib/include/zconf.h index 9987a77553..9ccbb0a6fb 100644 --- a/3rdparty/zlib/include/zconf.h +++ b/3rdparty/zlib/include/zconf.h @@ -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, diff --git a/3rdparty/zlib/lib/Win32/zlib.dll b/3rdparty/zlib/lib/Win32/zlib.dll new file mode 100644 index 0000000000..7d6b762b87 Binary files /dev/null and b/3rdparty/zlib/lib/Win32/zlib.dll differ diff --git a/3rdparty/zlib/lib/Win32/zlib.lib b/3rdparty/zlib/lib/Win32/zlib.lib new file mode 100644 index 0000000000..3273dc61f9 Binary files /dev/null and b/3rdparty/zlib/lib/Win32/zlib.lib differ diff --git a/3rdparty/zlib/lib/x64/zlib.dll b/3rdparty/zlib/lib/x64/zlib.dll new file mode 100644 index 0000000000..21b6ebb24a Binary files /dev/null and b/3rdparty/zlib/lib/x64/zlib.dll differ diff --git a/3rdparty/zlib/lib/x64/zlib.lib b/3rdparty/zlib/lib/x64/zlib.lib new file mode 100644 index 0000000000..8920907e5f Binary files /dev/null and b/3rdparty/zlib/lib/x64/zlib.lib differ diff --git a/3rdparty/zlib/lib/zdll.lib b/3rdparty/zlib/lib/zdll.lib deleted file mode 100644 index 669b186cc5..0000000000 Binary files a/3rdparty/zlib/lib/zdll.lib and /dev/null differ diff --git a/libmysql.dll b/libmysql.dll deleted file mode 100644 index f86e8ef5b3..0000000000 Binary files a/libmysql.dll and /dev/null differ diff --git a/pcre3.dll b/pcre3.dll deleted file mode 100644 index f4fa1ea2e9..0000000000 Binary files a/pcre3.dll and /dev/null differ diff --git a/rAthena.sln b/rAthena.sln index 9b3deb1629..0093297ed6 100644 --- a/rAthena.sln +++ b/rAthena.sln @@ -68,48 +68,56 @@ Global {F8FD7B1E-8E1C-4CC3-9CD1-2E28F77B6559}.Debug|Win32.ActiveCfg = Debug|Win32 {F8FD7B1E-8E1C-4CC3-9CD1-2E28F77B6559}.Debug|Win32.Build.0 = Debug|Win32 {F8FD7B1E-8E1C-4CC3-9CD1-2E28F77B6559}.Debug|x64.ActiveCfg = Debug|x64 + {F8FD7B1E-8E1C-4CC3-9CD1-2E28F77B6559}.Debug|x64.Build.0 = Debug|x64 {F8FD7B1E-8E1C-4CC3-9CD1-2E28F77B6559}.Release|Win32.ActiveCfg = Release|Win32 {F8FD7B1E-8E1C-4CC3-9CD1-2E28F77B6559}.Release|Win32.Build.0 = Release|Win32 {F8FD7B1E-8E1C-4CC3-9CD1-2E28F77B6559}.Release|x64.ActiveCfg = Release|x64 {F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}.Debug|Win32.ActiveCfg = Debug|Win32 {F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}.Debug|Win32.Build.0 = Debug|Win32 {F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}.Debug|x64.ActiveCfg = Debug|x64 + {F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}.Debug|x64.Build.0 = Debug|x64 {F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}.Release|Win32.ActiveCfg = Release|Win32 {F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}.Release|Win32.Build.0 = Release|Win32 {F6CC5F60-BD13-41B1-81D3-822A45EC0DBD}.Release|x64.ActiveCfg = Release|x64 {7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Debug|Win32.ActiveCfg = Debug|Win32 {7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Debug|Win32.Build.0 = Debug|Win32 {7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Debug|x64.ActiveCfg = Debug|x64 + {7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Debug|x64.Build.0 = Debug|x64 {7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Release|Win32.ActiveCfg = Release|Win32 {7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Release|Win32.Build.0 = Release|Win32 {7AE31676-6137-4FB3-AE9C-AD47D8A861CF}.Release|x64.ActiveCfg = Release|x64 {864805EA-FD39-453D-9248-C581951BA058}.Debug|Win32.ActiveCfg = Debug|Win32 {864805EA-FD39-453D-9248-C581951BA058}.Debug|Win32.Build.0 = Debug|Win32 {864805EA-FD39-453D-9248-C581951BA058}.Debug|x64.ActiveCfg = Debug|x64 + {864805EA-FD39-453D-9248-C581951BA058}.Debug|x64.Build.0 = Debug|x64 {864805EA-FD39-453D-9248-C581951BA058}.Release|Win32.ActiveCfg = Release|Win32 {864805EA-FD39-453D-9248-C581951BA058}.Release|Win32.Build.0 = Release|Win32 {864805EA-FD39-453D-9248-C581951BA058}.Release|x64.ActiveCfg = Release|x64 {FED3A941-0AF7-49FE-85CF-E1DFDC0EBB23}.Debug|Win32.ActiveCfg = Debug|Win32 {FED3A941-0AF7-49FE-85CF-E1DFDC0EBB23}.Debug|Win32.Build.0 = Debug|Win32 {FED3A941-0AF7-49FE-85CF-E1DFDC0EBB23}.Debug|x64.ActiveCfg = Debug|x64 + {FED3A941-0AF7-49FE-85CF-E1DFDC0EBB23}.Debug|x64.Build.0 = Debug|x64 {FED3A941-0AF7-49FE-85CF-E1DFDC0EBB23}.Release|Win32.ActiveCfg = Release|Win32 {FED3A941-0AF7-49FE-85CF-E1DFDC0EBB23}.Release|Win32.Build.0 = Release|Win32 {FED3A941-0AF7-49FE-85CF-E1DFDC0EBB23}.Release|x64.ActiveCfg = Release|x64 {B4114A9C-EEA4-433C-A830-56119A984F24}.Debug|Win32.ActiveCfg = Debug|Win32 {B4114A9C-EEA4-433C-A830-56119A984F24}.Debug|Win32.Build.0 = Debug|Win32 {B4114A9C-EEA4-433C-A830-56119A984F24}.Debug|x64.ActiveCfg = Debug|x64 + {B4114A9C-EEA4-433C-A830-56119A984F24}.Debug|x64.Build.0 = Debug|x64 {B4114A9C-EEA4-433C-A830-56119A984F24}.Release|Win32.ActiveCfg = Release|Win32 {B4114A9C-EEA4-433C-A830-56119A984F24}.Release|Win32.Build.0 = Release|Win32 {B4114A9C-EEA4-433C-A830-56119A984F24}.Release|x64.ActiveCfg = Release|x64 {352B45B3-FE88-4431-9D89-48CF811446DB}.Debug|Win32.ActiveCfg = Debug|Win32 {352B45B3-FE88-4431-9D89-48CF811446DB}.Debug|Win32.Build.0 = Debug|Win32 {352B45B3-FE88-4431-9D89-48CF811446DB}.Debug|x64.ActiveCfg = Debug|x64 + {352B45B3-FE88-4431-9D89-48CF811446DB}.Debug|x64.Build.0 = Debug|x64 {352B45B3-FE88-4431-9D89-48CF811446DB}.Release|Win32.ActiveCfg = Release|Win32 {352B45B3-FE88-4431-9D89-48CF811446DB}.Release|Win32.Build.0 = Release|Win32 {352B45B3-FE88-4431-9D89-48CF811446DB}.Release|x64.ActiveCfg = Release|x64 {FC4C071B-2C26-4B03-948A-335C94A88B5E}.Debug|Win32.ActiveCfg = Debug|Win32 {FC4C071B-2C26-4B03-948A-335C94A88B5E}.Debug|Win32.Build.0 = Debug|Win32 {FC4C071B-2C26-4B03-948A-335C94A88B5E}.Debug|x64.ActiveCfg = Debug|x64 + {FC4C071B-2C26-4B03-948A-335C94A88B5E}.Debug|x64.Build.0 = Debug|x64 {FC4C071B-2C26-4B03-948A-335C94A88B5E}.Release|Win32.ActiveCfg = Release|Win32 {FC4C071B-2C26-4B03-948A-335C94A88B5E}.Release|Win32.Build.0 = Release|Win32 {FC4C071B-2C26-4B03-948A-335C94A88B5E}.Release|x64.ActiveCfg = Release|x64 diff --git a/src/char/char-server.vcxproj b/src/char/char-server.vcxproj index ed018e5dcc..019ffa6552 100644 --- a/src/char/char-server.vcxproj +++ b/src/char/char-server.vcxproj @@ -98,7 +98,7 @@ Console true - ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\libmysql.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;%(AdditionalDependencies) @@ -113,7 +113,7 @@ Console true - ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\libmysql.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;%(AdditionalDependencies) @@ -132,7 +132,7 @@ true true true - ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\libmysql.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;%(AdditionalDependencies) @@ -151,7 +151,7 @@ true true true - ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\libmysql.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;%(AdditionalDependencies) @@ -196,11 +196,13 @@ + + diff --git a/src/login/login-server.vcxproj b/src/login/login-server.vcxproj index a43b96b890..8c6d8d71c0 100644 --- a/src/login/login-server.vcxproj +++ b/src/login/login-server.vcxproj @@ -98,7 +98,7 @@ Console true - ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\libmysql.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;%(AdditionalDependencies) @@ -113,7 +113,7 @@ Console true - ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\libmysql.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;%(AdditionalDependencies) @@ -132,7 +132,7 @@ true true true - ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\libmysql.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;%(AdditionalDependencies) @@ -151,7 +151,7 @@ true true true - ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\libmysql.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;%(AdditionalDependencies) @@ -176,11 +176,13 @@ + + diff --git a/src/map/map-server.vcxproj b/src/map/map-server.vcxproj index bad3d306f0..4b93be00d2 100644 --- a/src/map/map-server.vcxproj +++ b/src/map/map-server.vcxproj @@ -99,7 +99,7 @@ Console true - ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\zlib\lib\zdll.lib;$(SolutionDir)3rdparty\pcre\lib\pcre.lib;$(SolutionDir)3rdparty\mysql\lib\libmysql.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\zlib\lib\$(Platform)\zlib.lib;$(SolutionDir)3rdparty\pcre\lib\$(Platform)\pcre8.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;%(AdditionalDependencies) @@ -115,7 +115,7 @@ Console true - ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\zlib\lib\zdll.lib;$(SolutionDir)3rdparty\pcre\lib\pcre.lib;$(SolutionDir)3rdparty\mysql\lib\libmysql.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\zlib\lib\$(Platform)\zlib.lib;$(SolutionDir)3rdparty\pcre\lib\$(Platform)\pcre8.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;%(AdditionalDependencies) @@ -135,7 +135,7 @@ true true true - ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\zlib\lib\zdll.lib;$(SolutionDir)3rdparty\pcre\lib\pcre.lib;$(SolutionDir)3rdparty\mysql\lib\libmysql.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\zlib\lib\$(Platform)\zlib.lib;$(SolutionDir)3rdparty\pcre\lib\$(Platform)\pcre8.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;%(AdditionalDependencies) @@ -155,7 +155,7 @@ true true true - ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\zlib\lib\zdll.lib;$(SolutionDir)3rdparty\pcre\lib\pcre.lib;$(SolutionDir)3rdparty\mysql\lib\libmysql.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common.lib;$(SolutionDir).vs\build\libconfig.lib;$(SolutionDir).vs\build\mt19937ar.lib;$(SolutionDir)3rdparty\zlib\lib\$(Platform)\zlib.lib;$(SolutionDir)3rdparty\pcre\lib\$(Platform)\pcre8.lib;$(SolutionDir)3rdparty\mysql\lib\$(Platform)\libmysql.lib;%(AdditionalDependencies) @@ -246,11 +246,17 @@ + + + + + + diff --git a/src/tool/map-cache.vcxproj b/src/tool/map-cache.vcxproj index f5e3a9eaa9..691d2d249f 100644 --- a/src/tool/map-cache.vcxproj +++ b/src/tool/map-cache.vcxproj @@ -98,7 +98,7 @@ Console true - ws2_32.lib;$(SolutionDir).vs\build\common-minicore.lib;$(SolutionDir)3rdparty\zlib\lib\zdll.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common-minicore.lib;$(SolutionDir)3rdparty\zlib\lib\$(Platform)\zlib.lib;%(AdditionalDependencies) @@ -113,7 +113,7 @@ Console true - ws2_32.lib;$(SolutionDir).vs\build\common-minicore.lib;$(SolutionDir)3rdparty\zlib\lib\zdll.lib;$(SolutionDir)3rdparty\mysql\lib\libmysql.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common-minicore.lib;$(SolutionDir)3rdparty\zlib\lib\$(Platform)\zlib.lib;%(AdditionalDependencies) @@ -132,7 +132,7 @@ true true true - ws2_32.lib;$(SolutionDir).vs\build\common-minicore.lib;$(SolutionDir)3rdparty\zlib\lib\zdll.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common-minicore.lib;$(SolutionDir)3rdparty\zlib\lib\$(Platform)\zlib.lib;%(AdditionalDependencies) @@ -151,7 +151,7 @@ true true true - ws2_32.lib;$(SolutionDir).vs\build\common-minicore.lib;$(SolutionDir)3rdparty\zlib\lib\zdll.lib;%(AdditionalDependencies) + ws2_32.lib;$(SolutionDir).vs\build\common-minicore.lib;$(SolutionDir)3rdparty\zlib\lib\$(Platform)\zlib.lib;%(AdditionalDependencies) @@ -161,10 +161,12 @@ + + diff --git a/zlib1.dll b/zlib1.dll deleted file mode 100644 index 9ea38d5cf3..0000000000 Binary files a/zlib1.dll and /dev/null differ