summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am50
-rw-r--r--include/base64.h6
-rw-r--r--include/config-netware.h33
-rw-r--r--include/config-win.h112
-rw-r--r--include/decimal.h4
-rw-r--r--include/errmsg.h10
-rw-r--r--include/ft_global.h7
-rw-r--r--include/hash.h101
-rw-r--r--include/heap.h68
-rw-r--r--include/keycache.h32
-rw-r--r--include/m_ctype.h278
-rw-r--r--include/m_string.h120
-rw-r--r--include/my_alarm.h10
-rw-r--r--include/my_alloc.h4
-rw-r--r--include/my_base.h163
-rw-r--r--include/my_bit.h128
-rw-r--r--include/my_bitmap.h131
-rw-r--r--include/my_compare.h2
-rw-r--r--include/my_compiler.h145
-rw-r--r--include/my_dbug.h115
-rw-r--r--include/my_getopt.h44
-rw-r--r--include/my_global.h600
-rw-r--r--include/my_list.h4
-rw-r--r--include/my_net.h10
-rw-r--r--include/my_no_pthread.h21
-rw-r--r--include/my_nosys.h8
-rw-r--r--include/my_pthread.h260
-rw-r--r--include/my_stacktrace.h68
-rw-r--r--include/my_sys.h433
-rw-r--r--include/my_time.h38
-rw-r--r--include/my_tree.h12
-rw-r--r--include/my_trie.h141
-rw-r--r--include/my_uctype.h1479
-rw-r--r--include/my_user.h6
-rw-r--r--include/my_vle.h38
-rw-r--r--include/my_xml.h39
-rw-r--r--include/myisam.h109
-rw-r--r--include/myisammrg.h47
-rw-r--r--include/mysql.h103
-rw-r--r--include/mysql.h.pp674
-rw-r--r--include/mysql/plugin.h841
-rw-r--r--include/mysql/plugin.h.pp142
-rw-r--r--include/mysql_com.h137
-rw-r--r--include/mysql_embed.h8
-rw-r--r--include/mysql_h.ic969
-rw-r--r--include/mysys_err.h13
-rw-r--r--include/queues.h23
-rw-r--r--include/raid.h158
-rw-r--r--include/sql_common.h12
-rw-r--r--include/sslopt-longopts.h27
-rw-r--r--include/thr_alarm.h13
-rw-r--r--include/thr_lock.h30
-rw-r--r--include/typelib.h5
-rw-r--r--include/violite.h29
54 files changed, 5689 insertions, 2371 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index e233e02e206..0cb8557aeb5 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -12,42 +12,48 @@
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA
-BUILT_SOURCES = $(HEADERS_GEN) abi_check
-HEADERS_GEN = mysql_version.h my_config.h
+BUILT_SOURCES = $(HEADERS_GEN_MAKE) link_sources
+HEADERS_GEN_CONFIGURE = mysql_version.h
+HEADERS_GEN_MAKE = my_config.h
HEADERS_ABI = mysql.h mysql_com.h mysql_time.h \
- my_list.h my_alloc.h typelib.h
+ my_list.h my_alloc.h typelib.h mysql/plugin.h
pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
my_xml.h mysql_embed.h \
- my_pthread.h my_no_pthread.h raid.h \
+ my_pthread.h my_no_pthread.h \
decimal.h errmsg.h my_global.h my_net.h \
my_getopt.h sslopt-longopts.h my_dir.h \
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
- m_ctype.h my_attribute.h $(HEADERS_GEN)
-noinst_HEADERS = config-win.h config-netware.h \
- heap.h my_bitmap.h\
+ m_ctype.h my_attribute.h my_compiler.h \
+ $(HEADERS_GEN_CONFIGURE) \
+ $(HEADERS_GEN_MAKE)
+
+noinst_HEADERS = config-win.h config-netware.h my_bit.h \
+ heap.h my_bitmap.h my_uctype.h \
myisam.h myisampack.h myisammrg.h ft_global.h\
mysys_err.h my_base.h help_start.h help_end.h \
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
- my_aes.h my_tree.h hash.h thr_alarm.h \
+ my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
- mysql_version.h.in my_compare.h my_time.h \
- my_user.h my_libwrap.h
+ my_compare.h my_time.h my_vle.h my_user.h \
+ my_libwrap.h my_stacktrace.h
+
+EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp
# Remove built files and the symlinked directories
CLEANFILES = $(BUILT_SOURCES) readline openssl
-EXTRA_DIST = mysql_h.ic
# Some include files that may be moved and patched by configure
-DISTCLEANFILES = sched.h $(CLEANFILES)
+DISTCLEANFILES = sched.h $(CLEANFILES) $(HEADERS_GEN_CONFIGURE)
link_sources:
- -$(RM) -fr readline
+ -$(RM) -f readline openssl
@readline_h_ln_cmd@
@yassl_h_ln_cmd@
+ echo timestamp > link_sources
# We want both "my_config.h" and "config.h" that are identical, as
# MySQL sources assumes the name "my_config.h", and 3rd party sources
@@ -60,19 +66,5 @@ my_config.h: config.h
dist-hook:
$(RM) -f $(distdir)/mysql_version.h $(distdir)/my_config.h
-#
-# Rules for checking that ABI has not changed
-#
-
-# Create a icheck file and compare it to the reference
-abi_check: $(HEADERS_ABI) mysql_version.h mysql_h.ic
- @set -ex; \
- if [ @ICHECK@ != no ] ; then \
- @ICHECK@ --canonify --skip-from-re /usr/ -o $@.ic mysql.h; \
- @ICHECK@ --compare mysql_h.ic $@.ic; \
- $(RM) -f $@.ic; \
- fi; \
- touch abi_check;
-
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/include/base64.h b/include/base64.h
index 78ebc9caf47..4ac0aa72ad8 100644
--- a/include/base64.h
+++ b/include/base64.h
@@ -20,9 +20,6 @@
extern "C" {
#endif
-
-#include <mysys_priv.h>
-
/*
Calculate how much memory needed for dst of base64_encode()
*/
@@ -41,7 +38,8 @@ int base64_encode(const void *src, size_t src_len, char *dst);
/*
Decode a base64 string into data
*/
-int base64_decode(const char *src, size_t src_len, void *dst);
+int base64_decode(const char *src, size_t src_len,
+ void *dst, const char **end_ptr);
#ifdef __cplusplus
diff --git a/include/config-netware.h b/include/config-netware.h
index f5a6a67eda1..68a67e800ef 100644
--- a/include/config-netware.h
+++ b/include/config-netware.h
@@ -1,5 +1,5 @@
-/* Copyright (c) 2003-2006 MySQL AB, 2009 Sun Microsystems, Inc.
- Use is subject to license terms.
+/*
+ Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -12,13 +12,22 @@
You should have received a copy of the GNU 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 */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
/* Header for NetWare compatible with MySQL */
#ifndef _config_netware_h
#define _config_netware_h
+#define __event_h__
+#define _EVENT_H_
+/*
+ These two #define(s) are needed as both libc of NetWare and MySQL have
+ files named event.h which causes compilation errors.
+*/
+
+
/* required headers */
#include <unistd.h>
#include <stdio.h>
@@ -35,6 +44,12 @@
#include <pthread.h>
#include <termios.h>
+#undef _EVENT_H_
+/*
+ This #undef exists here because both libc of NetWare and MySQL have
+ files named event.h which causes compilation errors.
+*/
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -46,7 +61,7 @@ extern "C" {
#undef HAVE_SYS_MMAN_H
#undef HAVE_SYNCH_H
#undef HAVE_MMAP
-#undef HAVE_FESETROUND
+#undef HAVE_RINT
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
#define HAVE_PTHREAD_SIGMASK 1
@@ -65,6 +80,13 @@ extern "C" {
#undef HAVE_STPCPY
/* changes end */
+/* Changes made to make use of LibC-June-2005 for building purpose */
+#undef HAVE_GETPASS
+#undef HAVE_GETRLIMIT
+#undef HAVE_GETRUSAGE
+#undef HAVE_INITGROUPS
+/* Changes end - LibC-June-2005 */
+
/* no libc crypt() function */
#ifdef HAVE_OPENSSL
#define HAVE_CRYPT 1
@@ -92,7 +114,7 @@ extern "C" {
/* signal by closing the sockets */
#define SIGNAL_WITH_VIO_CLOSE 1
-/* On NetWare, stack grows towards lower address*/
+/* On NetWare, stack grows towards lower address */
#define STACK_DIRECTION -1
/* On NetWare, we need to set stack size for threads, otherwise default 16K is used */
@@ -102,6 +124,7 @@ extern "C" {
#define CANT_DELETE_OPEN_FILES 1
#define FN_LIBCHAR '\\'
+#define FN_DIRSEP "/\\" /* Valid directory separators */
#define FN_ROOTDIR "\\"
#define FN_DEVCHAR ':'
diff --git a/include/config-win.h b/include/config-win.h
index 509897f0f0d..63624840dd1 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/*
+ 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
@@ -11,22 +12,24 @@
You should have received a copy of the GNU 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 */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
/* Defines for Win32 to make it compatible for MySQL */
+#define BIG_TABLES
+
#if defined(_MSC_VER) && _MSC_VER >= 1400
/* Avoid endless warnings about sprintf() etc. being unsafe. */
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
#include <sys/locking.h>
-#include <windows.h>
+#include <winsock2.h>
#include <fcntl.h>
#include <io.h>
#include <malloc.h>
-#define BIG_TABLES 1
#define HAVE_SMEM 1
#if defined(_WIN64) || defined(WIN64)
@@ -88,7 +91,7 @@
#define O_SHORT_LIVED 0
#define SH_DENYNO _SH_DENYNO
#else
-#define O_BINARY _O_BINARY /* compability with MSDOS */
+#define O_BINARY _O_BINARY /* compability with older style names */
#define FILE_BINARY _O_BINARY /* my_fopen in binary mode */
#define O_TEMPORARY _O_TEMPORARY
#define O_SHORT_LIVED _O_SHORT_LIVED
@@ -115,12 +118,12 @@
/* Type information */
-#if defined(__EMX__) || !defined(HAVE_UINT)
+#if !defined(HAVE_UINT)
#undef HAVE_UINT
#define HAVE_UINT
typedef unsigned short ushort;
typedef unsigned int uint;
-#endif /* defined(__EMX__) || !defined(HAVE_UINT) */
+#endif /* !defined(HAVE_UINT) */
typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
typedef __int64 longlong;
@@ -159,11 +162,12 @@ typedef uint rf_SetTimer;
#define isnan(X) _isnan(X)
#define finite(X) _finite(X)
-#ifndef UNDEF_THREAD_HACK
+#ifndef MYSQL_CLIENT_NO_THREADS
#define THREAD
#endif
#define VOID_SIGHANDLER
#define SIZEOF_CHAR 1
+#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_OFF_T 8
@@ -190,11 +194,6 @@ typedef uint rf_SetTimer;
#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
@@ -202,6 +201,9 @@ typedef uint rf_SetTimer;
/* If LOAD DATA LOCAL INFILE should be enabled by default */
#define ENABLED_LOCAL_INFILE 1
+/* If query profiling should be enabled by default */
+#define ENABLED_PROFILING 1
+
/* Convert some simple functions to Posix */
#define my_sigset(A,B) signal((A),(B))
@@ -247,8 +249,11 @@ inline ulonglong double2ulonglong(double d)
#define tell(A) _telli64(A)
#endif
-
#define STACK_DIRECTION -1
+
+/* Difference between GetSystemTimeAsFileTime() and now() */
+#define OFFSET_TO_EPOCH ULL(116444736000000000)
+
#define HAVE_PERROR
#define HAVE_VFPRINT
#define HAVE_RENAME /* Have rename() as function */
@@ -281,7 +286,14 @@ inline ulonglong double2ulonglong(double d)
#define SPRINTF_RETURNS_INT
#define HAVE_SETFILEPOINTER
#define HAVE_VIO_READ_BUFF
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+/* strnlen() appeared in Studio 2005 */
#define HAVE_STRNLEN
+#endif
+#define HAVE_WINSOCK2
+
+#define strcasecmp stricmp
+#define strncasecmp strnicmp
#ifndef __NT__
#undef FILE_SHARE_DELETE
@@ -327,6 +339,7 @@ inline ulonglong double2ulonglong(double d)
/* File name handling */
#define FN_LIBCHAR '\\'
+#define FN_DIRSEP "/\\" /* Valid directory separators */
#define FN_ROOTDIR "\\"
#define FN_DEVCHAR ':'
#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
@@ -340,63 +353,68 @@ inline ulonglong double2ulonglong(double d)
#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"
-#define MYSQL_DEFAULT_CHARSET_NAME "latin1"
-#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
-
#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 */
+#define COMMUNITY_SERVER 1
+#define ENABLED_PROFILING 1
+
+/*
+ Our Windows binaries include all character sets which MySQL supports.
+ Any changes to the available character sets must also go into
+ config/ac-macros/character_sets.m4
+*/
+
+#define MYSQL_DEFAULT_CHARSET_NAME "latin1"
+#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
+
+#define USE_MB 1
+#define USE_MB_IDENT 1
+#define USE_STRCOLL 1
+
+#define HAVE_CHARSET_armscii8
+#define HAVE_CHARSET_ascii
#define HAVE_CHARSET_big5 1
#define HAVE_CHARSET_cp1250 1
-/* #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_cp1251
+#define HAVE_CHARSET_cp1256
+#define HAVE_CHARSET_cp1257
+#define HAVE_CHARSET_cp850
+#define HAVE_CHARSET_cp852
+#define HAVE_CHARSET_cp866
#define HAVE_CHARSET_cp932 1
-/* #undef HAVE_CHARSET_dec8 */
+#define HAVE_CHARSET_dec8
#define HAVE_CHARSET_eucjpms 1
#define HAVE_CHARSET_euckr 1
#define HAVE_CHARSET_gb2312 1
#define HAVE_CHARSET_gbk 1
-/* #undef HAVE_CHARSET_greek */
-/* #undef HAVE_CHARSET_hebrew */
-/* #undef HAVE_CHARSET_hp8 */
-/* #undef HAVE_CHARSET_keybcs2 */
-/* #undef HAVE_CHARSET_koi8r */
-/* #undef HAVE_CHARSET_koi8u */
+#define HAVE_CHARSET_geostd8
+#define HAVE_CHARSET_greek
+#define HAVE_CHARSET_hebrew
+#define HAVE_CHARSET_hp8
+#define HAVE_CHARSET_keybcs2
+#define HAVE_CHARSET_koi8r
+#define HAVE_CHARSET_koi8u
#define HAVE_CHARSET_latin1 1
#define HAVE_CHARSET_latin2 1
-/* #undef HAVE_CHARSET_latin5 */
-/* #undef HAVE_CHARSET_latin7 */
-/* #undef HAVE_CHARSET_macce */
-/* #undef HAVE_CHARSET_macroman */
+#define HAVE_CHARSET_latin5
+#define HAVE_CHARSET_latin7
+#define HAVE_CHARSET_macce
+#define HAVE_CHARSET_macroman
#define HAVE_CHARSET_sjis 1
-/* #undef HAVE_CHARSET_swe7 */
+#define HAVE_CHARSET_swe7
#define HAVE_CHARSET_tis620 1
#define HAVE_CHARSET_ucs2 1
#define HAVE_CHARSET_ujis 1
#define HAVE_CHARSET_utf8 1
+
#define HAVE_UCA_COLLATIONS 1
#define HAVE_BOOL 1
diff --git a/include/decimal.h b/include/decimal.h
index c5385b58658..530ed9e1757 100644
--- a/include/decimal.h
+++ b/include/decimal.h
@@ -39,8 +39,8 @@ int longlong2decimal(longlong from, decimal_t *to);
int decimal2double(decimal_t *from, double *to);
int double2decimal(double from, decimal_t *to);
int decimal_actual_fraction(decimal_t *from);
-int decimal2bin(decimal_t *from, char *to, int precision, int scale);
-int bin2decimal(char *from, decimal_t *to, int precision, int scale);
+int decimal2bin(decimal_t *from, uchar *to, int precision, int scale);
+int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale);
int decimal_size(int precision, int scale);
int decimal_bin_size(int precision, int scale);
diff --git a/include/errmsg.h b/include/errmsg.h
index 8b20b36eed7..a6d8c770de8 100644
--- a/include/errmsg.h
+++ b/include/errmsg.h
@@ -14,7 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Error messages for MySQL clients */
-/* (Error messages for the daemon are in share/language/errmsg.sys) */
+/* (Error messages for the daemon are in sql/share/errmsg.txt) */
#ifdef __cplusplus
extern "C" {
@@ -28,9 +28,7 @@ extern const char *client_errors[]; /* Error messages */
#define CR_MIN_ERROR 2000 /* For easier client code */
#define CR_MAX_ERROR 2999
-#if defined(OS2) && defined(MYSQL_SERVER)
-#define CER(X) client_errors[(X)-CR_MIN_ERROR]
-#elif !defined(ER)
+#if !defined(ER)
#define ER(X) client_errors[(X)-CR_MIN_ERROR]
#endif
#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
@@ -97,6 +95,8 @@ extern const char *client_errors[]; /* Error messages */
#define CR_NO_RESULT_SET 2053
#define CR_NOT_IMPLEMENTED 2054
#define CR_SERVER_LOST_EXTENDED 2055
-#define CR_ERROR_LAST /*Copy last error nr:*/ 2055
+#define CR_STMT_CLOSED 2056
+#define CR_NEW_STMT_METADATA 2057
+#define CR_ERROR_LAST /*Copy last error nr:*/ 2057
/* Add error numbers before CR_ERROR_LAST and change it accordingly. */
diff --git a/include/ft_global.h b/include/ft_global.h
index baf055922bc..752371d6bc6 100644
--- a/include/ft_global.h
+++ b/include/ft_global.h
@@ -32,7 +32,7 @@ typedef struct st_ft_info FT_INFO;
struct _ft_vft
{
int (*read_next)(FT_INFO *, char *);
- float (*find_relevance)(FT_INFO *, byte *, uint);
+ float (*find_relevance)(FT_INFO *, uchar *, uint);
void (*close_search)(FT_INFO *);
float (*get_relevance)(FT_INFO *);
void (*reinit_search)(FT_INFO *);
@@ -52,6 +52,7 @@ extern ulong ft_min_word_len;
extern ulong ft_max_word_len;
extern ulong ft_query_expansion_limit;
extern char ft_boolean_syntax[15];
+extern struct st_mysql_ftparser ft_default_parser;
int ft_init_stopwords(void);
void ft_free_stopwords(void);
@@ -61,8 +62,8 @@ void ft_free_stopwords(void);
#define FT_SORTED 2
#define FT_EXPAND 4 /* query expansion */
-FT_INFO *ft_init_search(uint,void *, uint, byte *, uint,CHARSET_INFO *, byte *);
-my_bool ft_boolean_check_syntax_string(const byte *);
+FT_INFO *ft_init_search(uint,void *, uint, uchar *, uint,CHARSET_INFO *, uchar *);
+my_bool ft_boolean_check_syntax_string(const uchar *);
#ifdef __cplusplus
}
diff --git a/include/hash.h b/include/hash.h
index 30af96181b0..7e0b9b7393e 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc.
+/*
+ Copyright (c) 2000-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
@@ -12,7 +13,8 @@
You should have received a copy of the GNU 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 */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
/* Dynamic hashing of record with different key-length */
@@ -23,20 +25,58 @@ extern "C" {
#endif
/*
+ There was a problem on MacOSX with a shared object ha_example.so.
+ It used hash_search(). During build of ha_example.so no libmysys
+ was specified. Since MacOSX had a hash_search() in the system
+ library, it built the shared object so that the dynamic linker
+ linked hash_search() to the system library, which caused a crash
+ when called. To come around this, we renamed hash_search() to
+ my_hash_search(), as we did long ago with hash_insert() and
+ hash_reset(). However, this time we made the move complete with
+ all names. To keep compatibility, we redefine the old names.
+ Since every C and C++ file, that uses HASH, needs to include
+ this file, the change is complete. Both names could be used
+ in the code, but the my_* versions are recommended now.
+*/
+#define hash_get_key my_hash_get_key
+#define hash_free_key my_hash_free_key
+#define hash_init my_hash_init
+#define hash_init2 my_hash_init2
+#define _hash_init _my_hash_init
+#define hash_free my_hash_free
+#define hash_reset my_hash_reset
+#define hash_element my_hash_element
+#define hash_search my_hash_search
+#define hash_first my_hash_first
+#define hash_next my_hash_next
+#define hash_insert my_hash_insert
+#define hash_delete my_hash_delete
+#define hash_update my_hash_update
+#define hash_replace my_hash_replace
+#define hash_check my_hash_check
+#define hash_clear my_hash_clear
+#define hash_inited my_hash_inited
+#define hash_init_opt my_hash_init_opt
+
+/*
Overhead to store an element in hash
Can be used to approximate memory consumption for a hash
*/
#define HASH_OVERHEAD (sizeof(char*)*2)
-typedef byte *(*hash_get_key)(const byte *,uint*,my_bool);
-typedef void (*hash_free_key)(void *);
+/* flags for hash_init */
+#define HASH_UNIQUE 1 /* hash_insert fails on duplicate key */
+
+typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool);
+typedef void (*my_hash_free_key)(void *);
typedef struct st_hash {
- uint key_offset,key_length; /* Length of key if const length */
- uint records, blength;
+ size_t key_offset,key_length; /* Length of key if const length */
+ size_t blength;
+ ulong records;
uint flags;
DYNAMIC_ARRAY array; /* Place for hash_keys */
- hash_get_key get_key;
+ my_hash_get_key get_key;
void (*free)(void *);
CHARSET_INFO *charset;
} HASH;
@@ -44,29 +84,34 @@ typedef struct st_hash {
/* A search iterator state */
typedef uint HASH_SEARCH_STATE;
-#define hash_init(A,B,C,D,E,F,G,H) _hash_init(A,B,C,D,E,F,G, H CALLER_INFO)
-my_bool _hash_init(HASH *hash, CHARSET_INFO *charset,
- uint default_array_elements, uint key_offset,
- uint key_length, hash_get_key get_key,
- void (*free_element)(void*), uint flags CALLER_INFO_PROTO);
-void hash_free(HASH *tree);
+#define my_hash_init(A,B,C,D,E,F,G,H) \
+ _my_hash_init(A,0,B,C,D,E,F,G,H CALLER_INFO)
+#define my_hash_init2(A,B,C,D,E,F,G,H,I) \
+ _my_hash_init(A,B,C,D,E,F,G,H,I CALLER_INFO)
+my_bool _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,
+ ulong default_array_elements, size_t key_offset,
+ size_t key_length, my_hash_get_key get_key,
+ void (*free_element)(void*),
+ uint flags CALLER_INFO_PROTO);
+void my_hash_free(HASH *tree);
void my_hash_reset(HASH *hash);
-byte *hash_element(HASH *hash,uint idx);
-gptr hash_search(const HASH *info, const byte *key, uint length);
-gptr hash_first(const HASH *info, const byte *key, uint length,
- HASH_SEARCH_STATE *state);
-gptr hash_next(const HASH *info, const byte *key, uint length,
- HASH_SEARCH_STATE *state);
-my_bool my_hash_insert(HASH *info,const byte *data);
-my_bool hash_delete(HASH *hash,byte *record);
-my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length);
-void hash_replace(HASH *hash, HASH_SEARCH_STATE *state, byte *new_row);
-my_bool hash_check(HASH *hash); /* Only in debug library */
+uchar *my_hash_element(HASH *hash, ulong idx);
+uchar *my_hash_search(const HASH *info, const uchar *key, size_t length);
+uchar *my_hash_first(const HASH *info, const uchar *key, size_t length,
+ HASH_SEARCH_STATE *state);
+uchar *my_hash_next(const HASH *info, const uchar *key, size_t length,
+ HASH_SEARCH_STATE *state);
+my_bool my_hash_insert(HASH *info, const uchar *data);
+my_bool my_hash_delete(HASH *hash, uchar *record);
+my_bool my_hash_update(HASH *hash, uchar *record, uchar *old_key,
+ size_t old_key_length);
+void my_hash_replace(HASH *hash, HASH_SEARCH_STATE *state, uchar *new_row);
+my_bool my_hash_check(HASH *hash); /* Only in debug library */
-#define hash_clear(H) bzero((char*) (H),sizeof(*(H)))
-#define hash_inited(H) ((H)->blength != 0)
-#define hash_init_opt(A,B,C,D,E,F,G,H) \
- (!hash_inited(A) && _hash_init(A,B,C,D,E,F,G, H CALLER_INFO))
+#define my_hash_clear(H) bzero((char*) (H), sizeof(*(H)))
+#define my_hash_inited(H) ((H)->blength != 0)
+#define my_hash_init_opt(A,B,C,D,E,F,G,H) \
+ (!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G, H CALLER_INFO))
#ifdef __cplusplus
}
diff --git a/include/heap.h b/include/heap.h
index 9d67c94e003..0abdd71461e 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011 Oracle and/or its affiliates. All rights reserved.
+/* 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
@@ -57,7 +57,7 @@ typedef struct st_heapinfo /* Struct from heap_info */
typedef struct st_heap_ptrs
{
- byte *blocks[HP_PTRS_IN_NOD]; /* pointers to HP_PTRS or records */
+ uchar *blocks[HP_PTRS_IN_NOD]; /* pointers to HP_PTRS or records */
} HP_PTRS;
struct st_level_info
@@ -70,7 +70,7 @@ struct st_level_info
of last_blocks array. For level 0 - 1, for level 1 - HP_PTRS_IN_NOD, for
level 2 - HP_PTRS_IN_NOD^2 and so forth.
*/
- uint records_under_level;
+ ulong records_under_level;
/*
Ptr to last allocated HP_PTRS (or records buffer for level 0) on this
@@ -110,7 +110,7 @@ struct st_heap_info; /* For referense */
typedef struct st_hp_keydef /* Key definition with open */
{
- uint flag; /* HA_NOSAME | HA_NULL_PART_KEY */
+ uint flag; /* HA_NOSAME | HA_NULL_PART_KEY */
uint keysegs; /* Number of key-segment */
uint length; /* Length of key (automatic) */
uint8 algorithm; /* HASH / BTREE */
@@ -123,10 +123,10 @@ typedef struct st_hp_keydef /* Key definition with open */
ha_rows hash_buckets;
TREE rb_tree;
int (*write_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo,
- const byte *record, byte *recpos);
+ const uchar *record, uchar *recpos);
int (*delete_key)(struct st_heap_info *info, struct st_hp_keydef *keyinfo,
- const byte *record, byte *recpos, int flag);
- uint (*get_key_length)(struct st_hp_keydef *keydef, const byte *key);
+ const uchar *record, uchar *recpos, int flag);
+ uint (*get_key_length)(struct st_hp_keydef *keydef, const uchar *key);
} HP_KEYDEF;
typedef struct st_heap_share
@@ -144,8 +144,8 @@ typedef struct st_heap_share
uint keys,max_key_length;
uint currently_disabled_keys; /* saved value from "keys" when disabled */
uint open_count;
- byte *del_link; /* Link to next block with del. rec */
- my_string name; /* Name of "memory-file" */
+ uchar *del_link; /* Link to next block with del. rec */
+ char * name; /* Name of "memory-file" */
#ifdef THREAD
THR_LOCK lock;
pthread_mutex_t intern_lock; /* Locking for use with _locking */
@@ -162,14 +162,14 @@ struct st_hp_hash_info;
typedef struct st_heap_info
{
HP_SHARE *s;
- byte *current_ptr;
+ uchar *current_ptr;
struct st_hp_hash_info *current_hash_ptr;
ulong current_record,next_block;
int lastinx,errkey;
int mode; /* Mode of file (READONLY..) */
uint opt_flag,update;
- byte *lastkey; /* Last used key with rkey */
- byte *recbuf; /* Record buffer for rb-tree keys */
+ uchar *lastkey; /* Last used key with rkey */
+ uchar *recbuf; /* Record buffer for rb-tree keys */
enum ha_rkey_function last_find_flag;
TREE_ELEMENT *parents[MAX_TREE_HEIGHT+1];
TREE_ELEMENT **last_pos;
@@ -189,51 +189,57 @@ typedef struct st_heap_create_info
ulonglong max_table_size;
ulonglong auto_increment;
my_bool with_auto_increment;
+ my_bool internal_table;
} HP_CREATE_INFO;
/* Prototypes for heap-functions */
extern HP_INFO *heap_open(const char *name, int mode);
+extern HP_INFO *heap_open_from_share(HP_SHARE *share, int mode);
+extern HP_INFO *heap_open_from_share_and_register(HP_SHARE *share, int mode);
extern int heap_close(HP_INFO *info);
-extern int heap_write(HP_INFO *info,const byte *buff);
-extern int heap_update(HP_INFO *info,const byte *old,const byte *newdata);
-extern int heap_rrnd(HP_INFO *info,byte *buf,byte *pos);
+extern int heap_write(HP_INFO *info,const uchar *buff);
+extern int heap_update(HP_INFO *info,const uchar *old,const uchar *newdata);
+extern int heap_rrnd(HP_INFO *info,uchar *buf,uchar *pos);
extern int heap_scan_init(HP_INFO *info);
-extern int heap_scan(register HP_INFO *info, byte *record);
-extern int heap_delete(HP_INFO *info,const byte *buff);
+extern int heap_scan(register HP_INFO *info, uchar *record);
+extern int heap_delete(HP_INFO *info,const uchar *buff);
extern int heap_info(HP_INFO *info,HEAPINFO *x,int flag);
extern int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
uint reclength, ulong max_records, ulong min_records,
- HP_CREATE_INFO *create_info);
+ HP_CREATE_INFO *create_info, HP_SHARE **share);
extern int heap_delete_table(const char *name);
+extern void heap_drop_table(HP_INFO *info);
extern int heap_extra(HP_INFO *info,enum ha_extra_function function);
+extern int heap_reset(HP_INFO *info);
extern int heap_rename(const char *old_name,const char *new_name);
extern int heap_panic(enum ha_panic_function flag);
-extern int heap_rsame(HP_INFO *info,byte *record,int inx);
-extern int heap_rnext(HP_INFO *info,byte *record);
-extern int heap_rprev(HP_INFO *info,byte *record);
-extern int heap_rfirst(HP_INFO *info,byte *record,int inx);
-extern int heap_rlast(HP_INFO *info,byte *record,int inx);
+extern int heap_rsame(HP_INFO *info,uchar *record,int inx);
+extern int heap_rnext(HP_INFO *info,uchar *record);
+extern int heap_rprev(HP_INFO *info,uchar *record);
+extern int heap_rfirst(HP_INFO *info,uchar *record,int inx);
+extern int heap_rlast(HP_INFO *info,uchar *record,int inx);
extern void heap_clear(HP_INFO *info);
extern void heap_clear_keys(HP_INFO *info);
extern int heap_disable_indexes(HP_INFO *info);
extern int heap_enable_indexes(HP_INFO *info);
extern int heap_indexes_are_disabled(HP_INFO *info);
-extern void heap_update_auto_increment(HP_INFO *info, const byte *record);
+extern void heap_update_auto_increment(HP_INFO *info, const uchar *record);
ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, key_range *min_key,
key_range *max_key);
-int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
- uint key_len, enum ha_rkey_function find_flag);
-extern gptr heap_find(HP_INFO *info,int inx,const byte *key);
+int hp_panic(enum ha_panic_function flag);
+int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key,
+ key_part_map keypart_map, enum ha_rkey_function find_flag);
+extern uchar * heap_find(HP_INFO *info,int inx,const uchar *key);
extern int heap_check_heap(HP_INFO *info, my_bool print_status);
-extern byte *heap_position(HP_INFO *info);
+extern uchar *heap_position(HP_INFO *info);
/* The following is for programs that uses the old HEAP interface where
- pointer to rows where a long instead of a (byte*).
+ pointer to rows where a long instead of a (uchar*).
*/
#if defined(WANT_OLD_HEAP_VERSION) || defined(OLD_HEAP_VERSION)
-extern int heap_rrnd_old(HP_INFO *info,byte *buf,ulong pos);
+extern int heap_rrnd_old(HP_INFO *info,uchar *buf,ulong pos);
extern ulong heap_position_old(HP_INFO *info);
#endif
#ifdef OLD_HEAP_VERSION
@@ -241,7 +247,7 @@ typedef ulong HEAP_PTR;
#define heap_position(A) heap_position_old(A)
#define heap_rrnd(A,B,C) heap_rrnd_old(A,B,C)
#else
-typedef byte *HEAP_PTR;
+typedef uchar *HEAP_PTR;
#endif
#ifdef __cplusplus
diff --git a/include/keycache.h b/include/keycache.h
index 94fd8c57f1f..1307e869717 100644
--- a/include/keycache.h
+++ b/include/keycache.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2003-2007 MySQL AB, 2009 Sun Microsystems, Inc.
+/*
+ Copyright (c) 2003-2007 MySQL AB, 2009 Sun Microsystems, Inc.
Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
@@ -12,7 +13,8 @@
You should have received a copy of the GNU 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 */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
/* Key cache variable structures */
@@ -48,7 +50,7 @@ typedef struct st_key_cache
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 */
+ 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 */
ulong min_warm_blocks; /* min number of warm blocks; */
ulong age_threshold; /* age threshold for hot blocks */
@@ -66,9 +68,9 @@ typedef struct st_key_cache
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 *free_block_list; /* list of free blocks */
BLOCK_LINK *block_root; /* memory for block links */
- byte HUGE_PTR *block_mem; /* memory for block buffers */
+ uchar HUGE_PTR *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 */
pthread_mutex_t cache_lock; /* to lock access to the cache structure */
@@ -108,23 +110,23 @@ typedef struct st_key_cache
extern KEY_CACHE dflt_key_cache_var, *dflt_key_cache;
extern int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
- size_t use_mem, uint division_limit,
- uint age_threshold);
+ size_t use_mem, uint division_limit,
+ uint age_threshold);
extern int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
- size_t use_mem, uint division_limit,
- uint age_threshold);
+ size_t use_mem, uint division_limit,
+ uint age_threshold);
extern void change_key_cache_param(KEY_CACHE *keycache, uint division_limit,
uint age_threshold);
-extern byte *key_cache_read(KEY_CACHE *keycache,
+extern uchar *key_cache_read(KEY_CACHE *keycache,
File file, my_off_t filepos, int level,
- byte *buff, uint length,
+ uchar *buff, uint length,
uint block_length,int return_buffer);
extern int key_cache_insert(KEY_CACHE *keycache,
File file, my_off_t filepos, int level,
- byte *buff, uint length);
+ uchar *buff, uint length);
extern int key_cache_write(KEY_CACHE *keycache,
File file, my_off_t filepos, int level,
- byte *buff, uint length,
+ uchar *buff, uint length,
uint block_length,int force_write);
extern int flush_key_blocks(KEY_CACHE *keycache,
int file, enum flush_type type);
@@ -133,8 +135,8 @@ 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(byte *key, uint length);
-extern my_bool multi_key_cache_set(const byte *key, uint length,
+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);
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 6e21d392f22..3b836dfbaf3 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000-2007 MySQL AB, 2008 Sun Microsystems, Inc.
- Use is subject to license terms.
+/*
+ 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
@@ -12,7 +12,8 @@
You should have received a copy of the GNU 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 */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
/*
A better inplementation of the UNIX ctype(3) library.
@@ -50,6 +51,13 @@ typedef struct unicase_info_st
extern MY_UNICASE_INFO *my_unicase_default[256];
extern MY_UNICASE_INFO *my_unicase_turkish[256];
+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 */
@@ -79,7 +87,8 @@ extern MY_UNICASE_INFO *my_unicase_turkish[256];
#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_PUREASCII 2048 /* if a charset is pure ascii */
+#define MY_CS_HIDDEN 2048 /* don't display in SHOW */
+#define MY_CS_PUREASCII 4096 /* if a charset is pure ascii */
#define MY_CHARSET_UNDEFINED 0
/* Character repertoire flags */
@@ -124,22 +133,22 @@ struct charset_info_st;
/* 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 *, void *(*alloc)(size_t));
/* Collation routines */
int (*strnncoll)(struct charset_info_st *,
- const uchar *, uint, const uchar *, uint, my_bool);
+ const uchar *, size_t, const uchar *, size_t, my_bool);
int (*strnncollsp)(struct charset_info_st *,
- const uchar *, uint, const uchar *, uint,
+ 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);
+ size_t (*strnxfrm)(struct charset_info_st *,
+ uchar *, size_t, const uchar *, size_t);
+ size_t (*strnxfrmlen)(struct charset_info_st *, size_t);
my_bool (*like_range)(struct charset_info_st *,
- const char *s, uint s_length,
+ 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);
+ size_t *min_len, size_t *max_len);
int (*wildcmp)(struct charset_info_st *,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
@@ -148,14 +157,14 @@ typedef struct my_collation_handler_st
int (*strcasecmp)(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,
+ 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,
+ void (*hash_sort)(struct charset_info_st *cs, const uchar *key, size_t len,
ulong *nr1, ulong *nr2);
- my_bool (*propagate)(struct charset_info_st *cs, const uchar *str, uint len);
+ my_bool (*propagate)(struct charset_info_st *cs, const uchar *str, size_t len);
} MY_COLLATION_HANDLER;
extern MY_COLLATION_HANDLER my_collation_mb_bin_handler;
@@ -163,64 +172,76 @@ 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)(struct charset_info_st *, my_wc_t *,
+ const uchar *, const uchar *);
+typedef int (*my_charset_conv_wc_mb)(struct charset_info_st *, my_wc_t,
+ uchar *, uchar *);
+typedef size_t (*my_charset_conv_case)(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 *, void *(*alloc)(size_t));
/* 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)(struct charset_info_st *, const char *, const char *);
+ uint (*mbcharlen)(struct charset_info_st *, uint c);
+ size_t (*numchars)(struct charset_info_st *, const char *b, const char *e);
+ size_t (*charpos)(struct charset_info_st *, const char *b, const char *e,
+ size_t pos);
+ size_t (*well_formed_len)(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);
-
- /* 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);
+ size_t nchars, int *error);
+ size_t (*lengthsp)(struct charset_info_st *, const char *ptr, size_t length);
+ size_t (*numcells)(struct charset_info_st *, const char *b, const char *e);
- /* Functions for case and sort convertion */
- uint (*caseup_str)(struct charset_info_st *, char *);
- uint (*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)(struct charset_info_st *cs, int *ctype,
+ const uchar *s, const uchar *e);
+ /* Functions for case and sort conversion */
+ size_t (*caseup_str)(struct charset_info_st *, char *);
+ size_t (*casedn_str)(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,
- ...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5);
- 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)(struct charset_info_st *, char *to, size_t n,
+ const char *fmt,
+ ...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5);
+ size_t (*long10_to_str)(struct charset_info_st *, char *to, size_t n,
+ int radix, long int val);
+ size_t (*longlong10_to_str)(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)(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,
+ /* String-to-number conversion routines */
+ long (*strntol)(struct charset_info_st *, const char *s, size_t l,
int base, char **e, int *err);
- ulong (*strntoul)(struct charset_info_st *, const char *s, uint l,
+ ulong (*strntoul)(struct charset_info_st *, const char *s, size_t l,
int base, char **e, int *err);
- longlong (*strntoll)(struct charset_info_st *, const char *s, uint l,
+ longlong (*strntoll)(struct charset_info_st *, const char *s, size_t l,
int base, char **e, int *err);
- ulonglong (*strntoull)(struct charset_info_st *, const char *s, uint l,
+ ulonglong (*strntoull)(struct charset_info_st *, const char *s, size_t l,
int base, char **e, int *err);
- double (*strntod)(struct charset_info_st *, char *s, uint l, char **e,
+ double (*strntod)(struct charset_info_st *, char *s, size_t l, char **e,
int *err);
longlong (*strtoll10)(struct charset_info_st *cs,
const char *nptr, char **endptr, int *error);
ulonglong (*strntoull10rnd)(struct charset_info_st *cs,
- const char *str, uint length, int unsigned_fl,
+ const char *str, size_t length,
+ int unsigned_fl,
char **endptr, int *error);
- ulong (*scan)(struct charset_info_st *, const char *b, const char *e,
- int sq);
+ size_t (*scan)(struct charset_info_st *, const char *b, const char *e,
+ int sq);
} MY_CHARSET_HANDLER;
extern MY_CHARSET_HANDLER my_charset_8bit_handler;
@@ -263,9 +284,10 @@ typedef struct charset_info_st
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 CHARSET_INFO my_charset_big5_chinese_ci;
extern CHARSET_INFO my_charset_big5_bin;
extern CHARSET_INFO my_charset_cp932_japanese_ci;
@@ -278,7 +300,7 @@ 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 MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1;
extern CHARSET_INFO my_charset_latin1_german2_ci;
extern CHARSET_INFO my_charset_latin1_bin;
extern CHARSET_INFO my_charset_latin2_czech_ci;
@@ -295,63 +317,67 @@ extern CHARSET_INFO my_charset_utf8_general_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 MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_filename;
/* 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 int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, uint,
- const uchar *, uint,
+extern size_t my_strnxfrm_simple(CHARSET_INFO *, uchar *, size_t,
+ const uchar *, size_t);
+size_t my_strnxfrmlen_simple(CHARSET_INFO *, size_t);
+extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, size_t,
+ const uchar *, size_t, my_bool);
+
+extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t,
+ const uchar *, size_t,
my_bool diff_if_only_endspace_difference);
extern void my_hash_sort_simple(CHARSET_INFO *cs,
- const uchar *key, uint len,
+ 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(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,
+ const char *b, size_t b_length,
+ const char *s, size_t s_length,
my_match_t *match, uint nmatch);
/* Functions for 8bit */
-extern uint my_caseup_str_8bit(CHARSET_INFO *, char *);
-extern uint 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(CHARSET_INFO *, char *);
+extern size_t my_casedn_str_8bit(CHARSET_INFO *, char *);
+extern size_t my_caseup_8bit(CHARSET_INFO *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
+extern size_t my_casedn_8bit(CHARSET_INFO *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *);
int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc, const uchar *s,const uchar *e);
int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc, uchar *s, uchar *e);
-ulong my_scan_8bit(CHARSET_INFO *cs, const char *b, const char *e, int sq);
+int my_mb_ctype_8bit(CHARSET_INFO *,int *, const uchar *,const uchar *);
+int my_mb_ctype_mb(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(CHARSET_INFO *cs, const char *b, const char *e, int sq);
+
+size_t my_snprintf_8bit(struct charset_info_st *, char *to, size_t n,
+ const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 4, 5);
-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,
+long my_strntol_8bit(CHARSET_INFO *, const char *s, size_t l, int base,
+ char **e, int *err);
+ulong my_strntoul_8bit(CHARSET_INFO *, const char *s, size_t l, int base,
char **e, int *err);
-longlong my_strntoll_8bit(CHARSET_INFO *, const char *s, uint l, int base,
+longlong my_strntoll_8bit(CHARSET_INFO *, const char *s, size_t l, int base,
char **e, int *err);
-ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, uint l, int base,
+ulonglong my_strntoull_8bit(CHARSET_INFO *, const char *s, size_t l, int base,
char **e, int *err);
-double my_strntod_8bit(CHARSET_INFO *, char *s, uint l,char **e,
+double my_strntod_8bit(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(CHARSET_INFO *, char *to, size_t l, int radix,
+ long int val);
+size_t my_longlong10_to_str_8bit(CHARSET_INFO *, char *to, size_t l, int radix,
+ longlong val);
longlong my_strtoll10_8bit(CHARSET_INFO *cs,
const char *nptr, char **endptr, int *error);
@@ -359,34 +385,34 @@ longlong my_strtoll10_ucs2(CHARSET_INFO *cs,
const char *nptr, char **endptr, int *error);
ulonglong my_strntoull10rnd_8bit(CHARSET_INFO *cs,
- const char *str, uint length, int unsigned_fl,
- char **endptr, int *error);
+ const char *str, size_t length, int
+ unsigned_fl, char **endptr, int *error);
ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs,
- const char *str, uint length, int unsigned_fl,
- char **endptr, int *error);
+ const char *str, size_t length,
+ int unsigned_fl, char **endptr, int *error);
-void my_fill_8bit(CHARSET_INFO *cs, char* to, uint l, int fill);
+void my_fill_8bit(CHARSET_INFO *cs, char* to, size_t l, int fill);
my_bool my_like_range_simple(CHARSET_INFO *cs,
- const char *ptr, uint ptr_length,
+ 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,
+ 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,
+ 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);
int my_wildcmp_8bit(CHARSET_INFO *,
@@ -399,35 +425,35 @@ int my_wildcmp_bin(CHARSET_INFO *,
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(CHARSET_INFO *, const char *b, const char *e);
+size_t my_numcells_8bit(CHARSET_INFO *, const char *b, const char *e);
+size_t my_charpos_8bit(CHARSET_INFO *, const char *b, const char *e, size_t pos);
+size_t my_well_formed_len_8bit(CHARSET_INFO *, const char *b, const char *e,
+ size_t pos, int *error);
+uint my_mbcharlen_8bit(CHARSET_INFO *, uint c);
/* Functions for multibyte charsets */
-extern uint my_caseup_str_mb(CHARSET_INFO *, char *);
-extern uint 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 size_t my_caseup_str_mb(CHARSET_INFO *, char *);
+extern size_t my_casedn_str_mb(CHARSET_INFO *, char *);
+extern size_t my_caseup_mb(CHARSET_INFO *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
+extern size_t my_casedn_mb(CHARSET_INFO *, char *src, size_t srclen,
+ char *dst, size_t dstlen);
extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *);
int my_wildcmp_mb(CHARSET_INFO *,
const char *str,const char *str_end,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many);
-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);
+size_t my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
+size_t my_numcells_mb(CHARSET_INFO *, const char *b, const char *e);
+size_t my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, size_t pos);
+size_t my_well_formed_len_mb(CHARSET_INFO *, const char *b, const char *e,
+ size_t pos, int *error);
uint my_instr_mb(struct charset_info_st *,
- const char *b, uint b_length,
- const char *s, uint s_length,
+ 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,
@@ -436,11 +462,15 @@ int my_wildcmp_unicode(CHARSET_INFO *cs,
int escape, int w_one, int w_many,
MY_UNICASE_INFO **weights);
-extern my_bool my_parse_charset_xml(const char *bug, uint len,
+extern my_bool my_parse_charset_xml(const char *bug, size_t len,
int (*add)(CHARSET_INFO *cs));
+extern char *my_strchr(CHARSET_INFO *cs, const char *str, const char *end,
+ pchar c);
+extern size_t my_strcspn(CHARSET_INFO *cs, const char *str, const char *end,
+ const char *accept);
-my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, uint len);
-my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len);
+my_bool my_propagate_simple(CHARSET_INFO *cs, const uchar *str, size_t len);
+my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, size_t len);
uint my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong len);
diff --git a/include/m_string.h b/include/m_string.h
index 94de334a050..e1cf7651519 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2001, 2003-2007 MySQL AB, 2009 Sun Microsystems, Inc.
- Use is subject to license terms.
+/*
+ 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
@@ -12,7 +12,8 @@
You should have received a copy of the GNU 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 */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
/* There may be prolems include all of theese. Try to test in
configure with ones are needed? */
@@ -34,25 +35,8 @@
/* need by my_vsnprintf */
#include <stdarg.h>
-/* Correct some things for UNIXWARE7 */
-#ifdef HAVE_UNIXWARE7_THREADS
-#undef HAVE_STRINGS_H
-#undef HAVE_MEMORY_H
-#define HAVE_MEMCPY
-#ifndef HAVE_MEMMOVE
-#define HAVE_MEMMOVE
-#endif
-#undef HAVE_BCMP
-#undef bcopy
-#undef bcmp
-#undef bzero
-#endif /* HAVE_UNIXWARE7_THREADS */
-#ifdef _AIX
-#undef HAVE_BCMP
-#endif
-
/* This is needed for the definitions of bzero... on solaris */
-#if defined(HAVE_STRINGS_H) && !defined(HAVE_mit_thread)
+#if defined(HAVE_STRINGS_H)
#include <strings.h>
#endif
@@ -74,17 +58,13 @@
/* Unixware 7 */
#if !defined(HAVE_BFILL)
# define bfill(A,B,C) memset((A),(C),(B))
-# define bmove_align(A,B,C) memcpy((A),(B),(C))
#endif
-#if !defined(HAVE_BCMP)
-# define bcopy(s, d, n) memcpy((d), (s), (n))
-# define bcmp(A,B,C) memcmp((A),(B),(C))
-# define bzero(A,B) memset((A),0,(B))
-# define bmove_align(A,B,C) memcpy((A),(B),(C))
+#if !defined(bzero) && (!defined(HAVE_BZERO) || !defined(HAVE_DECL_BZERO))
+# define bzero(A,B) memset((A),0,(B))
#endif
-#if defined(__cplusplus) && !defined(OS2)
+#if defined(__cplusplus)
extern "C" {
#endif
@@ -95,7 +75,9 @@ extern "C" {
extern void *(*my_str_malloc)(size_t);
extern void (*my_str_free)(void *);
-#if defined(HAVE_STPCPY) && !defined(HAVE_mit_thread)
+#if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER)
+#define strmov(A,B) __builtin_stpcpy((A),(B))
+#elif defined(HAVE_STPCPY)
#define strmov(A,B) stpcpy((A),(B))
#ifndef stpcpy
extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
@@ -120,12 +102,6 @@ extern const double log_10[309];
#define memcpy_fixed(A,B,C) memcpy((A),(B),(C))
#endif
-#ifdef MSDOS
-#undef bmove_align
-#define bmove512(A,B,C) bmove_align(A,B,C)
-extern void bmove_align(gptr dst,const gptr src,uint len);
-#endif
-
#if (!defined(USE_BMOVE512) || defined(HAVE_purify)) && !defined(bmove512)
#define bmove512(A,B,C) memcpy(A,B,C)
#endif
@@ -133,58 +109,45 @@ extern void bmove_align(gptr dst,const gptr src,uint len);
/* Prototypes for string functions */
#if !defined(bfill) && !defined(HAVE_BFILL)
-extern void bfill(gptr dst,uint len,pchar fill);
-#endif
-
-#if !defined(bzero) && !defined(HAVE_BZERO)
-extern void bzero(gptr dst,uint len);
-#endif
-
-#if !defined(bcmp) && !defined(HAVE_BCMP)
-extern int bcmp(const char *s1,const char *s2,uint len);
-#endif
-#ifdef HAVE_purify
-extern int my_bcmp(const char *s1,const char *s2,uint len);
-#undef bcmp
-#define bcmp(A,B,C) my_bcmp((A),(B),(C))
+extern void bfill(uchar *dst,size_t len,pchar fill);
#endif
#ifndef bmove512
-extern void bmove512(gptr dst,const gptr src,uint len);
+extern void bmove512(uchar *dst,const uchar *src,size_t len);
#endif
#if !defined(HAVE_BMOVE) && !defined(bmove)
-extern void bmove(char *dst, const char *src,uint len);
+extern void bmove(uuchar *dst, const uchar *src,size_t len);
#endif
-extern void bmove_upp(char *dst,const char *src,uint len);
-extern void bchange(char *dst,uint old_len,const char *src,
- uint new_len,uint tot_len);
-extern void strappend(char *s,uint len,pchar fill);
+extern void bmove_upp(uchar *dst,const uchar *src,size_t len);
+extern void bchange(uchar *dst,size_t old_len,const uchar *src,
+ size_t new_len,size_t tot_len);
+extern void strappend(char *s,size_t len,pchar fill);
extern char *strend(const char *s);
extern char *strcend(const char *, pchar);
extern char *strfield(char *src,int fields,int chars,int blanks,
int tabch);
-extern char *strfill(my_string s,uint len,pchar fill);
-extern uint strinstr(const char *str,const char *search);
-extern uint r_strinstr(reg1 my_string str,int from, reg4 my_string search);
+extern char *strfill(char * s,size_t len,pchar fill);
+extern size_t strinstr(const char *str,const char *search);
+extern size_t r_strinstr(const char *str, size_t from, const char *search);
extern char *strkey(char *dst,char *head,char *tail,char *flags);
-extern char *strmake(char *dst,const char *src,uint length);
+extern char *strmake(char *dst,const char *src,size_t length);
#ifndef strmov
extern char *strmov(char *dst,const char *src);
#else
extern char *strmov_overlapp(char *dst,const char *src);
#endif
-extern char *strnmov(char *dst,const char *src,uint n);
+extern char *strnmov(char *dst,const char *src,size_t n);
extern char *strsuff(const char *src,const char *suffix);
extern char *strcont(const char *src,const char *set);
extern char *strxcat _VARARGS((char *dst,const char *src, ...));
extern char *strxmov _VARARGS((char *dst,const char *src, ...));
extern char *strxcpy _VARARGS((char *dst,const char *src, ...));
-extern char *strxncat _VARARGS((char *dst,uint len, const char *src, ...));
-extern char *strxnmov _VARARGS((char *dst,uint len, const char *src, ...));
-extern char *strxncpy _VARARGS((char *dst,uint len, const char *src, ...));
+extern char *strxncat _VARARGS((char *dst,size_t len, const char *src, ...));
+extern char *strxnmov _VARARGS((char *dst,size_t len, const char *src, ...));
+extern char *strxncpy _VARARGS((char *dst,size_t len, const char *src, ...));
/* Prototypes of normal stringfunctions (with may ours) */
@@ -199,7 +162,7 @@ extern size_t strlen(const char *);
#endif
#endif
#ifndef HAVE_STRNLEN
-extern uint strnlen(const char *s, uint n);
+extern size_t strnlen(const char *s, size_t n);
#endif
#if !defined(__cplusplus)
@@ -253,7 +216,7 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error);
#ifdef HAVE_LONG_LONG
extern char *longlong2str(longlong val,char *dst,int radix);
extern char *longlong10_to_str(longlong val,char *dst,int radix);
-#if (!defined(HAVE_STRTOULL) || defined(HAVE_mit_thread)) || defined(NO_STRTOLL_PROTO)
+#if (!defined(HAVE_STRTOULL) || defined(NO_STRTOLL_PROTO))
extern longlong strtoll(const char *str, char **ptr, int base);
extern ulonglong strtoull(const char *str, char **ptr, int base);
#endif
@@ -262,12 +225,31 @@ extern ulonglong strtoull(const char *str, char **ptr, int base);
/* my_vsnprintf.c */
-extern int my_vsnprintf( char *str, size_t n,
- const char *format, va_list ap );
-extern int my_snprintf(char *to, size_t n, const char *fmt, ...)
+extern size_t my_vsnprintf(char *str, size_t n,
+ const char *format, va_list ap);
+extern size_t my_snprintf(char *to, size_t n, const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 3, 4);
-#if defined(__cplusplus) && !defined(OS2)
+#if defined(__cplusplus)
}
#endif
+
+/*
+ LEX_STRING -- a pair of a C-string and its length.
+*/
+
+#ifndef _my_plugin_h
+/* This definition must match the one given in mysql/plugin.h */
+struct st_mysql_lex_string
+{
+ char *str;
+ size_t length;
+};
+#endif
+typedef struct st_mysql_lex_string LEX_STRING;
+
+#define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1))
+#define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1))
+#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1))
+
#endif
diff --git a/include/my_alarm.h b/include/my_alarm.h
index 750135d64ed..b77683d8ffc 100644
--- a/include/my_alarm.h
+++ b/include/my_alarm.h
@@ -1,4 +1,5 @@
-/* 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
@@ -11,7 +12,8 @@
You 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
+*/
/*
File to include when we want to use alarm or a loop_counter to display
@@ -36,14 +38,14 @@ extern ulong my_time_to_wait_for_lock;
#define ALARM_END VOID(signal(SIGALRM,alarm_signal)); \
VOID(alarm(alarm_old));
#define ALARM_TEST my_have_got_alarm
-#ifdef DONT_REMEMBER_SIGNAL
+#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
#define ALARM_REINIT VOID(alarm(MY_HOW_OFTEN_TO_ALARM)); \
VOID(signal(SIGALRM,my_set_alarm_variable));\
my_have_got_alarm=0;
#else
#define ALARM_REINIT VOID(alarm((uint) MY_HOW_OFTEN_TO_ALARM)); \
my_have_got_alarm=0;
-#endif /* DONT_REMEMBER_SIGNAL */
+#endif /* SIGNAL_HANDLER_RESET_ON_DELIVERY */
#else
#define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1
#define ALARM_INIT
diff --git a/include/my_alloc.h b/include/my_alloc.h
index 657394a363b..93b7438a1df 100644
--- a/include/my_alloc.h
+++ b/include/my_alloc.h
@@ -37,8 +37,8 @@ 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
diff --git a/include/my_base.h b/include/my_base.h
index a63febb5eeb..80ba4bcd004 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000-2007 MySQL AB, 2009 Sun Microsystems, Inc.
+/*
+ Copyright (c) 2000-2008 MySQL AB, 2009 Sun Microsystems, Inc.
Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
@@ -12,16 +13,15 @@
You should have received a copy of the GNU 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 */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
/* This file includes constants used with all databases */
-/* Author: Michael Widenius */
#ifndef _my_base_h
#define _my_base_h
#ifndef stdin /* Included first in handler */
-#define USES_TYPES /* my_dir with sys/types is included */
#define CHSIZE_USED
#include <my_global.h>
#include <my_dir.h> /* This includes types */
@@ -33,9 +33,6 @@
#define EOVERFLOW 84
#endif
-#ifdef MSDOS
-#include <share.h> /* Neaded for sopen() */
-#endif
#if !defined(USE_MY_FUNC) && !defined(THREAD)
#include <my_nosys.h> /* For faster code, after test */
#endif /* USE_MY_FUNC */
@@ -51,8 +48,13 @@
#define HA_OPEN_DELAY_KEY_WRITE 8 /* Don't update index */
#define HA_OPEN_ABORT_IF_CRASHED 16
#define HA_OPEN_FOR_REPAIR 32 /* open even if crashed */
+#define HA_OPEN_FROM_SQL_LAYER 64
+#define HA_OPEN_MMAP 128 /* open memory mapped */
+#define HA_OPEN_COPY 256 /* Open copy (for repair) */
+/* Internal temp table, used for temporary results */
+#define HA_OPEN_INTERNAL_TABLE 512
- /* The following is parameter to ha_rkey() how to use key */
+/* The following is parameter to ha_rkey() how to use key */
/*
We define a complete-field prefix of a key value as a prefix where
@@ -99,12 +101,20 @@ enum ha_key_alg {
HA_KEY_ALG_FULLTEXT= 4 /* FULLTEXT (MyISAM tables) */
};
+ /* Storage media types */
+
+enum ha_storage_media {
+ HA_SM_DEFAULT= 0, /* Not specified (engine default) */
+ HA_SM_DISK= 1, /* DISK storage */
+ HA_SM_MEMORY= 2 /* MAIN MEMORY storage */
+};
+
/* The following is parameter to ha_extra() */
enum ha_extra_function {
HA_EXTRA_NORMAL=0, /* Optimize for space (def) */
HA_EXTRA_QUICK=1, /* Optimize for speed */
- HA_EXTRA_RESET=2, /* Reset database to after open */
+ HA_EXTRA_NOT_USED=2,
HA_EXTRA_CACHE=3, /* Cache record in HA_rrnd() */
HA_EXTRA_NO_CACHE=4, /* End caching of records (def) */
HA_EXTRA_NO_READCHECK=5, /* No readcheck on update */
@@ -130,16 +140,7 @@ enum ha_extra_function {
HA_EXTRA_RESET_STATE, /* Reset positions */
HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/
HA_EXTRA_NO_IGNORE_DUP_KEY,
- /*
- Instructs InnoDB to retrieve all columns (except in key read), not just
- those where field->query_id is the same as the current query id
- */
- HA_EXTRA_RETRIEVE_ALL_COLS,
- /*
- Instructs InnoDB to retrieve at least all the primary key columns
- */
- HA_EXTRA_RETRIEVE_PRIMARY_KEY,
- HA_EXTRA_PREPARE_FOR_DELETE,
+ HA_EXTRA_PREPARE_FOR_DROP,
HA_EXTRA_PREPARE_FOR_UPDATE, /* Remove read cache if problems */
HA_EXTRA_PRELOAD_BUFFER_SIZE, /* Set buffer size for preloading */
/*
@@ -153,6 +154,21 @@ enum ha_extra_function {
to overwrite entire row.
*/
HA_EXTRA_KEYREAD_PRESERVE_FIELDS,
+ HA_EXTRA_MMAP,
+ /*
+ Ignore if the a tuple is not found, continue processing the
+ transaction and ignore that 'row'. Needed for idempotency
+ handling on the slave
+
+ Currently only used by NDB storage engine. Partition handler ignores flag.
+ */
+ HA_EXTRA_IGNORE_NO_KEY,
+ HA_EXTRA_NO_IGNORE_NO_KEY,
+ /*
+ Mark the table as a log table. For some handlers (e.g. CSV) this results
+ in a special locking for the table.
+ */
+ HA_EXTRA_MARK_AS_LOG_TABLE,
/*
Informs handler that write_row() which tries to insert new row into the
table and encounters some already existing row with same primary/unique
@@ -174,9 +190,20 @@ enum ha_extra_function {
Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be
executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY.
*/
- HA_EXTRA_INSERT_WITH_UPDATE
+ HA_EXTRA_INSERT_WITH_UPDATE,
+ /* Inform handler that we will do a rename */
+ HA_EXTRA_PREPARE_FOR_RENAME,
+ /*
+ Orders MERGE handler to attach or detach its child tables. Used at
+ begin and end of a statement.
+ */
+ HA_EXTRA_ATTACH_CHILDREN,
+ HA_EXTRA_DETACH_CHILDREN
};
+/* Compatible option, to be deleted in 6.0 */
+#define HA_EXTRA_PREPARE_FOR_DELETE HA_EXTRA_PREPARE_FOR_DROP
+
/* The following is parameter to ha_panic() */
enum ha_panic_function {
@@ -225,18 +252,22 @@ enum ha_base_keytype {
#define HA_SPATIAL 1024 /* For spatial search */
#define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */
#define HA_GENERATED_KEY 8192 /* Automaticly generated key */
+
+ /* The combination of the above can be used for key type comparison. */
+#define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \
+ HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \
+ HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY)
+
#define HA_KEY_HAS_PART_KEY_SEG 65536 /* Key contains partial segments */
+
/* Automatic bits in key-flag */
#define HA_SPACE_PACK_USED 4 /* Test for if SPACE_PACK used */
#define HA_VAR_LENGTH_KEY 8
#define HA_NULL_PART_KEY 64
-#ifndef ISAM_LIBRARY
+#define HA_USES_PARSER 16384 /* Fulltext index uses [pre]parser */
+#define HA_USES_BLOCK_SIZE ((uint) 32768)
#define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */
-#else
-/* poor old NISAM has 8-bit flags :-( */
-#define HA_SORT_ALLOWS_SAME 128 /* Intern bit when sorting records */
-#endif
#if MYSQL_VERSION_ID < 0x50200
/*
Key has a part that can have end space. If this is an unique key
@@ -276,6 +307,9 @@ enum ha_base_keytype {
#define HA_OPTION_DELAY_KEY_WRITE 64
#define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */
#define HA_OPTION_CREATE_FROM_ENGINE 256
+#define HA_OPTION_RELIES_ON_SQL_LAYER 512
+#define HA_OPTION_NULL_FIELDS 1024
+#define HA_OPTION_PAGE_CHECKSUM 2048
#define HA_OPTION_TEMP_COMPRESS_RECORD ((uint) 16384) /* set by isamchk */
#define HA_OPTION_READ_ONLY_DATA ((uint) 32768) /* Set by isamchk */
@@ -286,7 +320,9 @@ enum ha_base_keytype {
#define HA_CREATE_TMP_TABLE 4
#define HA_CREATE_CHECKSUM 8
#define HA_CREATE_KEEP_FILES 16 /* don't overwrite .MYD and MYI */
+#define HA_CREATE_PAGE_CHECKSUM 32
#define HA_CREATE_DELAY_KEY_WRITE 64
+#define HA_CREATE_RELIES_ON_SQL_LAYER 128
/*
The following flags (OR-ed) are passed to handler::info() method.
@@ -331,14 +367,18 @@ enum ha_base_keytype {
*/
#define HA_STATUS_AUTO 64
- /* Errorcodes given by functions */
+/*
+ Errorcodes given by handler functions
+
+ opt_sum_query() assumes these codes are > 1
+ Do not add error numbers before HA_ERR_FIRST.
+ If necessary to add lower numbers, change HA_ERR_FIRST accordingly.
+*/
+#define HA_ERR_FIRST 120 /* Copy of first error nr.*/
-/* opt_sum_query() assumes these codes are > 1 */
-/* Do not add error numbers before HA_ERR_FIRST. */
-/* If necessary to add lower numbers, change HA_ERR_FIRST accordingly. */
-#define HA_ERR_FIRST 120 /*Copy first error nr.*/
#define HA_ERR_KEY_NOT_FOUND 120 /* Didn't find key on read or update */
#define HA_ERR_FOUND_DUPP_KEY 121 /* Dupplicate key on write */
+#define HA_ERR_INTERNAL_ERROR 122 /* Internal error */
#define HA_ERR_RECORD_CHANGED 123 /* Uppdate with is recoverable */
#define HA_ERR_WRONG_INDEX 124 /* Wrong index given to function */
#define HA_ERR_CRASHED 126 /* Indexfile is crashed */
@@ -348,7 +388,7 @@ enum ha_base_keytype {
#define HA_ERR_WRONG_COMMAND 131 /* Command not supported */
#define HA_ERR_OLD_FILE 132 /* old databasfile */
#define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */
-#define HA_ERR_RECORD_DELETED 134 /* Intern error-code */
+#define HA_ERR_RECORD_DELETED 134 /* A record is not there */
#define HA_ERR_RECORD_FILE_FULL 135 /* No more room in file */
#define HA_ERR_INDEX_FILE_FULL 136 /* No more room in file */
#define HA_ERR_END_OF_FILE 137 /* end in next/prev/first/last */
@@ -357,7 +397,7 @@ enum ha_base_keytype {
#define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */
#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */
#define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */
-#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting MyISAM tables in MERGE */
+#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting tables in MERGE */
#define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */
#define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */
#define HA_ERR_LOCK_WAIT_TIMEOUT 146
@@ -372,23 +412,51 @@ enum ha_base_keytype {
#define HA_ERR_NO_SUCH_TABLE 155 /* The table does not exist in engine */
#define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */
#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */
-#define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */
+/* NULLs are not supported in spatial index */
+#define HA_ERR_NULL_IN_SPATIAL 158
#define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */
-#define HA_ERR_TABLE_NEEDS_UPGRADE 160 /* The table changed in storage engine */
-#define HA_ERR_TABLE_READONLY 161 /* The table is not writable */
-#define HA_ERR_AUTOINC_READ_FAILED 162/* Failed to get the next autoinc value */
-#define HA_ERR_AUTOINC_ERANGE 163 /* Failed to set the row autoinc value */
-#define HA_ERR_TOO_MANY_CONCURRENT_TRXS 164 /*Too many active concurrent transactions */
-/* You must also add numbers and description to extra/perror.c ! */
-
-#define HA_ERR_LAST 164 /*Copy last error nr.*/
-/* Add error numbers before HA_ERR_LAST and change it accordingly. */
+/* There's no partition in table for given value */
+#define HA_ERR_NO_PARTITION_FOUND 160
+#define HA_ERR_RBR_LOGGING_FAILED 161 /* Row-based binlogging of row failed */
+#define HA_ERR_DROP_INDEX_FK 162 /* Index needed in foreign key constr */
+/*
+ Upholding foreign key constraints would lead to a duplicate key error
+ in some other table.
+*/
+#define HA_ERR_FOREIGN_DUPLICATE_KEY 163
+/* The table changed in storage engine */
+#define HA_ERR_TABLE_NEEDS_UPGRADE 164
+#define HA_ERR_TABLE_READONLY 165 /* The table is not writable */
+
+#define HA_ERR_AUTOINC_READ_FAILED 166 /* Failed to get next autoinc value */
+#define HA_ERR_AUTOINC_ERANGE 167 /* Failed to set row autoinc value */
+#define HA_ERR_GENERIC 168 /* Generic error */
+/* row not actually updated: new values same as the old values */
+#define HA_ERR_RECORD_IS_THE_SAME 169
+/* It is not possible to log this statement */
+#define HA_ERR_LOGGING_IMPOSSIBLE 170 /* It is not possible to log this
+ statement */
+#define HA_ERR_CORRUPT_EVENT 171 /* The event was corrupt, leading to
+ illegal data being read */
+#define HA_ERR_NEW_FILE 172 /* New file format */
+#define HA_ERR_ROWS_EVENT_APPLY 173 /* The event could not be processed
+ no other hanlder error happened */
+#define HA_ERR_INITIALIZATION 174 /* Error during initialization */
+#define HA_ERR_FILE_TOO_SHORT 175 /* File too short */
+#define HA_ERR_WRONG_CRC 176 /* Wrong CRC on page */
+#define HA_ERR_TOO_MANY_CONCURRENT_TRXS 177 /*Too many active concurrent transactions */
+#define HA_ERR_LAST 177 /* Copy of last error nr */
+
+/* Number of different errors */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
/* Other constants */
#define HA_NAMELEN 64 /* Max length of saved filename */
-#define NO_SUCH_KEY ((uint)~0) /* used as a key no. */
+#define NO_SUCH_KEY (~(uint)0) /* used as a key no. */
+
+typedef ulong key_part_map;
+#define HA_WHOLE_KEY (~(key_part_map)0)
/* Intern constants in databases */
@@ -443,7 +511,7 @@ enum en_fieldtype {
};
enum data_file_type {
- STATIC_RECORD,DYNAMIC_RECORD,COMPRESSED_RECORD
+ STATIC_RECORD, DYNAMIC_RECORD, COMPRESSED_RECORD, BLOCK_RECORD
};
/* For key ranges */
@@ -456,11 +524,13 @@ enum data_file_type {
#define EQ_RANGE 32
#define NULL_RANGE 64
#define GEOM_FLAG 128
+#define SKIP_RANGE 256
typedef struct st_key_range
{
- const byte *key;
+ const uchar *key;
uint length;
+ key_part_map keypart_map;
enum ha_rkey_function flag;
} key_range;
@@ -493,4 +563,7 @@ typedef ulong ha_rows;
#define HA_VARCHAR_PACKLENGTH(field_length) ((field_length) < 256 ? 1 :2)
+/* invalidator function reference for Query Cache */
+typedef void (* invalidator_by_filename)(const char * filename);
+
#endif /* _my_base_h */
diff --git a/include/my_bit.h b/include/my_bit.h
new file mode 100644
index 00000000000..1e0a7488a81
--- /dev/null
+++ b/include/my_bit.h
@@ -0,0 +1,128 @@
+/*
+ Copyright (c) 2007, 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 */
+
+/*
+ Some useful bit functions
+*/
+
+C_MODE_START
+#ifdef HAVE_INLINE
+
+extern const char _my_bits_nbits[256];
+extern const uchar _my_bits_reverse_table[256];
+
+/*
+ Find smallest X in 2^X >= value
+ This can be used to divide a number with value by doing a shift instead
+*/
+
+STATIC_INLINE uint my_bit_log2(ulong value)
+{
+ uint bit;
+ for (bit=0 ; value > 1 ; value>>=1, bit++) ;
+ return bit;
+}
+
+STATIC_INLINE uint my_count_bits(ulonglong v)
+{
+#if SIZEOF_LONG_LONG > 4
+ /* The following code is a bit faster on 16 bit machines than if we would
+ only shift v */
+ ulong v2=(ulong) (v >> 32);
+ return (uint) (uchar) (_my_bits_nbits[(uchar) v] +
+ _my_bits_nbits[(uchar) (v >> 8)] +
+ _my_bits_nbits[(uchar) (v >> 16)] +
+ _my_bits_nbits[(uchar) (v >> 24)] +
+ _my_bits_nbits[(uchar) (v2)] +
+ _my_bits_nbits[(uchar) (v2 >> 8)] +
+ _my_bits_nbits[(uchar) (v2 >> 16)] +
+ _my_bits_nbits[(uchar) (v2 >> 24)]);
+#else
+ return (uint) (uchar) (_my_bits_nbits[(uchar) v] +
+ _my_bits_nbits[(uchar) (v >> 8)] +
+ _my_bits_nbits[(uchar) (v >> 16)] +
+ _my_bits_nbits[(uchar) (v >> 24)]);
+#endif
+}
+
+STATIC_INLINE uint my_count_bits_uint32(uint32 v)
+{
+ return (uint) (uchar) (_my_bits_nbits[(uchar) v] +
+ _my_bits_nbits[(uchar) (v >> 8)] +
+ _my_bits_nbits[(uchar) (v >> 16)] +
+ _my_bits_nbits[(uchar) (v >> 24)]);
+}
+
+
+/*
+ Next highest power of two
+
+ SYNOPSIS
+ my_round_up_to_next_power()
+ v Value to check
+
+ RETURN
+ Next or equal power of 2
+ Note: 0 will return 0
+
+ NOTES
+ Algorithm by Sean Anderson, according to:
+ http://graphics.stanford.edu/~seander/bithacks.html
+ (Orignal code public domain)
+
+ Comments shows how this works with 01100000000000000000000000001011
+*/
+
+STATIC_INLINE uint32 my_round_up_to_next_power(uint32 v)
+{
+ v--; /* 01100000000000000000000000001010 */
+ v|= v >> 1; /* 01110000000000000000000000001111 */
+ v|= v >> 2; /* 01111100000000000000000000001111 */
+ v|= v >> 4; /* 01111111110000000000000000001111 */
+ v|= v >> 8; /* 01111111111111111100000000001111 */
+ v|= v >> 16; /* 01111111111111111111111111111111 */
+ return v+1; /* 10000000000000000000000000000000 */
+}
+
+STATIC_INLINE uint32 my_clear_highest_bit(uint32 v)
+{
+ uint32 w=v >> 1;
+ w|= w >> 1;
+ w|= w >> 2;
+ w|= w >> 4;
+ w|= w >> 8;
+ w|= w >> 16;
+ return v & w;
+}
+
+STATIC_INLINE uint32 my_reverse_bits(uint32 key)
+{
+ return
+ (_my_bits_reverse_table[ key & 255] << 24) |
+ (_my_bits_reverse_table[(key>> 8) & 255] << 16) |
+ (_my_bits_reverse_table[(key>>16) & 255] << 8) |
+ _my_bits_reverse_table[(key>>24) ];
+}
+
+#else /* HAVE_INLINE */
+extern uint my_bit_log2(ulong value);
+extern uint32 my_round_up_to_next_power(uint32 v);
+uint32 my_clear_highest_bit(uint32 v);
+uint32 my_reverse_bits(uint32 key);
+extern uint my_count_bits(ulonglong v);
+extern uint my_count_bits_uint32(uint32 v);
+#endif /* HAVE_INLINE */
+C_MODE_END
diff --git a/include/my_bitmap.h b/include/my_bitmap.h
index 8fb4327622c..34c9ac9bb96 100644
--- a/include/my_bitmap.h
+++ b/include/my_bitmap.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000 MySQL AB
+/*
+ Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,19 +12,24 @@
You 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_bitmap_h_
#define _my_bitmap_h_
-#include <my_pthread.h>
-
#define MY_BIT_NONE (~(uint) 0)
+#include <m_string.h>
+
+typedef uint32 my_bitmap_map;
+
typedef struct st_bitmap
{
- uchar *bitmap;
- uint bitmap_size; /* number of bytes occupied by the above */
+ my_bitmap_map *bitmap;
+ uint n_bits; /* number of bits occupied by the above */
+ my_bitmap_map last_word_mask;
+ my_bitmap_map *last_word_ptr;
/*
mutex will be acquired for the duration of each bitmap operation if
thread_safe flag in bitmap_init was set. Otherwise, we optimize by not
@@ -37,33 +43,124 @@ typedef struct st_bitmap
#ifdef __cplusplus
extern "C" {
#endif
-extern my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2);
-extern my_bool bitmap_init(MY_BITMAP *map, uchar *buf, uint bitmap_size, my_bool thread_safe);
+extern void create_last_word_mask(MY_BITMAP *map);
+extern my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits,
+ my_bool thread_safe);
extern my_bool bitmap_is_clear_all(const MY_BITMAP *map);
extern my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size);
-extern my_bool bitmap_is_set(const MY_BITMAP *map, uint bitmap_bit);
extern my_bool bitmap_is_set_all(const MY_BITMAP *map);
extern my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2);
+extern my_bool bitmap_is_overlapping(const MY_BITMAP *map1,
+ const MY_BITMAP *map2);
extern my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit);
+extern my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit);
extern my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit);
extern uint bitmap_set_next(MY_BITMAP *map);
extern uint bitmap_get_first(const MY_BITMAP *map);
+extern uint bitmap_get_first_set(const MY_BITMAP *map);
extern uint bitmap_bits_set(const MY_BITMAP *map);
-extern void bitmap_clear_all(MY_BITMAP *map);
-extern void bitmap_clear_bit(MY_BITMAP *map, uint bitmap_bit);
extern void bitmap_free(MY_BITMAP *map);
-extern void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2);
extern void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit);
-extern void bitmap_set_all(MY_BITMAP *map);
-extern void bitmap_set_bit(MY_BITMAP *map, uint bitmap_bit);
extern void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size);
+extern void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2);
extern void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2);
extern void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2);
+extern void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2);
+extern void bitmap_invert(MY_BITMAP *map);
+extern void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2);
+extern uint bitmap_lock_set_next(MY_BITMAP *map);
+extern void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit);
+#ifdef NOT_USED
+extern uint bitmap_lock_bits_set(const MY_BITMAP *map);
+extern my_bool bitmap_lock_is_set_all(const MY_BITMAP *map);
+extern uint bitmap_lock_get_first(const MY_BITMAP *map);
+extern uint bitmap_lock_get_first_set(const MY_BITMAP *map);
+extern my_bool bitmap_lock_is_subset(const MY_BITMAP *map1,
+ const MY_BITMAP *map2);
+extern my_bool bitmap_lock_is_prefix(const MY_BITMAP *map, uint prefix_size);
+extern my_bool bitmap_lock_is_set(const MY_BITMAP *map, uint bitmap_bit);
+extern my_bool bitmap_lock_is_clear_all(const MY_BITMAP *map);
+extern my_bool bitmap_lock_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2);
+extern void bitmap_lock_set_all(MY_BITMAP *map);
+extern void bitmap_lock_clear_all(MY_BITMAP *map);
+extern void bitmap_lock_set_bit(MY_BITMAP *map, uint bitmap_bit);
+extern void bitmap_lock_flip_bit(MY_BITMAP *map, uint bitmap_bit);
+extern void bitmap_lock_set_prefix(MY_BITMAP *map, uint prefix_size);
+extern void bitmap_lock_intersect(MY_BITMAP *map, const MY_BITMAP *map2);
+extern void bitmap_lock_subtract(MY_BITMAP *map, const MY_BITMAP *map2);
+extern void bitmap_lock_union(MY_BITMAP *map, const MY_BITMAP *map2);
+extern void bitmap_lock_xor(MY_BITMAP *map, const MY_BITMAP *map2);
+extern void bitmap_lock_invert(MY_BITMAP *map);
+#endif
/* Fast, not thread safe, bitmap functions */
-#define bitmap_fast_set_bit(MAP, BIT) (MAP)->bitmap[(BIT) / 8] |= (1 << ((BIT) & 7))
-#define bitmap_fast_clear_bit(MAP, BIT) (MAP)->bitmap[(BIT) / 8] &= ~ (1 << ((BIT) & 7))
-#define bitmap_fast_is_set(MAP, BIT) (MAP)->bitmap[(BIT) / 8] & (1 << ((BIT) & 7))
+#define bitmap_buffer_size(bits) (((bits)+31)/32)*4
+#define no_bytes_in_map(map) (((map)->n_bits + 7)/8)
+#define no_words_in_map(map) (((map)->n_bits + 31)/32)
+#define bytes_word_aligned(bytes) (4*((bytes + 3)/4))
+#define _bitmap_set_bit(MAP, BIT) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \
+ |= (1 << ((BIT) & 7)))
+#define _bitmap_flip_bit(MAP, BIT) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \
+ ^= (1 << ((BIT) & 7)))
+#define _bitmap_clear_bit(MAP, BIT) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \
+ &= ~ (1 << ((BIT) & 7)))
+#define _bitmap_is_set(MAP, BIT) (uint) (((uchar*)(MAP)->bitmap)[(BIT) / 8] \
+ & (1 << ((BIT) & 7)))
+/*
+ WARNING!
+
+ The below symbols are inline functions in DEBUG builds and macros in
+ non-DEBUG builds. The latter evaluate their 'bit' argument twice.
+
+ NEVER use an increment/decrement operator with the 'bit' argument.
+ It would work with DEBUG builds, but fails later in production builds!
+
+ FORBIDDEN: bitmap_set_bit($my_bitmap, (field++)->field_index);
+*/
+#ifndef DBUG_OFF
+static inline void
+bitmap_set_bit(MY_BITMAP *map,uint bit)
+{
+ DBUG_ASSERT(bit < (map)->n_bits);
+ _bitmap_set_bit(map,bit);
+}
+static inline void
+bitmap_flip_bit(MY_BITMAP *map,uint bit)
+{
+ DBUG_ASSERT(bit < (map)->n_bits);
+ _bitmap_flip_bit(map,bit);
+}
+static inline void
+bitmap_clear_bit(MY_BITMAP *map,uint bit)
+{
+ DBUG_ASSERT(bit < (map)->n_bits);
+ _bitmap_clear_bit(map,bit);
+}
+static inline uint
+bitmap_is_set(const MY_BITMAP *map,uint bit)
+{
+ DBUG_ASSERT(bit < (map)->n_bits);
+ return _bitmap_is_set(map,bit);
+}
+#else
+#define bitmap_set_bit(MAP, BIT) _bitmap_set_bit(MAP, BIT)
+#define bitmap_flip_bit(MAP, BIT) _bitmap_flip_bit(MAP, BIT)
+#define bitmap_clear_bit(MAP, BIT) _bitmap_clear_bit(MAP, BIT)
+#define bitmap_is_set(MAP, BIT) _bitmap_is_set(MAP, BIT)
+#endif
+
+static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
+{
+ if (memcmp(map1->bitmap, map2->bitmap, 4*(no_words_in_map(map1)-1)) != 0)
+ return FALSE;
+ return ((*map1->last_word_ptr | map1->last_word_mask) ==
+ (*map2->last_word_ptr | map2->last_word_mask));
+}
+
+#define bitmap_clear_all(MAP) \
+ { memset((MAP)->bitmap, 0, 4*no_words_in_map((MAP))); }
+#define bitmap_set_all(MAP) \
+ (memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP))))
#ifdef __cplusplus
}
diff --git a/include/my_compare.h b/include/my_compare.h
index 55cd68bbc0d..dedae5c8052 100644
--- a/include/my_compare.h
+++ b/include/my_compare.h
@@ -79,7 +79,7 @@ typedef struct st_HA_KEYSEG /* Key-portion */
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
-extern int mi_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
+extern int ha_compare_text(CHARSET_INFO *, uchar *, uint, uchar *, uint ,
my_bool, my_bool);
extern int ha_key_cmp(register HA_KEYSEG *keyseg, register uchar *a,
register uchar *b, uint key_length, uint nextflag,
diff --git a/include/my_compiler.h b/include/my_compiler.h
new file mode 100644
index 00000000000..5f898621159
--- /dev/null
+++ b/include/my_compiler.h
@@ -0,0 +1,145 @@
+#ifndef MY_COMPILER_INCLUDED
+#define MY_COMPILER_INCLUDED
+
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-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 <my_global.h> /* stddef.h offsetof */
+
+/**
+ Compiler-dependent internal convenience macros.
+*/
+
+/* GNU C/C++ */
+#if defined __GNUC__
+/* Convenience macro to test the minimum required GCC version. */
+# define MY_GNUC_PREREQ(maj, min) \
+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+/* Any after 2.95... */
+# define MY_ALIGN_EXT
+/* Comunicate to the compiler the unreachability of the code. */
+# if MY_GNUC_PREREQ(4,5)
+# define MY_ASSERT_UNREACHABLE() __builtin_unreachable()
+# endif
+
+/* Microsoft Visual C++ */
+#elif defined _MSC_VER
+# define MY_ALIGNOF(type) __alignof(type)
+# define MY_ALIGNED(n) __declspec(align(n))
+
+/* Oracle Solaris Studio */
+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+# if __SUNPRO_C >= 0x590
+# define MY_ALIGN_EXT
+# endif
+
+/* IBM XL C/C++ */
+#elif defined __xlC__
+# if __xlC__ >= 0x0600
+# define MY_ALIGN_EXT
+# endif
+
+/* HP aCC */
+#elif defined(__HP_aCC) || defined(__HP_cc)
+# if (__HP_aCC >= 60000) || (__HP_cc >= 60000)
+# define MY_ALIGN_EXT
+# endif
+#endif
+
+#ifdef MY_ALIGN_EXT
+/** Specifies the minimum alignment of a type. */
+# define MY_ALIGNOF(type) __alignof__(type)
+/** Determine the alignment requirement of a type. */
+# define MY_ALIGNED(n) __attribute__((__aligned__((n))))
+#endif
+
+/**
+ Generic (compiler-independent) features.
+*/
+
+#ifndef MY_GNUC_PREREQ
+# define MY_GNUC_PREREQ(maj, min) (0)
+#endif
+
+#ifndef MY_ALIGNOF
+# ifdef __cplusplus
+ template<typename type> struct my_alignof_helper { char m1; type m2; };
+ /* Invalid for non-POD types, but most compilers give the right answer. */
+# define MY_ALIGNOF(type) offsetof(my_alignof_helper<type>, m2)
+# else
+# define MY_ALIGNOF(type) offsetof(struct { char m1; type m2; }, m2)
+# endif
+#endif
+
+#ifndef MY_ASSERT_UNREACHABLE
+# define MY_ASSERT_UNREACHABLE() do { assert(0); } while (0)
+#endif
+
+/**
+ C++ Type Traits
+*/
+
+#ifdef __cplusplus
+
+/**
+ Opaque storage with a particular alignment.
+*/
+# if defined(MY_ALIGNED)
+/* Partial specialization used due to MSVC++. */
+template<size_t alignment> struct my_alignment_imp;
+template<> struct MY_ALIGNED(1) my_alignment_imp<1> {};
+template<> struct MY_ALIGNED(2) my_alignment_imp<2> {};
+template<> struct MY_ALIGNED(4) my_alignment_imp<4> {};
+template<> struct MY_ALIGNED(8) my_alignment_imp<8> {};
+template<> struct MY_ALIGNED(16) my_alignment_imp<16> {};
+/* ... expand as necessary. */
+# else
+template<size_t alignment>
+struct my_alignment_imp { double m1; };
+# endif
+
+/**
+ A POD type with a given size and alignment.
+
+ @remark If the compiler does not support a alignment attribute
+ (MY_ALIGN macro), the default alignment of a double is
+ used instead.
+
+ @tparam size The minimum size.
+ @tparam alignment The desired alignment: 1, 2, 4, 8 or 16.
+*/
+template <size_t size, size_t alignment>
+struct my_aligned_storage
+{
+ union
+ {
+ char data[size];
+ my_alignment_imp<alignment> align;
+ };
+};
+
+#endif /* __cplusplus */
+
+#include <my_attribute.h>
+
+#endif /* MY_COMPILER_INCLUDED */
diff --git a/include/my_dbug.h b/include/my_dbug.h
index 514cd17099b..f49466cc098 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -1,4 +1,4 @@
-/* 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
@@ -11,10 +11,44 @@
You 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
+
+#ifndef __WIN__
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <signal.h>
+#endif /* not __WIN__ */
+
+#if defined(__cplusplus) && !defined(DBUG_OFF)
+class Dbug_violation_helper
+{
+public:
+ inline Dbug_violation_helper() :
+ _entered(TRUE)
+ { }
+
+ inline ~Dbug_violation_helper()
+ {
+ assert(!_entered);
+ }
+
+ inline void leave()
+ {
+ _entered= FALSE;
+ }
+
+private:
+ bool _entered;
+};
+#endif /* C++ */
#ifdef __cplusplus
extern "C" {
@@ -46,12 +80,33 @@ 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_();
+
+#ifdef __cplusplus
+
+#define DBUG_ENTER(a) \
+ const char *_db_func_, *_db_file_; \
+ uint _db_level_; \
+ char **_db_framep_; \
+ Dbug_violation_helper dbug_violation_helper; \
+ _db_enter_ (a, __FILE__, __LINE__, &_db_func_, &_db_file_, \
+ &_db_level_, &_db_framep_)
+#define DBUG_VIOLATION_HELPER_LEAVE dbug_violation_helper.leave()
+
+#else /* C */
+
+#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_VIOLATION_HELPER_LEAVE do { } while(0)
+
+#endif /* C++ */
-#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 \
+ DBUG_VIOLATION_HELPER_LEAVE; \
_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_)
#define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0)
#define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0)
@@ -81,10 +136,40 @@ extern FILE *_db_fp_(void);
#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len))
#define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len))
#define IF_DBUG(A) A
+#ifndef __WIN__
+#define DBUG_ABORT() (_db_flush_(), abort())
+#else
+/*
+ Avoid popup with abort/retry/ignore buttons. When BUG#31745 is fixed we can
+ call abort() instead of _exit(3) (now it would cause a "test signal" popup).
+*/
+#include <crtdbg.h>
+#define DBUG_ABORT() (_db_flush_(),\
+ (void)_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE),\
+ (void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR),\
+ _exit(3))
+#endif
+
+/*
+ Make the program fail, without creating a core file.
+ abort() will send SIGABRT which (most likely) generates core.
+ Use SIGKILL instead, which cannot be caught.
+ We also pause the current thread, until the signal is actually delivered.
+ An alternative would be to use _exit(EXIT_FAILURE),
+ but then valgrind would report lots of memory leaks.
+ */
+#ifdef __WIN__
+#define DBUG_SUICIDE() DBUG_ABORT()
+#else
+extern void _db_suicide_();
+#define DBUG_SUICIDE() (_db_flush_(), _db_suicide_())
+#endif
+
#else /* No debugger */
#define DBUG_ENTER(a1)
#define DBUG_LEAVE
+#define DBUG_VIOLATION_HELPER_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)
@@ -93,23 +178,27 @@ extern FILE *_db_fp_(void);
#define DBUG_EVALUATE_IF(keyword,a1,a2) (a2)
#define DBUG_PRINT(keyword,arglist) do { } while(0)
#define DBUG_PUSH(a1)
-#define DBUG_SET(a1)
-#define DBUG_SET_INITIAL(a1)
+#define DBUG_SET(a1) do { } while(0)
+#define DBUG_SET_INITIAL(a1) do { } while(0)
#define DBUG_POP()
#define DBUG_PROCESS(a1)
#define DBUG_SETJMP(a1) setjmp(a1)
#define DBUG_LONGJMP(a1) longjmp(a1)
-#define DBUG_DUMP(keyword,a1,a2)
+#define DBUG_DUMP(keyword,a1,a2) do { } while(0)
#define DBUG_END()
-#define DBUG_ASSERT(A)
+#define DBUG_ASSERT(A) do { } while(0)
#define DBUG_LOCK_FILE
#define DBUG_FILE (stderr)
#define DBUG_UNLOCK_FILE
#define DBUG_EXPLAIN(buf,len)
#define DBUG_EXPLAIN_INITIAL(buf,len)
#define IF_DBUG(A)
+#define DBUG_ABORT() do { } while(0)
+#define DBUG_SUICIDE() do { } while(0)
+
#endif
#ifdef __cplusplus
}
#endif
-#endif
+
+#endif /* MY_DBUG_INCLUDED */
diff --git a/include/my_getopt.h b/include/my_getopt.h
index f5688a37231..8112303a6a5 100644
--- a/include/my_getopt.h
+++ b/include/my_getopt.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2002-2004 MySQL AB
+/*
+ Copyright (c) 2002, 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
@@ -11,7 +12,8 @@
You 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_getopt_h
#define _my_getopt_h
@@ -29,46 +31,64 @@ C_MODE_START
#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_ASK_ADDR 128
#define GET_TYPE_MASK 127
enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
+struct st_typelib;
+
struct my_option
{
const char *name; /* Name of the option */
int id; /* unique id or short option */
const char *comment; /* option comment, for autom. --help */
- gptr *value; /* The variable value */
- gptr *u_max_value; /* The user def. max variable value */
- const char **str_values; /* Pointer to possible values */
- ulong var_type;
+ void *value; /* The variable value */
+ void *u_max_value; /* The user def. max variable value */
+ struct st_typelib *typelib; /* Pointer to possible values */
+ ulong var_type; /* Must match the variable type */
enum get_opt_arg_type arg_type;
longlong def_value; /* Default value */
longlong min_value; /* Min allowed value */
longlong max_value; /* Max allowed value */
longlong sub_size; /* Subtract this from given value */
long block_size; /* Value should be a mult. of this */
- int app_type; /* To be used by an application */
+ void *app_type; /* To be used by an application */
};
-typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * );
-typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... );
+typedef my_bool (*my_get_one_option)(int, const struct my_option *, char *);
+typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...)
+ ATTRIBUTE_FORMAT_FPTR(printf, 2, 3);
+
+/**
+ Used to retrieve a reference to the object (variable) that holds the value
+ for the given option. For example, if var_type is GET_UINT, the function
+ must return a pointer to a variable of type uint. A argument is stored in
+ the location pointed to by the returned pointer.
+*/
+typedef void *(*my_getopt_value)(const char *, uint, const struct my_option *,
+ int *);
extern char *disabled_my_option;
extern 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 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_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
- const struct my_option *));
+extern void my_getopt_register_get_addr(my_getopt_value);
ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
- bool *fixed);
+ my_bool *fix);
+longlong getopt_ll_limit_value(longlong, const struct my_option *,
+ my_bool *fix);
my_bool getopt_compare_strings(const char *s, const char *t, uint length);
C_MODE_END
diff --git a/include/my_global.h b/include/my_global.h
index c665480cdf4..8f4b67855db 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+/*
+ Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,24 +12,24 @@
You should have received a copy of the GNU 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 */
+ 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 _global_h
#define _global_h
-#ifndef EMBEDDED_LIBRARY
-#define HAVE_REPLICATION
-#define HAVE_EXTERNAL_CLIENT
-#endif
+/*
+ InnoDB depends on some MySQL internals which other plugins should not
+ need. This is because of InnoDB's foreign key support, "safe" binlog
+ truncation, and other similar legacy features.
-#if defined( __EMX__) && !defined( MYSQL_SERVER)
-/* moved here to use below VOID macro redefinition */
-#define INCL_BASE
-#define INCL_NOPMAPI
-#include <os2.h>
-#endif /* __EMX__ */
+ We define accessors for these internals unconditionally, but do not
+ expose them in mysql/plugin.h. They are declared in ha_innodb.h for
+ InnoDB's use.
+*/
+#define INNODB_COMPATIBILITY_HOOKS
#ifdef __CYGWIN__
/* We use a Unix API, so pretend it's not Windows */
@@ -56,6 +57,10 @@
#define USE_PRAGMA_INTERFACE
#endif
+#if defined(__OpenBSD__) && (OpenBSD >= 200411)
+#define HAVE_ERRNO_AS_DEFINE
+#endif
+
#if defined(i386) && !defined(__i386__)
#define __i386__
#endif
@@ -71,8 +76,6 @@
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
#include <config-win.h>
-#elif defined(OS2)
-#include <config-os2.h>
#elif defined(__NETWARE__)
#include <my_config.h>
#include <config-netware.h>
@@ -93,6 +96,16 @@
#define IF_WIN(A,B) (B)
#endif
+#ifndef EMBEDDED_LIBRARY
+#ifdef WITH_NDB_BINLOG
+#define HAVE_NDB_BINLOG 1
+#endif
+#endif /* !EMBEDDED_LIBRARY */
+
+#ifndef EMBEDDED_LIBRARY
+#define HAVE_REPLICATION
+#define HAVE_EXTERNAL_CLIENT
+#endif
/* Some defines to avoid ifdefs in the code */
#ifndef NETWARE_YIELD
@@ -153,6 +166,107 @@
#define unlikely(x) __builtin_expect((x),0)
+/*
+ The macros below are useful in optimising places where it has been
+ discovered that cache misses stall the process and where a prefetch
+ of the cache line can improve matters. This is available in GCC 3.1.1
+ and later versions.
+ PREFETCH_READ says that addr is going to be used for reading and that
+ it is to be kept in caches if possible for a while
+ PREFETCH_WRITE also says that the item to be cached is likely to be
+ updated.
+ The *LOCALITY scripts are also available for experimentation purposes
+ mostly and should only be used if they are verified to improve matters.
+ For more input see GCC manual (available in GCC 3.1.1 and later)
+*/
+
+#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10)
+#define PREFETCH_READ(addr) __builtin_prefetch(addr, 0, 3)
+#define PREFETCH_WRITE(addr) \
+ __builtin_prefetch(addr, 1, 3)
+#define PREFETCH_READ_LOCALITY(addr, locality) \
+ __builtin_prefetch(addr, 0, locality)
+#define PREFETCH_WRITE_LOCALITY(addr, locality) \
+ __builtin_prefetch(addr, 1, locality)
+#else
+#define PREFETCH_READ(addr)
+#define PREFETCH_READ_LOCALITY(addr, locality)
+#define PREFETCH_WRITE(addr)
+#define PREFETCH_WRITE_LOCALITY(addr, locality)
+#endif
+
+/*
+ The following macro is used to ensure that code often used in most
+ SQL statements and definitely for parts of the SQL processing are
+ kept in a code segment by itself. This has the advantage that the
+ risk of common code being overlapping in caches of the CPU is less.
+ This can be a cause of big performance problems.
+ Routines should be put in this category with care and when they are
+ put there one should also strive to make as much of the error handling
+ as possible (or uncommon code of the routine) to execute in a
+ separate method to avoid moving to much code to this code segment.
+
+ It is very easy to use, simply add HOT_METHOD at the end of the
+ function declaration.
+ For more input see GCC manual (available in GCC 2.95 and later)
+*/
+
+#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94)
+#define HOT_METHOD \
+ __attribute__ ((section ("hot_code_section")))
+#else
+#define HOT_METHOD
+#endif
+
+/*
+ The following macro is used to ensure that popular global variables
+ are located next to each other to avoid that they contend for the
+ same cache lines.
+
+ It is very easy to use, simply add HOT_DATA at the end of the declaration
+ of the variable, the variable must be initialised because of the way
+ that linker works so a declaration using HOT_DATA should look like:
+ uint global_hot_data HOT_DATA = 0;
+ For more input see GCC manual (available in GCC 2.95 and later)
+*/
+
+#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR > 94)
+#define HOT_DATA \
+ __attribute__ ((section ("hot_data_section")))
+#else
+#define HOT_DATA
+#endif
+
+/*
+ now let's figure out if inline functions are supported
+ autoconf defines 'inline' to be empty, if not
+*/
+#define inline_test_1(X) X ## 1
+#define inline_test_2(X) inline_test_1(X)
+#if inline_test_2(inline) != 1
+#define HAVE_INLINE
+#endif
+#undef inline_test_2
+#undef inline_test_1
+/* helper macro for "instantiating" inline functions */
+#define STATIC_INLINE static inline
+
+/*
+ The following macros are used to control inlining a bit more than
+ usual. These macros are used to ensure that inlining always or
+ never occurs (independent of compilation mode).
+ For more input see GCC manual (available in GCC 3.1.1 and later)
+*/
+
+#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR > 10)
+#define ALWAYS_INLINE __attribute__ ((always_inline))
+#define NEVER_INLINE __attribute__ ((noinline))
+#else
+#define ALWAYS_INLINE
+#define NEVER_INLINE
+#endif
+
+
/* Fix problem with S_ISLNK() on Linux */
#if defined(TARGET_OS_LINUX) || defined(__GLIBC__)
#undef _GNU_SOURCE
@@ -168,12 +282,10 @@
#endif
/* The client defines this to avoid all thread code */
-#if defined(UNDEF_THREADS_HACK)
+#if defined(MYSQL_CLIENT_NO_THREADS) || 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
@@ -218,7 +330,7 @@
#endif
#endif
-#if defined(THREAD) && !defined(__WIN__) && !defined(OS2)
+#if defined(THREAD) && !defined(__WIN__)
#ifndef _POSIX_PTHREAD_SEMANTICS
#define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */
#endif
@@ -229,10 +341,6 @@
#if !defined(_THREAD_SAFE) && !defined(_AIX)
#define _THREAD_SAFE /* Required for OSF1 */
#endif
-#ifndef HAVE_mit_thread
-#ifdef HAVE_UNIXWARE7_THREADS
-#include <thread.h>
-#else
#if defined(HPUX10) || defined(HPUX11)
C_MODE_START /* HPUX needs this, signal.h bug */
#include <pthread.h>
@@ -240,8 +348,6 @@ C_MODE_END
#else
#include <pthread.h> /* 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
@@ -357,17 +463,7 @@ C_MODE_END
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
-#ifdef HAVE_ATOMIC_ADD
-#define new my_arg_new
-#define need_to_restore_new 1
-C_MODE_START
-#include <asm/atomic.h>
-C_MODE_END
-#ifdef need_to_restore_new /* probably safer than #ifdef new */
-#undef new
-#undef need_to_restore_new
-#endif
-#endif
+
#include <errno.h> /* Recommended by debian */
/* We need the following to go around a problem with openssl on solaris */
#if defined(HAVE_CRYPT_H)
@@ -381,14 +477,26 @@ C_MODE_END
*/
#include <assert.h>
+/* an assert that works at compile-time. only for constant expression */
+#ifndef __GNUC__
+#define compile_time_assert(X) do { } while(0)
+#else
+#define compile_time_assert(X) \
+ do \
+ { \
+ char compile_time_assert[(X) ? 1 : -1] \
+ __attribute__ ((unused)); \
+ } while(0)
+#endif
+
/* Go around some bugs in different OS and compilers */
+#if defined (HPUX11) && defined(_LARGEFILE_SOURCE)
+#define _LARGEFILE64_SOURCE
+#endif
#if defined(_HPUX_SOURCE) && defined(HAVE_SYS_STREAM_H)
#include <sys/stream.h> /* 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
@@ -423,9 +531,7 @@ extern "C" int madvise(void *addr, size_t len, int behav);
#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
#define QUOTE_ARG(x) #x /* Quote argument (before cpp) */
#define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */
@@ -437,8 +543,8 @@ extern "C" int madvise(void *addr, size_t len, int behav);
#endif
/* Does the system remember a signal handler after a signal ? */
-#ifndef HAVE_BSD_SIGNALS
-#define DONT_REMEMBER_SIGNAL
+#if !defined(HAVE_BSD_SIGNALS) && !defined(HAVE_SIGACTION)
+#define SIGNAL_HANDLER_RESET_ON_DELIVERY
#endif
/* Define void to stop lint from generating "null effekt" comments */
@@ -452,22 +558,30 @@ int __void__;
#endif
#endif /* DONT_DEFINE_VOID */
-#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
-#define LINT_INIT(var) var=0 /* No uninitialize-warning */
+/*
+ Deprecated workaround for false-positive uninitialized variables
+ warnings. Those should be silenced using tool-specific heuristics.
+
+ Enabled by default for g++ due to the bug referenced below.
+*/
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
+ (defined(__GNUC__) && defined(__cplusplus))
+#define LINT_INIT(var) var= 0
#else
#define LINT_INIT(var)
#endif
-/*
+/*
Suppress uninitialized variable warning without generating code.
The _cplusplus is a temporary workaround for C++ code pending a fix
- for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
+ for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
*/
-#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \
- !defined(__GNUC__)
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
+ defined(__cplusplus) || !defined(__GNUC__)
#define UNINIT_VAR(x) x= 0
#else
+/* GCC specific self-initialization which inhibits the warning. */
#define UNINIT_VAR(x) x= x
#endif
@@ -477,7 +591,7 @@ int __void__;
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
-#if defined(__EMX__) || !defined(HAVE_UINT)
+#if !defined(HAVE_UINT)
#undef HAVE_UINT
#define HAVE_UINT
typedef unsigned int uint;
@@ -486,12 +600,11 @@ typedef unsigned short ushort;
#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 swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; }
#define 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])))
/* Define some general constants */
@@ -512,7 +625,7 @@ typedef unsigned short ushort;
#define my_const_cast(A) (A)
#endif
-#include <my_attribute.h>
+#include <my_compiler.h>
/*
Wen using the embedded library, users might run into link problems,
@@ -535,6 +648,7 @@ C_MODE_END
#define _VARARGS(X) X
#define _STATIC_VARARGS(X) X
+/* The DBUG_ON flag always takes precedence over default DBUG_OFF */
#if defined(DBUG_ON) && defined(DBUG_OFF)
#undef DBUG_OFF
#endif
@@ -582,21 +696,11 @@ C_MODE_START
typedef int (*qsort_cmp)(const void *,const void *);
typedef int (*qsort_cmp2)(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
-#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 <sys/socket.h>
#endif
typedef SOCKET_SIZE_TYPE size_socket;
-#endif
#ifndef SOCKOPT_OPTLEN_TYPE
#define SOCKOPT_OPTLEN_TYPE size_socket
@@ -645,7 +749,6 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define UNSINT32 /* unsigned int32 */
/* General constants */
-#define SC_MAXWIDTH 256 /* Max width of screen (for error messages) */
#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) */
@@ -656,17 +759,13 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define FN_PARENTDIR ".." /* Parent directory; Must be a string */
#ifndef FN_LIBCHAR
-#ifdef __EMX__
-#define FN_LIBCHAR '\\'
-#define FN_ROOTDIR "\\"
-#else
#define FN_LIBCHAR '/'
+#define FN_DIRSEP "/" /* Valid directory separators */
#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
+#define OS_FILE_LIMIT UINT_MAX
#endif
/* #define EXT_IN_LIBNAME */
@@ -710,11 +809,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#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
#ifndef ulonglong2double
#define ulonglong2double(A) ((double) (ulonglong) (A))
#define my_off_t2double(A) ((double) (my_off_t) (A))
@@ -730,19 +825,12 @@ typedef SOCKET_SIZE_TYPE size_socket;
#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))
+#ifndef STACK_DIRECTION
+#error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS"
#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
+#if !defined(HAVE_STRTOK_R)
+#define strtok_r(A,B,C) strtok((A),(B))
#endif
/* This is from the old m-machine.h file */
@@ -797,9 +885,13 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define SIZE_T_MAX (~((size_t) 0))
#endif
-#ifndef HAVE_FINITE
+#ifndef isfinite
+#ifdef HAVE_FINITE
+#define isfinite(x) finite(x)
+#else
#define finite(x) (1.0 / fabs(x) > 0.0)
-#endif
+#endif /* HAVE_FINITE */
+#endif /* isfinite */
#ifndef HAVE_ISNAN
#define isnan(x) ((x) != (x))
@@ -849,8 +941,8 @@ typedef long long my_ptrdiff_t;
#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
@@ -885,36 +977,41 @@ typedef long long my_ptrdiff_t;
/* 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 */
+#ifndef HAVE_INT8
+typedef signed char int8; /* Signed integer >= 8 bits */
+#endif
+#ifndef HAVE_UINT8
+typedef unsigned char uint8; /* Unsigned integer >= 8 bits */
+#endif
+#ifndef HAVE_INT16
+typedef short int16;
+#endif
+#ifndef HAVE_UINT16
+typedef unsigned short uint16;
+#endif
#if SIZEOF_INT == 4
-#ifndef HAVE_INT_8_16_32
-typedef int int32;
+#ifndef HAVE_INT32
+typedef int int32;
+#endif
+#ifndef HAVE_UINT32
+typedef unsigned int uint32;
#endif
-typedef unsigned int uint32; /* Short for unsigned integer >= 32 bits */
#elif SIZEOF_LONG == 4
-#ifndef HAVE_INT_8_16_32
-typedef long int32;
+#ifndef HAVE_INT32
+typedef long int32;
+#endif
+#ifndef HAVE_UINT32
+typedef unsigned long uint32;
#endif
-typedef unsigned long uint32; /* Short for unsigned integer >= 32 bits */
#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) && !defined(__USE_MISC)
typedef unsigned long ulong; /* Short for unsigned long */
#endif
#ifndef longlong_defined
@@ -931,6 +1028,12 @@ typedef unsigned long ulonglong; /* ulong or unsigned long long */
typedef long longlong;
#endif
#endif
+#ifndef HAVE_INT64
+typedef longlong int64;
+#endif
+#ifndef HAVE_UINT64
+typedef ulonglong uint64;
+#endif
#if defined(NO_CLIENT_LONG_LONG)
typedef unsigned long my_ulonglong;
@@ -940,6 +1043,18 @@ typedef unsigned __int64 my_ulonglong;
typedef unsigned long long my_ulonglong;
#endif
+#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
+#error sizeof(void *) is neither sizeof(int) nor sizeof(long) nor sizeof(long long)
+#endif
+
+#define MY_ERRPTR ((void*)(intptr)1)
+
#ifdef USE_RAID
/*
The following is done with a if to not get problems with pre-processors
@@ -962,7 +1077,7 @@ typedef ulonglong my_off_t;
typedef unsigned long my_off_t;
#endif
#define MY_FILEPOS_ERROR (~(my_off_t) 0)
-#if !defined(__WIN__) && !defined(OS2)
+#if !defined(__WIN__)
typedef off_t os_off_t;
#endif
@@ -975,16 +1090,6 @@ typedef off_t os_off_t;
#define SOCKET_EADDRINUSE WSAEADDRINUSE
#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)
@@ -999,12 +1104,7 @@ typedef off_t os_off_t;
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(HAVE_BOOL) || !defined(__cplusplus))
typedef char bool; /* Ordinary boolean values 0 1 */
@@ -1065,6 +1165,9 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#define dbug_volatile
#endif
+/* Some helper macros */
+#define YESNO(X) ((X) ? "yes" : "no")
+
/* Defines for time function */
#define SCALE_SEC 100
#define SCALE_USEC 10000
@@ -1110,6 +1213,12 @@ typedef char bool; /* Ordinary boolean values 0 1 */
(((uint32) ((uchar) (A)[2])) << 16) +\
(((uint32) ((uchar) (A)[3])) << 24)) +\
(((ulonglong) ((uchar) (A)[4])) << 32))
+#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
+ (((uint32) ((uchar) (A)[1])) << 8) + \
+ (((uint32) ((uchar) (A)[2])) << 16) + \
+ (((uint32) ((uchar) (A)[3])) << 24)) + \
+ (((ulonglong) ((uchar) (A)[4])) << 32) + \
+ (((ulonglong) ((uchar) (A)[5])) << 40))
#define uint8korr(A) (*((ulonglong *) (A)))
#define sint8korr(A) (*((longlong *) (A)))
#define int2store(T,A) *((uint16*) (T))= (uint16) (A)
@@ -1122,6 +1231,12 @@ typedef char bool; /* Ordinary boolean values 0 1 */
*((T)+2)=(uchar) (((A) >> 16));\
*((T)+3)=(uchar) (((A) >> 24)); \
*((T)+4)=(uchar) (((A) >> 32)); } while(0)
+#define int6store(T,A) do { *(T)= (uchar)((A)); \
+ *((T)+1)=(uchar) (((A) >> 8)); \
+ *((T)+2)=(uchar) (((A) >> 16)); \
+ *((T)+3)=(uchar) (((A) >> 24)); \
+ *((T)+4)=(uchar) (((A) >> 32)); \
+ *((T)+5)=(uchar) (((A) >> 40)); } while(0)
#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A)
typedef union {
@@ -1138,9 +1253,9 @@ do { doubleget_union _tmp; \
} while (0)
#define float4get(V,M) do { *((float *) &(V)) = *((float*) (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 float4store(V,M) memcpy((uchar*) V,(uchar*) (&M),sizeof(float))
+#define floatstore(T,V) memcpy((uchar*)(T), (uchar*)(&V),sizeof(float))
+#define floatget(V,M) memcpy((uchar*) &V,(uchar*) (M),sizeof(float))
#define float8store(V,M) doublestore((V),(M))
#else
@@ -1177,6 +1292,12 @@ do { doubleget_union _tmp; \
(((uint32) ((uchar) (A)[2])) << 16) +\
(((uint32) ((uchar) (A)[3])) << 24)) +\
(((ulonglong) ((uchar) (A)[4])) << 32))
+#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
+ (((uint32) ((uchar) (A)[1])) << 8) + \
+ (((uint32) ((uchar) (A)[2])) << 16) + \
+ (((uint32) ((uchar) (A)[3])) << 24)) + \
+ (((ulonglong) ((uchar) (A)[4])) << 32) + \
+ (((ulonglong) ((uchar) (A)[5])) << 40))
#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16) +\
@@ -1199,68 +1320,76 @@ do { doubleget_union _tmp; \
*(((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 int5store(T,A) do { *((char *)(T))= (char)((A)); \
+ *(((char *)(T))+1)= (char)(((A) >> 8)); \
+ *(((char *)(T))+2)= (char)(((A) >> 16)); \
+ *(((char *)(T))+3)= (char)(((A) >> 24)); \
+ *(((char *)(T))+4)= (char)(((A) >> 32)); \
+ } while(0)
+#define int6store(T,A) do { *((char *)(T))= (char)((A)); \
+ *(((char *)(T))+1)= (char)(((A) >> 8)); \
+ *(((char *)(T))+2)= (char)(((A) >> 16)); \
+ *(((char *)(T))+3)= (char)(((A) >> 24)); \
+ *(((char *)(T))+4)= (char)(((A) >> 32)); \
+ *(((char *)(T))+5)= (char)(((A) >> 40)); \
+ } while(0)
#define int8store(T,A) do { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \
int4store((T),def_temp); \
int4store((T+4),def_temp2); } while(0)
#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 float4store(T,A) do { *(T)= ((uchar *) &A)[3];\
+ *((T)+1)=(char) ((uchar *) &A)[2];\
+ *((T)+2)=(char) ((uchar *) &A)[1];\
+ *((T)+3)=(char) ((uchar *) &A)[0]; } while(0)
#define float4get(V,M) do { float def_temp;\
- ((byte*) &def_temp)[0]=(M)[3];\
- ((byte*) &def_temp)[1]=(M)[2];\
- ((byte*) &def_temp)[2]=(M)[1];\
- ((byte*) &def_temp)[3]=(M)[0];\
+ ((uchar*) &def_temp)[0]=(M)[3];\
+ ((uchar*) &def_temp)[1]=(M)[2];\
+ ((uchar*) &def_temp)[2]=(M)[1];\
+ ((uchar*) &def_temp)[3]=(M)[0];\
(V)=def_temp; } while(0)
-#define float8store(T,V) do { *(T)= ((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 float8store(T,V) do { *(T)= ((uchar *) &V)[7];\
+ *((T)+1)=(char) ((uchar *) &V)[6];\
+ *((T)+2)=(char) ((uchar *) &V)[5];\
+ *((T)+3)=(char) ((uchar *) &V)[4];\
+ *((T)+4)=(char) ((uchar *) &V)[3];\
+ *((T)+5)=(char) ((uchar *) &V)[2];\
+ *((T)+6)=(char) ((uchar *) &V)[1];\
+ *((T)+7)=(char) ((uchar *) &V)[0]; } while(0)
#define float8get(V,M) do { double def_temp;\
- ((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];\
+ ((uchar*) &def_temp)[0]=(M)[7];\
+ ((uchar*) &def_temp)[1]=(M)[6];\
+ ((uchar*) &def_temp)[2]=(M)[5];\
+ ((uchar*) &def_temp)[3]=(M)[4];\
+ ((uchar*) &def_temp)[4]=(M)[3];\
+ ((uchar*) &def_temp)[5]=(M)[2];\
+ ((uchar*) &def_temp)[6]=(M)[1];\
+ ((uchar*) &def_temp)[7]=(M)[0];\
(V) = def_temp; } while(0)
#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))
+#define float4get(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(float))
+#define float4store(V,M) memcpy_fixed((uchar*) V,(uchar*) (&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]; }\
+#define doublestore(T,V) do { *(((char*)T)+0)=(char) ((uchar *) &V)[4];\
+ *(((char*)T)+1)=(char) ((uchar *) &V)[5];\
+ *(((char*)T)+2)=(char) ((uchar *) &V)[6];\
+ *(((char*)T)+3)=(char) ((uchar *) &V)[7];\
+ *(((char*)T)+4)=(char) ((uchar *) &V)[0];\
+ *(((char*)T)+5)=(char) ((uchar *) &V)[1];\
+ *(((char*)T)+6)=(char) ((uchar *) &V)[2];\
+ *(((char*)T)+7)=(char) ((uchar *) &V)[3]; }\
while(0)
#define doubleget(V,M) do { double def_temp;\
- ((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];\
+ ((uchar*) &def_temp)[0]=(M)[4];\
+ ((uchar*) &def_temp)[1]=(M)[5];\
+ ((uchar*) &def_temp)[2]=(M)[6];\
+ ((uchar*) &def_temp)[3]=(M)[7];\
+ ((uchar*) &def_temp)[4]=(M)[0];\
+ ((uchar*) &def_temp)[5]=(M)[1];\
+ ((uchar*) &def_temp)[6]=(M)[2];\
+ ((uchar*) &def_temp)[7]=(M)[3];\
(V) = def_temp; } while(0)
#endif /* __FLOAT_WORD_ORDER */
@@ -1291,16 +1420,16 @@ do { doubleget_union _tmp; \
#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];\
+ ((uchar*) &def_temp)[0]=(M)[0];\
+ ((uchar*) &def_temp)[1]=(M)[1];\
+ ((uchar*) &def_temp)[2]=(M)[2];\
+ ((uchar*) &def_temp)[3]=(M)[3];\
(V)=def_temp; } while(0)
#define ulongget(V,M) do { uint32 def_temp;\
- ((byte*) &def_temp)[0]=(M)[0];\
- ((byte*) &def_temp)[1]=(M)[1];\
- ((byte*) &def_temp)[2]=(M)[2];\
- ((byte*) &def_temp)[3]=(M)[3];\
+ ((uchar*) &def_temp)[0]=(M)[0];\
+ ((uchar*) &def_temp)[1]=(M)[1];\
+ ((uchar*) &def_temp)[2]=(M)[2];\
+ ((uchar*) &def_temp)[3]=(M)[3];\
(V)=def_temp; } while(0)
#define shortstore(T,A) do { uint def_temp=(uint) (A) ;\
*(((char*)T)+1)=(char)(def_temp); \
@@ -1310,12 +1439,12 @@ do { doubleget_union _tmp; \
*(((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))
+#define floatget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(float))
+#define floatstore(T,V) memcpy_fixed((uchar*) (T),(uchar*)(&V),sizeof(float))
+#define doubleget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(double))
+#define doublestore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(double))
+#define longlongget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(ulonglong))
+#define longlongstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &V,sizeof(ulonglong))
#else
@@ -1326,35 +1455,27 @@ do { doubleget_union _tmp; \
#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))
+#define floatstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) (&V),sizeof(float))
+#define floatget(V,M) memcpy_fixed((uchar*) &V, (uchar*) (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))
+#define doubleget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(double))
+#define doublestore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &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))
+#define longlongget(V,M) memcpy_fixed((uchar*) &V,(uchar*) (M),sizeof(ulonglong))
+#define longlongstore(T,V) memcpy_fixed((uchar*) (T),(uchar*) &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_decrement(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_decrement(V,L) (V)--
#define statistic_add(V,C,L) (V)+=(C)
+#define statistic_sub(V,C,L) (V)-=(C)
#endif
#ifdef HAVE_CHARSET_utf8
@@ -1367,15 +1488,69 @@ do { doubleget_union _tmp; \
#define NO_EMBEDDED_ACCESS_CHECKS
#endif
+#ifdef HAVE_DLOPEN
+#if defined(__WIN__)
+#define dlsym(lib, name) GetProcAddress((HMODULE)lib, name)
+#define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0)
+#define dlclose(lib) FreeLibrary((HMODULE)lib)
+#elif defined(HAVE_DLFCN_H)
+#include <dlfcn.h>
+#endif
+#endif
-/* Length of decimal number represented by INT32. */
+/* FreeBSD 2.2.2 does not define RTLD_NOW) */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+
+#ifndef HAVE_DLERROR
+#define dlerror() ""
+#endif
+
+
+#ifndef __NETWARE__
+/*
+ * Include standard definitions of operator new and delete.
+ */
+#ifdef __cplusplus
+#include <new>
+#endif
+#else
+/*
+ * Define placement versions of operator new and operator delete since
+ * we don't have <new> when building for Netware.
+ */
+#ifdef __cplusplus
+inline void *operator new(size_t, void *ptr) { return ptr; }
+inline void *operator new[](size_t, void *ptr) { return ptr; }
+inline void operator delete(void*, void*) { /* Do nothing */ }
+inline void operator delete[](void*, void*) { /* Do nothing */ }
+#endif
+#endif
+/* Length of decimal number represented by INT32. */
#define MY_INT32_NUM_DECIMAL_DIGITS 11
/* Length of decimal number represented by INT64. */
-
#define MY_INT64_NUM_DECIMAL_DIGITS 21
+/* Define some useful general macros (should be done after all headers). */
+#if !defined(max)
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#endif
+/*
+ Only Linux is known to need an explicit sync of the directory to make sure a
+ file creation/deletion/renaming in(from,to) this directory durable.
+*/
+#ifdef TARGET_OS_LINUX
+#define NEED_EXPLICIT_SYNC_DIR 1
+#endif
+
+#if !defined(__cplusplus) && !defined(bool)
+#define bool In_C_you_should_use_my_bool_instead()
+#endif
+
#ifndef HAVE_RINT
/**
All integers up to this number can be represented exactly as double precision
@@ -1411,4 +1586,17 @@ static inline double rint(double x)
}
#endif /* HAVE_RINT */
+/*
+ MYSQL_PLUGIN_IMPORT macro is used to export mysqld data
+ (i.e variables) for usage in storage engine loadable plugins.
+ Outside of Windows, it is dummy.
+*/
+#ifndef MYSQL_PLUGIN_IMPORT
+#if (defined(_WIN32) && defined(MYSQL_DYNAMIC_PLUGIN))
+#define MYSQL_PLUGIN_IMPORT __declspec(dllimport)
+#else
+#define MYSQL_PLUGIN_IMPORT
+#endif
+#endif
+
#endif /* my_global_h */
diff --git a/include/my_list.h b/include/my_list.h
index 4a1737d4c53..775b56587b8 100644
--- a/include/my_list.h
+++ b/include/my_list.h
@@ -33,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((unsigned char *) old,MYF(MY_FAE)); }
#ifdef __cplusplus
}
diff --git a/include/my_net.h b/include/my_net.h
index 47f31a6c3df..3af79ea3db5 100644
--- a/include/my_net.h
+++ b/include/my_net.h
@@ -43,7 +43,7 @@ C_MODE_START
#include <sys/ioctl.h>
#endif
-#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__NETWARE__)
+#if !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__NETWARE__)
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
@@ -52,13 +52,7 @@ C_MODE_START
#endif
#endif
-#if defined(__EMX__)
-#include <sys/ioctl.h>
-#define ioctlsocket(A,B,C) ioctl((A),(B),(void *)(C),sizeof(*(C)))
-#undef HAVE_FCNTL
-#endif /* defined(__EMX__) */
-
-#if defined(MSDOS) || defined(__WIN__)
+#if defined(__WIN__)
#define O_NONBLOCK 1 /* For emulation of fcntl() */
/*
diff --git a/include/my_no_pthread.h b/include/my_no_pthread.h
index e4ec23b66b8..1d08f51bb36 100644
--- a/include/my_no_pthread.h
+++ b/include/my_no_pthread.h
@@ -1,4 +1,6 @@
-/* Copyright (C) 2000 MySQL AB
+/*
+ Copyright (c) 2000, 2002, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
+ Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,7 +13,8 @@
You 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
+*/
#if !defined(_my_no_pthread_h) && !defined(THREAD)
@@ -25,11 +28,7 @@
even in non-threaded builds.
Case in point: 'mf_keycache.c'
*/
-#if defined(__WIN__) || defined(OS2)
-
-#elif defined(HAVE_UNIXWARE7_THREADS)
-/* #include <thread.h> Currently, not relevant. Enable if needed. */
-
+#if defined(__WIN__)
#else /* Normal threads */
#include <pthread.h>
@@ -51,4 +50,12 @@
#define rw_unlock(A)
#define rwlock_destroy(A)
+typedef int my_pthread_once_t;
+#define MY_PTHREAD_ONCE_INIT 0
+#define MY_PTHREAD_ONCE_DONE 1
+
+#define my_pthread_once(C,F) do { \
+ if (*(C) != MY_PTHREAD_ONCE_DONE) { F(); *(C)= MY_PTHREAD_ONCE_DONE; } \
+ } while(0)
+
#endif
diff --git a/include/my_nosys.h b/include/my_nosys.h
index 7e8c2aa8381..df5639b81e2 100644
--- a/include/my_nosys.h
+++ b/include/my_nosys.h
@@ -26,9 +26,6 @@ extern "C" {
#ifndef __MY_NOSYS__
#define __MY_NOSYS__
-#ifdef MSDOS
-#include <io.h> /* Get prototypes for read()... */
-#endif
#ifndef HAVE_STDLIB_H
#include <malloc.h>
#endif
@@ -38,8 +35,9 @@ extern "C" {
#undef my_seek
#define my_read(a,b,c,d) my_quick_read(a,b,c,d)
#define my_write(a,b,c,d) my_quick_write(a,b,c)
-extern uint my_quick_read(File Filedes,byte *Buffer,uint Count,myf myFlags);
-extern uint my_quick_write(File Filedes,const byte *Buffer,uint Count);
+extern size_t my_quick_read(File Filedes,uchar *Buffer,size_t Count,
+ myf myFlags);
+extern size_t my_quick_write(File Filedes,const uchar *Buffer,size_t Count);
#if !defined(SAFEMALLOC) && defined(USE_HALLOC)
#define my_malloc(a,b) halloc(a,1)
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 51202d6665e..87cdaaad0dd 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -1,4 +1,4 @@
-/* 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
@@ -18,7 +18,6 @@
#ifndef _my_pthread_h
#define _my_pthread_h
-#include <errno.h>
#ifndef ETIME
#define ETIME ETIMEDOUT /* For FreeBSD */
#endif
@@ -30,19 +29,8 @@ extern "C" {
#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
+#if defined(__WIN__)
typedef CRITICAL_SECTION pthread_mutex_t;
-#endif
typedef HANDLE pthread_t;
typedef struct thread_attr {
DWORD dwStackSize ;
@@ -74,15 +62,17 @@ typedef struct {
} pthread_cond_t;
+
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_self() win_pthread_self
#define pthread_handler_t EXTERNC void * __cdecl
typedef void * (__cdecl *pthread_handler)(void *);
-#endif
+
+typedef volatile LONG my_pthread_once_t;
+#define MY_PTHREAD_ONCE_INIT 0
+#define MY_PTHREAD_ONCE_INPROGRESS 1
+#define MY_PTHREAD_ONCE_DONE 2
/*
Struct and macros to be used in combination with the
@@ -129,21 +119,28 @@ 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);
+int my_pthread_once(my_pthread_once_t *once_control,void (*init_routine)(void));
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()
+#ifndef ETIMEDOUT
+#define ETIMEDOUT 145 /* Win32 might not have this */
#endif
-#define pthread_self() win_pthread_self
+#define getpid() GetCurrentThreadId()
#define HAVE_LOCALTIME_R 1
#define _REENTRANT 1
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
+/*
+ Windows has two ways to use thread local storage. The most efficient
+ is using __declspec(thread), but that does not work properly when
+ used in a .dll that is loaded at runtime, after program load. So for
+ libmysql.dll and libmysqld.dll we define USE_TLS in order to use the
+ TlsXxx() API instead, which works in all cases.
+*/
#ifdef USE_TLS /* For LIBMYSQL.DLL */
#undef SAFE_MUTEX /* This will cause conflicts */
#define pthread_key(T,V) DWORD V
@@ -166,15 +163,6 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(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) win_pthread_mutex_trylock((A))
@@ -182,7 +170,8 @@ extern int pthread_mutex_destroy (pthread_mutex_t *);
#define pthread_mutex_destroy(A) DeleteCriticalSection(A)
#define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B))
#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH)
-#endif /* OS2 */
+
+#define pthread_join(A,B) (WaitForSingleObject((A), INFINITE) != WAIT_OBJECT_0)
/* Dummy defines for easier code */
#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
@@ -194,68 +183,6 @@ extern int pthread_mutex_destroy (pthread_mutex_t *);
#define my_pthread_getprio(thread_id) pthread_dummy(0)
-#elif defined(HAVE_UNIXWARE7_THREADS)
-
-#include <thread.h>
-#include <synch.h>
-
-#ifndef _REENTRANT
-#define _REENTRANT
-#endif
-
-#define HAVE_NONPOSIX_SIGWAIT
-#define pthread_t thread_t
-#define pthread_cond_t cond_t
-#define pthread_mutex_t mutex_t
-#define pthread_key_t thread_key_t
-typedef int pthread_attr_t; /* Needed by Unixware 7.0.0 */
-
-#define pthread_key_create(A,B) thr_keycreate((A),(B))
-#define pthread_key_delete(A) thr_keydelete(A)
-
-#define pthread_handler_t EXTERNC void *
-#define pthread_key(T,V) pthread_key_t V
-
-void * my_pthread_getspecific_imp(pthread_key_t key);
-#define my_pthread_getspecific(A,B) ((A) my_pthread_getspecific_imp(B))
-#define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,V)
-
-#define pthread_setspecific(A,B) thr_setspecific(A,B)
-#define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,V)
-
-#define pthread_create(A,B,C,D) thr_create(NULL,65536L,(C),(D),THR_DETACHED,(A))
-#define pthread_cond_init(a,b) cond_init((a),USYNC_THREAD,NULL)
-#define pthread_cond_destroy(a) cond_destroy(a)
-#define pthread_cond_signal(a) cond_signal(a)
-#define pthread_cond_wait(a,b) cond_wait((a),(b))
-#define pthread_cond_timedwait(a,b,c) cond_timedwait((a),(b),(c))
-#define pthread_cond_broadcast(a) cond_broadcast(a)
-
-#define pthread_mutex_init(a,b) mutex_init((a),USYNC_THREAD,NULL)
-#define pthread_mutex_lock(a) mutex_lock(a)
-#define pthread_mutex_unlock(a) mutex_unlock(a)
-#define pthread_mutex_destroy(a) mutex_destroy(a)
-
-#define pthread_self() thr_self()
-#define pthread_exit(A) thr_exit(A)
-#define pthread_equal(A,B) (((A) == (B)) ? 1 : 0)
-#define pthread_kill(A,B) thr_kill((A),(B))
-#define HAVE_PTHREAD_KILL
-
-#define pthread_sigmask(A,B,C) thr_sigsetmask((A),(B),(C))
-
-extern int my_sigwait(const sigset_t *set,int *sig);
-
-#define pthread_detach_this_thread() pthread_dummy(0)
-
-#define pthread_attr_init(A) pthread_dummy(0)
-#define pthread_attr_destroy(A) pthread_dummy(0)
-#define pthread_attr_setscope(A,B) pthread_dummy(0)
-#define pthread_attr_setdetachstate(A,B) pthread_dummy(0)
-#define my_pthread_setprio(A,B) pthread_dummy (0)
-#define my_pthread_getprio(A) pthread_dummy (0)
-#define my_pthread_attr_setprio(A,B) pthread_dummy(0)
-
#else /* Normal threads */
#ifdef HAVE_rts_threads
@@ -276,9 +203,6 @@ extern int my_sigwait(const sigset_t *set,int *sig);
#ifdef HAVE_SYNCH_H
#include <synch.h>
#endif
-#if defined(__EMX__) && (!defined(EMX_PTHREAD_REV) || (EMX_PTHREAD_REV < 2))
-#error Requires at least rev 2 of EMX pthreads library.
-#endif
#ifdef __NETWARE__
void my_pthread_exit(void *status);
@@ -294,6 +218,10 @@ extern int my_pthread_getprio(pthread_t thread_id);
#define pthread_handler_t EXTERNC void *
typedef void *(* pthread_handler)(void *);
+#define my_pthread_once_t pthread_once_t
+#define MY_PTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
+#define my_pthread_once(C,F) pthread_once(C,F)
+
/* Test first for RTS or FSU threads */
#if defined(PTHREAD_SCOPE_GLOBAL) && !defined(PTHREAD_SCOPE_SYSTEM)
@@ -304,21 +232,6 @@ extern int 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
@@ -346,7 +259,7 @@ extern int my_pthread_cond_init(pthread_cond_t *mp,
#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)
+#if !defined(HAVE_SIGWAIT) && !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
@@ -358,13 +271,14 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
we want to make sure that no such flags are set.
*/
#if defined(HAVE_SIGACTION) && !defined(my_sigset)
-#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; int l_rc; \
+#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; \
+ IF_DBUG(int l_rc); \
DBUG_ASSERT((A) != 0); \
sigemptyset(&l_set); \
l_s.sa_handler = (B); \
l_s.sa_mask = l_set; \
l_s.sa_flags = 0; \
- l_rc= sigaction((A), &l_s, (struct sigaction *) NULL);\
+ IF_DBUG(l_rc=) sigaction((A), &l_s, NULL); \
DBUG_ASSERT(l_rc == 0); \
} while (0)
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
@@ -378,6 +292,8 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
#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))
+#elif defined(HAVE_PTHREAD_SETSCHEDPRIO)
+#define my_pthread_setprio(A,B) pthread_setschedprio((A),(B))
#else
extern void my_pthread_setprio(pthread_t thread_id,int prior);
#endif
@@ -403,15 +319,12 @@ extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
#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)
+#if !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 */
+#endif
#ifndef HAVE_LOCALTIME_R
struct tm *localtime_r(const time_t *clock, struct tm *res);
@@ -581,7 +494,8 @@ 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);
+ const struct timespec *abstime,
+ const char *file, uint line);
void safe_mutex_global_init(void);
void safe_mutex_end(FILE *file);
@@ -616,6 +530,39 @@ void safe_mutex_end(FILE *file);
#define safe_mutex_assert_not_owner(mp)
#endif /* SAFE_MUTEX */
+#if defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
+typedef struct st_my_pthread_fastmutex_t
+{
+ pthread_mutex_t mutex;
+ uint spins;
+ uint rng_state;
+} my_pthread_fastmutex_t;
+void fastmutex_global_init(void);
+
+int my_pthread_fastmutex_init(my_pthread_fastmutex_t *mp,
+ const pthread_mutexattr_t *attr);
+int my_pthread_fastmutex_lock(my_pthread_fastmutex_t *mp);
+
+#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) my_pthread_fastmutex_init((A),(B))
+#define pthread_mutex_lock(A) my_pthread_fastmutex_lock(A)
+#define pthread_mutex_unlock(A) pthread_mutex_unlock(&(A)->mutex)
+#define pthread_mutex_destroy(A) pthread_mutex_destroy(&(A)->mutex)
+#define pthread_cond_wait(A,B) pthread_cond_wait((A),&(B)->mutex)
+#define pthread_cond_timedwait(A,B,C) pthread_cond_timedwait((A),&(B)->mutex,(C))
+#define pthread_mutex_trylock(A) pthread_mutex_trylock(&(A)->mutex)
+#define pthread_mutex_t my_pthread_fastmutex_t
+#endif /* defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX) */
+
/* READ-WRITE thread locking */
#ifdef HAVE_BROKEN_RWLOCK /* For OpenUnix */
@@ -704,12 +651,14 @@ extern pthread_mutexattr_t my_errorcheck_mutexattr;
#define ESRCH 1
#endif
+typedef ulong my_thread_id;
+
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 my_thread_id my_thread_dbug_id(void);
extern int pthread_no_free(void *);
extern int pthread_dummy(int);
@@ -736,14 +685,14 @@ struct st_my_thread_var
pthread_mutex_t * volatile current_mutex;
pthread_cond_t * volatile current_cond;
pthread_t pthread_self;
- long id;
+ my_thread_id 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;
+ void *dbug;
char name[THREAD_NAME_SIZE+1];
#endif
};
@@ -765,33 +714,68 @@ extern uint my_thread_end_wait_time;
extern uint thd_lib_detected;
- /* statistics_xxx functions are for not essential statistic */
+/*
+ thread_safe_xxx functions are for critical statistic or counters.
+ The implementation is guaranteed to be thread safe, on all platforms.
+ Note that the calling code should *not* assume the counter is protected
+ by the mutex given, as the implementation of these helpers may change
+ to use atomic operations instead.
+*/
+
+/*
+ Warning:
+ When compiling without threads, this file is not included.
+ See the *other* declarations of thread_safe_xxx in include/my_global.h
+ Second warning:
+ See include/config-win.h, for yet another implementation.
+*/
+#ifdef THREAD
#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)))
+#endif
+
+#ifndef thread_safe_add
+#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 */
+#endif
+#endif
+
+/*
+ statistics_xxx functions are for non critical statistic,
+ maintained in global variables.
+ When compiling with SAFE_STATISTICS:
+ - race conditions can not occur.
+ - some locking occurs, which may cause performance degradation.
+
+ When compiling without SAFE_STATISTICS:
+ - race conditions can occur, making the result slightly inaccurate.
+ - the lock given is not honored.
+*/
#ifdef SAFE_STATISTICS
-#define statistic_increment(V,L) thread_safe_increment((V),(L))
-#define statistic_decrement(V,L) thread_safe_decrement((V),(L))
-#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
+#define statistic_increment(V,L) thread_safe_increment((V),(L))
+#define statistic_decrement(V,L) thread_safe_decrement((V),(L))
+#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
+#define statistic_sub(V,C,L) thread_safe_sub((V),(C),(L))
#else
#define statistic_decrement(V,L) (V)--
#define statistic_increment(V,L) (V)++
#define statistic_add(V,C,L) (V)+=(C)
+#define statistic_sub(V,C,L) (V)-=(C)
#endif /* SAFE_STATISTICS */
-#endif /* thread_safe_increment */
+
+/*
+ No locking needed, the counter is owned by the thread
+*/
+#define status_var_increment(V) (V)++
+#define status_var_decrement(V) (V)--
+#define status_var_add(V,C) (V)+=(C)
+#define status_var_sub(V,C) (V)-=(C)
#ifdef __cplusplus
}
diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h
new file mode 100644
index 00000000000..e7713f46fc3
--- /dev/null
+++ b/include/my_stacktrace.h
@@ -0,0 +1,68 @@
+/*
+ Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef _my_stacktrace_h_
+#define _my_stacktrace_h_
+
+#include <my_global.h>
+
+#ifdef TARGET_OS_LINUX
+#if defined (__x86_64__) || defined (__i386__) || \
+ (defined(__alpha__) && defined(__GNUC__))
+#define HAVE_STACKTRACE 1
+#endif
+#elif defined(__WIN__) || defined(HAVE_PRINTSTACK)
+#define HAVE_STACKTRACE 1
+#endif
+
+#if HAVE_BACKTRACE && (HAVE_BACKTRACE_SYMBOLS || HAVE_BACKTRACE_SYMBOLS_FD)
+#undef HAVE_STACKTRACE
+#define HAVE_STACKTRACE 1
+#endif
+
+#if !defined(__NETWARE__)
+#define HAVE_WRITE_CORE
+#endif
+
+#if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS && \
+ HAVE_CXXABI_H && HAVE_ABI_CXA_DEMANGLE && \
+ HAVE_WEAK_SYMBOL
+#define BACKTRACE_DEMANGLE 1
+#endif
+
+C_MODE_START
+
+#if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)
+void my_init_stacktrace();
+void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack);
+void my_safe_print_str(const char* val, int max_len);
+void my_write_core(int sig);
+#if BACKTRACE_DEMANGLE
+char *my_demangle(const char *mangled_name, int *status);
+#endif
+#ifdef __WIN__
+void my_set_exception_pointers(EXCEPTION_POINTERS *ep);
+#endif
+#endif
+
+#ifdef HAVE_WRITE_CORE
+void my_write_core(int sig);
+#endif
+
+C_MODE_END
+
+#endif /* _my_stacktrace_h_ */
diff --git a/include/my_sys.h b/include/my_sys.h
index 7d8c265e3a3..f6cd9dada99 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* 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
@@ -11,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _my_sys_h
#define _my_sys_h
@@ -25,6 +25,19 @@ typedef struct my_aio_result {
} my_aio_result;
#endif
+#ifdef HAVE_VALGRIND
+# include <valgrind/memcheck.h>
+# 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)
+# define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
+#else /* HAVE_VALGRIND */
+# define MEM_UNDEFINED(a,len) ((void) 0)
+# define MEM_NOACCESS(a,len) ((void) 0)
+# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
+# define MEM_CHECK_DEFINED(a,len) ((void) 0)
+#endif /* HAVE_VALGRIND */
+
#ifndef THREAD
extern int NEAR my_errno; /* Last error in mysys */
#else
@@ -39,9 +52,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#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 ERRMSGSIZE (SC_MAXWIDTH) /* Max length of a error message */
-#define NRERRBUFFS (2) /* Buffers for parameters */
-#define MY_FILE_ERROR ((uint) ~0)
+#define MY_FILE_ERROR ((size_t) -1)
/* General bitmaps for my_func's */
#define MY_FFNF 1 /* Fatal if file not found */
@@ -51,6 +62,7 @@ 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_SYNC_DIR 1024 /* my_create/delete/rename: sync directory */
#define MY_RAID 64 /* 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() */
@@ -74,6 +86,10 @@ extern int NEAR my_errno; /* Last error in mysys */
#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 MY_REMOVE_NONE 0 /* Params for modify_defaults_file */
+#define MY_REMOVE_OPTION 1
+#define MY_REMOVE_SECTION 2
+
#define ME_HIGHBYTE 8 /* Shift for colours */
#define ME_NOCUR 1 /* Don't use curses message */
#define ME_OLDWIN 2 /* Use old window */
@@ -86,6 +102,9 @@ extern int NEAR my_errno; /* Last error in mysys */
#define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */
#define ME_COLOUR2 ((2 << ME_HIGHBYTE))
#define ME_COLOUR3 ((3 << ME_HIGHBYTE))
+#define ME_FATALERROR 1024 /* Fatal statement error */
+#define ME_NO_WARNING_FOR_ERROR 2048 /* Don't push a warning for error */
+#define ME_NO_SP_HANDLER 4096 /* Don't call stored routine error handlers */
/* Bits in last argument to fn_format */
#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */
@@ -96,6 +115,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
@@ -132,8 +153,8 @@ extern int NEAR my_errno; /* Last error in mysys */
#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 my_strndup(A,B,C) _my_strndup((A),(B),__FILE__,__LINE__,C)
+#define TRASH(A,B) do { bfill(A, B, 0x8F); MEM_UNDEFINED(A, B); } while (0)
#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;
@@ -145,30 +166,39 @@ extern ulonglong sf_malloc_mem_limit;
#else
#define my_checkmalloc()
#undef TERMINATE
-#define TERMINATE(A) {}
+#define TERMINATE(A,B) {}
#define QUICK_SAFEMALLOC
#define NORMAL_SAFEMALLOC
-extern gptr my_malloc(size_t Size, myf MyFlags);
+extern void *my_malloc(size_t 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, size_t length, myf MyFlags);
+extern void *my_realloc(void *oldpoint, size_t Size, myf MyFlags);
+extern void my_no_flags_free(void *ptr);
+extern void *my_memdup(const void *from,size_t length,myf MyFlags);
extern char *my_strdup(const char *from,myf MyFlags);
-extern char *my_strdup_with_length(const char *from, size_t length,
- myf MyFlags);
+extern char *my_strndup(const char *from, size_t 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{MEM_CHECK_ADDRESSABLE(A,B);MEM_UNDEFINED(A,B);} while (0)
#endif
-#define my_strndup(A,B,C) my_strdup_with_length((A), (B), (C))
+
+#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)
+#else
+#define DEBUG_SYNC_C(_sync_point_name_)
+#endif /* defined(ENABLED_DEBUG_SYNC) */
#ifdef HAVE_LARGE_PAGES
extern uint my_get_large_page_size(void);
-extern gptr my_large_malloc(size_t size, myf my_flags);
-extern void my_large_free(gptr ptr, myf my_flags);
+extern uchar * my_large_malloc(size_t size, myf my_flags);
+extern void my_large_free(uchar * ptr, myf my_flags);
#else
#define my_get_large_page_size() (0)
#define my_large_malloc(A,B) my_malloc_lock((A),(B))
@@ -193,22 +223,6 @@ extern void my_large_free(gptr ptr, myf my_flags);
#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.h> /* errno is a define */
@@ -216,7 +230,6 @@ void __CDECL hfree(void *ptr);
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 */
@@ -224,6 +237,7 @@ 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;
+extern ulong my_thread_stack_size;
#ifdef HAVE_LARGE_PAGES
extern my_bool my_use_large_pages;
@@ -231,12 +245,13 @@ extern uint my_large_page_size;
#endif
/* charsets */
-extern CHARSET_INFO *default_charset_info;
-extern CHARSET_INFO *all_charsets[256];
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info;
+extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[256];
extern CHARSET_INFO compiled_charsets[];
/* statistics */
extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
+extern ulong my_file_total_opened;
extern uint mysys_usage_id;
extern my_bool my_init_done;
@@ -246,8 +261,8 @@ extern void (*my_sigtstp_cleanup)(void),
(*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,
+extern MYSQL_PLUGIN_IMPORT int NEAR my_umask; /* Default creation mask */
+extern int 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 */
@@ -270,7 +285,7 @@ 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 */
+ char * *wild; /* Pointer to wildcards */
} WF_PACK;
enum loglevel {
@@ -287,7 +302,14 @@ 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 */
@@ -296,7 +318,7 @@ typedef struct st_record_cache /* Used when cacheing records */
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;
+ uchar *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos;
#ifdef HAVE_AIOWAIT
int use_async_io;
my_aio_result aio_result;
@@ -312,7 +334,7 @@ enum file_type
struct st_my_file_info
{
- my_string name;
+ char * name;
enum file_type type;
#if defined(THREAD) && !defined(HAVE_PREAD)
pthread_mutex_t mutex;
@@ -323,7 +345,7 @@ extern struct st_my_file_info *my_file_info;
typedef struct st_dynamic_array
{
- char *buffer;
+ uchar *buffer;
uint elements,max_element;
uint alloc_increment;
uint size_of_element;
@@ -342,7 +364,7 @@ typedef struct st_my_tmpdir
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;
@@ -358,8 +380,8 @@ typedef struct st_io_cache_share
my_off_t pos_in_file;
/* If a synchronized write cache is the source of the data. */
struct st_io_cache *source_cache;
- byte *buffer; /* The read buffer. */
- byte *read_end; /* Behind last valid byte of buffer. */
+ 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. */
@@ -372,7 +394,7 @@ typedef struct st_io_cache_share
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.
@@ -381,26 +403,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
@@ -408,7 +430,7 @@ 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;
+ uchar **current_pos, **current_end;
#ifdef THREAD
/*
The lock is for append buffer used in SEQ_READ_APPEND cache
@@ -432,12 +454,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
@@ -472,9 +494,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
@@ -513,7 +535,7 @@ 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), (uint)(Count)))
+ (*(info)->write_function)((info),(uchar *)(Buffer),(Count)))
#define my_b_get(info) \
((info)->read_pos != (info)->read_end ?\
@@ -530,19 +552,19 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
(((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;
@@ -559,19 +581,19 @@ typedef int (*Process_option_func)(void *ctx, const char *group_name,
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);
@@ -584,39 +606,39 @@ 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(size_t uSize, const char *sFile,
+extern void *_mymalloc(size_t uSize,const char *sFile,
uint uLine, myf MyFlag);
-extern gptr _myrealloc(gptr pPtr, size_t 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, size_t 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 char *from, size_t length,
- const char *sFile, uint uLine,
- myf MyFlag);
+extern void *_myrealloc(void *pPtr,size_t uSize,const char *sFile,
+ uint uLine, myf MyFlag);
+extern void * my_multi_malloc _VARARGS((myf MyFlags, ...));
+extern void _myfree(void *pPtr,const char *sFile,uint uLine, myf MyFlag);
+extern int _sanity(const char *sFile, uint uLine);
+extern void *_my_memdup(const void *from, size_t length,
+ const char *sFile, uint uLine,myf MyFlag);
+extern char * _my_strdup(const char *from, const char *sFile, uint uLine,
+ myf MyFlag);
+extern char *_my_strndup(const char *from, size_t length,
+ const char *sFile, uint uLine,
+ myf MyFlag);
/* implemented in my_memmem.c */
extern void *my_memmem(const void *haystack, size_t haystacklen,
- const void *needle, size_t needlelen);
+ const void *needle, size_t needlelen);
#ifdef __WIN__
@@ -626,6 +648,7 @@ extern File my_sopen(const char *path, int oflag, int shflag, int pmode);
#define my_access access
#endif
extern int check_if_legal_filename(const char *path);
+extern int check_if_legal_tablename(const char *path);
#if defined(__WIN__) && defined(__NT__)
extern int nt_share_delete(const char *name,myf MyFlags);
@@ -635,15 +658,18 @@ extern int nt_share_delete(const char *name,myf MyFlags);
#endif
#ifndef TERMINATE
-extern void TERMINATE(FILE *file);
+extern void TERMINATE(FILE *file, uint flag);
#endif
extern void init_glob_errs(void);
extern void wait_for_free_space(const char *filename, int errors);
extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
+extern FILE *my_freopen(const char *path, const char *mode, FILE *stream);
extern int my_fclose(FILE *fd,myf MyFlags);
extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
extern int my_sync(File fd, myf my_flags);
+extern int my_sync_dir(const char *dir_name, myf my_flags);
+extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
extern int my_error _VARARGS((int nr,myf MyFlags, ...));
extern int my_printf_error _VARARGS((uint my_err, const char *format,
myf MyFlags, ...))
@@ -657,7 +683,7 @@ 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);
#ifndef THREAD
extern void dont_break(void);
@@ -667,141 +693,159 @@ extern void allow_break(void);
#define allow_break()
#endif
+#ifdef EXTRA_DEBUG
+void my_print_open_files(void);
+#else
+#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 normalize_dirname(char * 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 wild_compare(const char *str,const char *wildstr,
+ pbool str_is_pattern);
+extern WF_PACK *wf_comp(char * 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 my_bool array_append_string_unique(const char *str,
const char **array, size_t size);
-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,
+extern void get_date(char * to,int timeflag,time_t use_time);
+extern void soundex(CHARSET_INFO *, char * out_pntr, char * in_pntr,
+ pbool remove_garbage);
+extern int init_record_cache(RECORD_CACHE *info,size_t cachesize,File file,
+ size_t reclength,enum cache_type type,
pbool use_async_io);
-extern int read_cache_record(RECORD_CACHE *info,byte *to);
+extern int read_cache_record(RECORD_CACHE *info,uchar *to);
extern int end_record_cache(RECORD_CACHE *info);
extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos,
- const byte *record,uint length);
+ const uchar *record,size_t 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 sig_handler my_set_alarm_variable(int signo);
-extern void my_string_ptr_sort(void *base,uint items,size_s size);
+extern void my_string_ptr_sort(uchar *base,uint items,size_t size);
extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
- size_s size_of_element,uchar *buffer[]);
+ size_t size_of_element,uchar *buffer[]);
extern qsort_t my_qsort(void *base_ptr, size_t total_elems, size_t size,
qsort_cmp cmp);
extern qsort_t my_qsort2(void *base_ptr, size_t total_elems, size_t size,
qsort2_cmp cmp, void *cmp_argument);
-extern qsort2_cmp get_ptr_compare(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,
+extern qsort2_cmp get_ptr_compare(size_t);
+void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos);
+my_off_t my_get_ptr(uchar *ptr, size_t pack_length);
+extern int init_io_cache(IO_CACHE *info,File file,size_t cachesize,
enum cache_type type,my_off_t seek_offset,
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);
extern void setup_io_cache(IO_CACHE* info);
-extern int _my_b_read(IO_CACHE *info,byte *Buffer,uint Count);
+extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count);
#ifdef THREAD
-extern int _my_b_read_r(IO_CACHE *info,byte *Buffer,uint 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_async_read(IO_CACHE *info,uchar *Buffer,size_t 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, ...);
+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)
+#define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D CALLER_INFO)
+#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D ORIG_CALLER_INFO)
+#define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E CALLER_INFO)
+#define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E ORIG_CALLER_INFO)
+extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array,uint element_size,
+ void *init_buffer, uint init_alloc,
+ uint alloc_increment
+ CALLER_INFO_PROTO);
+/* init_dynamic_array() function is deprecated */
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);
+extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,uchar * element);
+extern uchar *alloc_dynamic(DYNAMIC_ARRAY *array);
+extern uchar *pop_dynamic(DYNAMIC_ARRAY*);
+extern my_bool set_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_index);
+extern my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements);
+extern void get_dynamic(DYNAMIC_ARRAY *array,uchar * element,uint array_index);
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);
+extern int get_index_dynamic(DYNAMIC_ARRAY *array, uchar * element);
#define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element)
#define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index))
-#define push_dynamic(A,B) insert_dynamic(A,B)
+#define push_dynamic(A,B) insert_dynamic((A),(B))
#define reset_dynamic(array) ((array)->elements= 0)
+#define sort_dynamic(A,cmp) my_qsort((A)->buffer, (A)->elements, (A)->size_of_element, (cmp))
extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
- 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);
+extern void *my_malloc_lock(size_t length,myf flags);
+extern void my_free_lock(void *ptr,myf flags);
#else
#define my_malloc_lock(A,B) my_malloc((A),(B))
#define my_free_lock(A,B) my_free((A),(B))
@@ -809,45 +853,55 @@ extern void my_free_lock(byte *ptr,myf flags);
#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(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 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 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 int get_defaults_options(int argc, char **argv,
char **defaults, char **extra_defaults,
char **group_suffix);
+extern int my_load_defaults(const char *conf_file, const char **groups,
+ int *argc, char ***argv, const char ***);
extern int load_defaults(const char *conf_file, const char **groups,
- int *argc, char ***argv);
+ 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);
+ Process_option_func func, void *func_ctx,
+ const char **default_directories);
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 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);
extern void my_sleep(ulong m_seconds);
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 ulonglong my_micro_time_and_time(time_t *time_arg);
+time_t my_time_possible_from_micro(ulonglong microtime);
+extern my_bool my_gethwaddr(uchar *to);
+extern int my_getncpus();
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
@@ -855,15 +909,24 @@ my_bool my_gethwaddr(uchar *to);
#ifndef MAP_NOSYNC
#define MAP_NOSYNC 0
#endif
+#ifndef MAP_NORESERVE
+#define MAP_NORESERVE 0 /* For irix and AIX */
+#endif
+#ifdef HAVE_MMAP64
+#define my_mmap(a,b,c,d,e,f) mmap64(a,b,c,d,e,f)
+#else
#define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f)
+#endif
#define my_munmap(a,b) munmap((a),(b))
#else
/* not a complete set of mmap() flags, but only those that nesessary */
#define PROT_READ 1
#define PROT_WRITE 2
+#define MAP_NORESERVE 0
#define MAP_SHARED 0x0001
+#define MAP_PRIVATE 0x0002
#define MAP_NOSYNC 0x0800
#define MAP_FAILED ((void *)-1)
#define MS_SYNC 0x0000
@@ -894,24 +957,29 @@ 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 *get_charset_by_csname(const char *cs_name,
uint cs_flags, myf my_flags);
-extern CHARSET_INFO *get_compatible_charset_with_ctype(CHARSET_INFO
- *original_cs);
+
+extern my_bool resolve_charset(const char *cs_name,
+ CHARSET_INFO *default_cs,
+ CHARSET_INFO **cs);
+extern my_bool resolve_collation(const char *cl_name,
+ CHARSET_INFO *default_cl,
+ CHARSET_INFO **cl);
extern void free_charsets(void);
extern char *get_charsets_dir(char *buf);
extern my_bool my_charset_same(CHARSET_INFO *cs1, 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);
+extern size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
+ char *to, size_t to_length,
+ const char *from, size_t length);
#ifdef __WIN__
#define BACKSLASH_MBTAIL
/* 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 size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
+ char *to, size_t to_length,
+ const char *from, size_t length);
extern void thd_increment_bytes_sent(ulong length);
extern void thd_increment_bytes_received(ulong length);
@@ -928,7 +996,7 @@ 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);
+char* my_cgets(char *string, size_t clen, size_t* plen);
#endif
#ifdef __NETWARE__
@@ -937,5 +1005,4 @@ void netware_reg_user(const char *ip, const char *user,
#endif
C_MODE_END
-#include "raid.h"
#endif /* _my_sys_h */
diff --git a/include/my_time.h b/include/my_time.h
index 49bb3eae9a8..ab6fe2f1503 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+/*
+ 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
@@ -11,7 +12,8 @@
You should have received a copy of the GNU 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 */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
/*
This is a private header of sql-common library, containing
@@ -43,14 +45,13 @@ typedef long my_time_t;
#define MY_TIME_T_MAX LONG_MAX
#define MY_TIME_T_MIN LONG_MIN
-
/* Time handling defaults */
#define TIMESTAMP_MAX_YEAR 2038
-#define YY_PART_YEAR 70
#define TIMESTAMP_MIN_YEAR (1900 + YY_PART_YEAR - 1)
#define TIMESTAMP_MAX_VALUE INT_MAX32
#define TIMESTAMP_MIN_VALUE 1
+/* two-digit years < this are 20..; >= this are 19.. */
#define YY_PART_YEAR 70
/*
@@ -84,6 +85,8 @@ typedef long my_time_t;
#define TIME_MAX_SECOND 59
#define TIME_MAX_VALUE (TIME_MAX_HOUR*10000 + TIME_MAX_MINUTE*100 + \
TIME_MAX_SECOND)
+#define TIME_MAX_VALUE_SECONDS (TIME_MAX_HOUR * 3600L + \
+ TIME_MAX_MINUTE * 60L + TIME_MAX_SECOND)
my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
ulong flags, int *was_cut);
@@ -123,7 +126,7 @@ void my_init_time(void);
TRUE The MYSQL_TIME value is definitely out of range
*/
-static inline bool validate_timestamp_range(const MYSQL_TIME *t)
+static inline my_bool validate_timestamp_range(const MYSQL_TIME *t)
{
if ((t->year > TIMESTAMP_MAX_YEAR || t->year < TIMESTAMP_MIN_YEAR) ||
(t->year == TIMESTAMP_MAX_YEAR && (t->month > 1 || t->day > 19)) ||
@@ -154,6 +157,31 @@ int my_date_to_str(const MYSQL_TIME *l_time, char *to);
int my_datetime_to_str(const MYSQL_TIME *l_time, char *to);
int my_TIME_to_str(const MYSQL_TIME *l_time, char *to);
+/*
+ Available interval types used in any statement.
+
+ 'interval_type' must be sorted so that simple intervals comes first,
+ ie year, quarter, month, week, day, hour, etc. The order based on
+ interval size is also important and the intervals should be kept in a
+ large to smaller order. (get_interval_value() depends on this)
+
+ Note: If you change the order of elements in this enum you should fix
+ order of elements in 'interval_type_to_name' and 'interval_names'
+ arrays
+
+ See also interval_type_to_name, get_interval_value, interval_names
+*/
+
+enum interval_type
+{
+ INTERVAL_YEAR, INTERVAL_QUARTER, INTERVAL_MONTH, INTERVAL_WEEK, INTERVAL_DAY,
+ INTERVAL_HOUR, INTERVAL_MINUTE, INTERVAL_SECOND, INTERVAL_MICROSECOND,
+ INTERVAL_YEAR_MONTH, INTERVAL_DAY_HOUR, INTERVAL_DAY_MINUTE,
+ INTERVAL_DAY_SECOND, INTERVAL_HOUR_MINUTE, INTERVAL_HOUR_SECOND,
+ INTERVAL_MINUTE_SECOND, INTERVAL_DAY_MICROSECOND, INTERVAL_HOUR_MICROSECOND,
+ INTERVAL_MINUTE_MICROSECOND, INTERVAL_SECOND_MICROSECOND, INTERVAL_LAST
+};
+
C_MODE_END
#endif /* _my_time_h_ */
diff --git a/include/my_tree.h b/include/my_tree.h
index be55cc4231e..24bbdd54019 100644
--- a/include/my_tree.h
+++ b/include/my_tree.h
@@ -25,10 +25,10 @@ extern "C" {
#define MAX_TREE_HEIGHT 64
#define ELEMENT_KEY(tree,element)\
-(tree->offset_to_key ? (void*)((byte*) element+tree->offset_to_key) :\
+(tree->offset_to_key ? (void*)((uchar*) element+tree->offset_to_key) :\
*((void**) (element+1)))
-#define tree_set_pointer(element,ptr) *((byte **) (element+1))=((byte*) (ptr))
+#define tree_set_pointer(element,ptr) *((uchar **) (element+1))=((uchar*) (ptr))
#define TREE_NO_DUPS 1
@@ -39,19 +39,11 @@ typedef int (*tree_walk_action)(void *,element_count,void *);
typedef enum { free_init, free_free, free_end } TREE_FREE;
typedef void (*tree_element_free)(void*, TREE_FREE, void *);
-#ifdef MSDOS
-typedef struct st_tree_element {
- struct st_tree_element *left,*right;
- unsigned long count;
- uchar colour; /* black is marked as 1 */
-} TREE_ELEMENT;
-#else
typedef struct st_tree_element {
struct st_tree_element *left,*right;
uint32 count:31,
colour:1; /* black is marked as 1 */
} TREE_ELEMENT;
-#endif /* MSDOS */
#define ELEMENT_CHILD(element, offs) (*(TREE_ELEMENT**)((char*)element + offs))
diff --git a/include/my_trie.h b/include/my_trie.h
new file mode 100644
index 00000000000..72dd485af04
--- /dev/null
+++ b/include/my_trie.h
@@ -0,0 +1,141 @@
+/* Copyright (C) 2005 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef _trie_h
+#define _trie_h
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct st_trie_node
+{
+ uint16 leaf; /* Depth from root node if match, 0 else */
+ uchar c; /* Label on this edge */
+ struct st_trie_node *next; /* Next label */
+ struct st_trie_node *links; /* Array of edges leaving this node */
+ struct st_trie_node *fail; /* AC failure function */
+} TRIE_NODE;
+
+typedef struct st_trie
+{
+ TRIE_NODE root;
+ MEM_ROOT mem_root;
+ CHARSET_INFO *charset;
+ uint32 nnodes;
+ uint32 nwords;
+} TRIE;
+
+typedef struct st_ac_trie_state
+{
+ TRIE *trie;
+ TRIE_NODE *node;
+} AC_TRIE_STATE;
+
+extern TRIE *trie_init (TRIE *trie, CHARSET_INFO *charset);
+extern void trie_free (TRIE *trie);
+extern my_bool trie_insert (TRIE *trie, const uchar *key, uint keylen);
+extern my_bool ac_trie_prepare (TRIE *trie);
+extern void ac_trie_init (TRIE *trie, AC_TRIE_STATE *state);
+
+
+/* `trie_goto' is internal function and shouldn't be used. */
+
+static inline TRIE_NODE *trie_goto (TRIE_NODE *root, TRIE_NODE *node, uchar c)
+{
+ TRIE_NODE *next;
+ DBUG_ENTER("trie_goto");
+ for (next= node->links; next; next= next->next)
+ if (next->c == c)
+ DBUG_RETURN(next);
+ if (root == node)
+ DBUG_RETURN(root);
+ DBUG_RETURN(NULL);
+}
+
+
+/*
+ SYNOPSIS
+ int ac_trie_next (AC_TRIE_STATE *state, uchar *c);
+ state - valid pointer to `AC_TRIE_STATE'
+ c - character to lookup
+
+ DESCRIPTION
+ Implementation of search using Aho-Corasick automaton.
+ Performs char-by-char search.
+
+ RETURN VALUE
+ `ac_trie_next' returns length of matched word or 0.
+*/
+
+static inline int ac_trie_next (AC_TRIE_STATE *state, uchar *c)
+{
+ TRIE_NODE *root, *node;
+ DBUG_ENTER("ac_trie_next");
+ DBUG_ASSERT(state && c);
+ root= &state->trie->root;
+ node= state->node;
+ while (! (state->node= trie_goto(root, node, *c)))
+ node= node->fail;
+ DBUG_RETURN(state->node->leaf);
+}
+
+
+/*
+ SYNOPSIS
+ my_bool trie_search (TRIE *trie, const uchar *key, uint keylen);
+ trie - valid pointer to `TRIE'
+ key - valid pointer to key to insert
+ keylen - non-0 key length
+
+ DESCRIPTION
+ Performs key lookup in trie.
+
+ RETURN VALUE
+ `trie_search' returns `true' if key is in `trie'. Otherwise,
+ `false' is returned.
+
+ NOTES
+ Consecutive search here is "best by test". arrays are very short, so
+ binary search or hashing would add too much complexity that would
+ overweight speed gain. Especially because compiler can optimize simple
+ consecutive loop better (tested)
+*/
+
+static inline my_bool trie_search (TRIE *trie, const uchar *key, uint keylen)
+{
+ TRIE_NODE *node;
+ uint k;
+ DBUG_ENTER("trie_search");
+ DBUG_ASSERT(trie && key && keylen);
+ node= &trie->root;
+
+ for (k= 0; k < keylen; k++)
+ {
+ uchar p;
+ if (! (node= node->links))
+ DBUG_RETURN(FALSE);
+ p= key[k];
+ while (p != node->c)
+ if (! (node= node->next))
+ DBUG_RETURN(FALSE);
+ }
+
+ DBUG_RETURN(node->leaf > 0);
+}
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/my_uctype.h b/include/my_uctype.h
new file mode 100644
index 00000000000..9aaf478810c
--- /dev/null
+++ b/include/my_uctype.h
@@ -0,0 +1,1479 @@
+/* Copyright (C) 2006 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/*
+ Unicode ctype data
+ Generated from UnicodeData-5.0.0d9.txt
+*/
+static unsigned char uctype_page00[256]=
+{
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16,
+ 16, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
+ 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 16, 16, 16, 16, 16,
+ 16, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
+ 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 16, 16, 16, 16, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32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03[256]=
+{
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 0, 0, 0, 0, 16, 16, 0, 0, 0, 0, 2, 2, 2, 2, 16, 0,
+ 0, 0, 0, 0, 16, 16, 1, 16, 1, 1, 1, 0, 1, 0, 1, 1,
+ 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0,
+ 2, 2, 1, 1, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
+ 2, 2, 2, 2, 1, 2, 16, 1, 2, 1, 1, 2, 2, 1, 1, 1
+};
+
+static unsigned char uctype_page04[256]=
+{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 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+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 0, 16, 16, 0, 0, 0, 0, 0,
+ 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 16, 18,
+ 16, 18, 18, 16, 18, 18, 16, 18, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0,
+ 2, 2, 2, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static unsigned char uctype_page06[256]=
+{
+ 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16,
+ 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 16, 0, 0, 16, 16,
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 2, 2,
+ 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 2, 2, 16, 16, 16, 16, 2, 0, 0, 0, 0, 0
+};
+
+static unsigned char uctype_page09[256]=
+{
+ 0, 18, 18, 18, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 18, 2, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0,
+ 2, 18, 18, 18, 18, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 18, 18, 16, 16, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2,
+ 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2,
+ 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2,
+ 2, 0, 2, 0, 0, 0, 2, 2, 2, 2, 0, 0, 18, 2, 18, 18,
+ 18, 18, 18, 18, 18, 0, 0, 18, 18, 0, 0, 18, 18, 18, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 2, 2, 0, 2,
+ 2, 2, 18, 18, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 2, 2, 16, 16, 20, 20, 20, 20, 20, 20, 16, 0, 0, 0, 0, 0
+};
+
+static unsigned char uctype_page0A[256]=
+{
+ 0, 18, 18, 18, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 2,
+ 2, 0, 0, 2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0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static unsigned char uctype_page0F[256]=
+{
+ 2, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 18, 18, 16, 16, 16, 16, 16, 16,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 16, 18, 16, 18, 16, 18, 16, 16, 16, 16, 18, 18,
+ 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0,
+ 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 16, 18, 18, 2, 2, 2, 2, 0, 0, 0, 0,
+ 18, 18, 18, 18, 18, 18, 18, 18, 0, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 16, 16,
+ 16, 16, 16, 16, 16, 16, 18, 16, 16, 16, 16, 16, 16, 0, 0, 16,
+ 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static unsigned char uctype_page10[256]=
+{
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 0, 2, 2, 2, 2, 2, 0, 2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+ 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 0, 2, 2, 1, 1, 1, 1, 1, 16, 2, 16,
+ 16, 16, 2, 2, 2, 0, 2, 2, 1, 1, 1, 1, 1, 16, 16, 16,
+ 2, 2, 2, 2, 0, 0, 2, 2, 1, 1, 1, 1, 0, 16, 16, 16,
+ 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 16, 16, 16,
+ 0, 0, 2, 2, 2, 0, 2, 2, 1, 1, 1, 1, 1, 16, 16, 0
+};
+
+static unsigned char uctype_page20[256]=
+{
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 32, 32, 32, 32, 32,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 8, 8, 32, 32, 32, 32, 32, 8,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 8,
+ 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 32, 32, 32, 32, 32, 32,
+ 20, 2, 0, 0, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 2,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 0,
+ 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static unsigned char uctype_page21[256]=
+{
+ 16, 16, 1, 16, 16, 16, 16, 1, 16, 16, 2, 1, 1, 1, 2, 2,
+ 1, 1, 1, 2, 16, 1, 16, 16, 16, 1, 1, 1, 1, 1, 16, 16,
+ 16, 16, 16, 16, 1, 16, 1, 16, 1, 16, 1, 1, 1, 1, 16, 2,
+ 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 16, 16, 2, 2, 1, 1,
+ 16, 16, 16, 16, 16, 1, 2, 2, 2, 2, 16, 16, 16, 16, 2, 0,
+ 0, 0, 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
+};
+
+static unsigned char uctype_page23[256]=
+{
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static unsigned char uctype_page24[256]=
+{
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
+};
+
+static unsigned char uctype_page26[256]=
+{
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static unsigned char uctype_page27[256]=
+{
+ 0, 16, 16, 16, 16, 0, 16, 16, 16, 16, 0, 0, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 0, 16,
+ 16, 16, 16, 0, 0, 0, 16, 0, 16, 16, 16, 16, 16, 16, 16, 0,
+ 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 16, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
+};
+
+static unsigned char uctype_page2B[256]=
+{
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0,
+ 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+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0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static unsigned char uctype_page2F[256]=
+{
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0
+};
+
+static unsigned char uctype_page30[256]=
+{
+ 8, 16, 16, 16, 16, 2, 2, 7, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 7, 7, 7, 7, 7, 7, 7, 7, 7, 18, 18, 18, 18, 18, 18,
+ 16, 2, 2, 2, 2, 2, 16, 16, 7, 7, 7, 2, 2, 16, 16, 16,
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 0, 0, 18, 18, 16, 16, 2, 2, 2,
+ 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
+};
+
+static unsigned char uctype_page32[256]=
+{
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0
+};
+
+static unsigned char uctype_page4D[256]=
+{
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 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 2, 2, 2, 2, 0, 0, 32
+};
+
+static unsigned char uctype_pageFF[256]=
+{
+ 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16,
+ 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16,
+ 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0,
+ 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2,
+ 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 2, 0, 0, 0,
+ 16, 16, 16, 16, 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 32, 32, 16, 16, 0, 0
+};
+
+MY_UNI_CTYPE my_uni_ctype[256]={
+ {0,uctype_page00},
+ {0,uctype_page01},
+ {0,uctype_page02},
+ {0,uctype_page03},
+ {0,uctype_page04},
+ {0,uctype_page05},
+ {0,uctype_page06},
+ {0,uctype_page07},
+ {0,NULL},
+ {0,uctype_page09},
+ {0,uctype_page0A},
+ {0,uctype_page0B},
+ {0,uctype_page0C},
+ {0,uctype_page0D},
+ {0,uctype_page0E},
+ {0,uctype_page0F},
+ {0,uctype_page10},
+ {0,uctype_page11},
+ {0,uctype_page12},
+ {0,uctype_page13},
+ {0,uctype_page14},
+ {2,NULL},
+ {0,uctype_page16},
+ {0,uctype_page17},
+ {0,uctype_page18},
+ {0,uctype_page19},
+ {0,uctype_page1A},
+ {0,uctype_page1B},
+ {0,NULL},
+ {0,uctype_page1D},
+ {0,uctype_page1E},
+ {0,uctype_page1F},
+ {0,uctype_page20},
+ {0,uctype_page21},
+ {16,NULL},
+ {0,uctype_page23},
+ {0,uctype_page24},
+ {16,NULL},
+ {0,uctype_page26},
+ {0,uctype_page27},
+ {16,NULL},
+ {16,NULL},
+ {16,NULL},
+ {0,uctype_page2B},
+ {0,uctype_page2C},
+ {0,uctype_page2D},
+ {0,uctype_page2E},
+ {0,uctype_page2F},
+ {0,uctype_page30},
+ {0,uctype_page31},
+ {0,uctype_page32},
+ {16,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {0,uctype_page4D},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {0,uctype_page9F},
+ {2,NULL},
+ {2,NULL},
+ {2,NULL},
+ {2,NULL},
+ {0,uctype_pageA4},
+ {0,NULL},
+ {0,NULL},
+ {0,uctype_pageA7},
+ {0,uctype_pageA8},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {3,NULL},
+ {0,uctype_pageD7},
+ {0,uctype_pageD8},
+ {0,NULL},
+ {0,NULL},
+ {0,uctype_pageDB},
+ {0,uctype_pageDC},
+ {0,NULL},
+ {0,NULL},
+ {0,uctype_pageDF},
+ {0,uctype_pageE0},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,NULL},
+ {0,uctype_pageF8},
+ {2,NULL},
+ {0,uctype_pageFA},
+ {0,uctype_pageFB},
+ {2,NULL},
+ {0,uctype_pageFD},
+ {0,uctype_pageFE},
+ {0,uctype_pageFF}
+};
+
+
diff --git a/include/my_user.h b/include/my_user.h
index 0c86d0f90f6..44eebf1551d 100644
--- a/include/my_user.h
+++ b/include/my_user.h
@@ -25,9 +25,9 @@
C_MODE_START
-void parse_user(const char *user_id_str, uint user_id_len,
- char *user_name_str, uint *user_name_len,
- char *host_name_str, uint *host_name_len);
+void parse_user(const char *user_id_str, size_t user_id_len,
+ char *user_name_str, size_t *user_name_len,
+ char *host_name_str, size_t *host_name_len);
C_MODE_END
diff --git a/include/my_vle.h b/include/my_vle.h
new file mode 100644
index 00000000000..c09f82229c4
--- /dev/null
+++ b/include/my_vle.h
@@ -0,0 +1,38 @@
+/* Copyright (C) 2005 MySQL AB
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef VLE_H
+#define VLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "my_global.h"
+
+/*
+ The size (in bytes) required to store the object ITEM, which can be
+ either an expression or a type (since sizeof() is used on the item).
+*/
+#define my_vle_sizeof(ITEM) (((sizeof(ITEM) * CHAR_BIT) + 6) / 7)
+
+uchar *my_vle_encode(uchar *vle, size_t max, ulong value);
+uchar const *my_vle_decode(ulong *value_ptr, uchar const *vle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/my_xml.h b/include/my_xml.h
index 0bec16ad3e8..6a453ee90be 100644
--- a/include/my_xml.h
+++ b/include/my_xml.h
@@ -25,8 +25,31 @@ extern "C" {
#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];
char attr[128];
char *attrend;
@@ -34,27 +57,27 @@ typedef struct xml_stack_st
const char *cur;
const char *end;
void *user_data;
- int (*enter)(struct xml_stack_st *st,const char *val, uint len);
- int (*value)(struct xml_stack_st *st,const char *val, uint len);
- int (*leave_xml)(struct xml_stack_st *st,const char *val, uint len);
+ 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, uint len);
+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 *,
- uint len));
+ size_t len));
void my_xml_set_enter_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
const char *,
- uint len));
+ size_t len));
void my_xml_set_leave_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
const char *,
- uint len));
+ size_t len));
void my_xml_set_user_data(MY_XML_PARSER *st, void *);
-uint my_xml_error_pos(MY_XML_PARSER *st);
+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);
diff --git a/include/myisam.h b/include/myisam.h
index 1966063c6a5..92e6699896a 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/*
+ 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
@@ -11,7 +12,8 @@
You should have received a copy of the GNU 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 */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
/* This file should be included when using myisam_funktions */
@@ -30,25 +32,42 @@ extern "C" {
#ifndef _keycache_h
#include "keycache.h"
#endif
+#include <mysql/plugin.h>
#include "my_compare.h"
/*
There is a hard limit for the maximum number of keys as there are only
8 bits in the index file header for the number of keys in a table.
This means that 0..255 keys can exist for a table. The idea of
- MI_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on
+ HA_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on
a MyISAM table for which one has more keys than MyISAM is normally
compiled for. If you don't have this, you will get a core dump when
running myisamchk compiled for 128 keys on a table with 255 keys.
*/
-#define MI_MAX_POSSIBLE_KEY 255 /* For myisam_chk */
-#if MAX_INDEXES > MI_MAX_POSSIBLE_KEY
-#define MI_MAX_KEY MI_MAX_POSSIBLE_KEY /* Max allowed keys */
+
+#define HA_MAX_POSSIBLE_KEY 255 /* For myisamchk */
+/*
+ The following defines can be increased if necessary.
+ But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH.
+*/
+
+#define HA_MAX_KEY_LENGTH 1000 /* Max length in bytes */
+#define HA_MAX_KEY_SEG 16 /* Max segments for key */
+
+#define HA_MAX_POSSIBLE_KEY_BUFF (HA_MAX_KEY_LENGTH + 24+ 6+6)
+#define HA_MAX_KEY_BUFF (HA_MAX_KEY_LENGTH+HA_MAX_KEY_SEG*6+8+8)
+
+/*
+ Limit max keys according to HA_MAX_POSSIBLE_KEY
+*/
+
+#if MAX_INDEXES > HA_MAX_POSSIBLE_KEY
+#define MI_MAX_KEY HA_MAX_POSSIBLE_KEY /* Max allowed keys */
#else
#define MI_MAX_KEY MAX_INDEXES /* Max allowed keys */
#endif
-#define MI_MAX_POSSIBLE_KEY_BUFF (1024+6+6) /* For myisam_chk */
+#define MI_MAX_POSSIBLE_KEY_BUFF HA_MAX_POSSIBLE_KEY_BUFF
/*
The following defines can be increased if necessary.
But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and MI_MAX_KEY_LENGTH.
@@ -60,16 +79,12 @@ extern "C" {
#define MI_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */
#define MI_NAME_IEXT ".MYI"
#define MI_NAME_DEXT ".MYD"
-/* Max extra space to use when sorting keys */
-#define MI_MAX_TEMP_LENGTH 2*1024L*1024L*1024L
/* Possible values for myisam_block_size (must be power of 2) */
#define MI_KEY_BLOCK_LENGTH 1024 /* default key block length */
#define MI_MIN_KEY_BLOCK_LENGTH 1024 /* Min key block length */
#define MI_MAX_KEY_BLOCK_LENGTH 16384
-#define mi_portable_sizeof_char_ptr 8
-
/*
In the following macros '_keyno_' is 0 .. keys-1.
If there can be more keys than bits in the key_map, the highest bit
@@ -157,8 +172,6 @@ typedef struct st_mi_isaminfo /* Struct from h_info */
uint reflength;
ulong record_offset;
ulong *rec_per_key; /* for sql optimizing */
- uint raid_type,raid_chunks;
- ulong raid_chunksize;
} MI_ISAMINFO;
@@ -170,8 +183,6 @@ typedef struct st_mi_create_info
ulonglong auto_increment;
ulonglong data_file_length;
ulonglong key_file_length;
- uint raid_type,raid_chunks;
- ulong raid_chunksize;
uint old_options;
uint8 language;
my_bool with_auto_increment;
@@ -194,10 +205,12 @@ typedef struct st_mi_keydef /* Key definition with open & info */
uint16 keylength; /* Tot length of keyparts (auto) */
uint16 minlength; /* min length of (packed) key (auto) */
uint16 maxlength; /* max length of (packed) key (auto) */
- uint16 block_size; /* block_size (auto) */
+ uint16 block_size_index; /* block_size (auto) */
uint32 version; /* For concurrent read/write */
+ uint32 ftkey_nr; /* full-text index number */
HA_KEYSEG *seg,*end;
+ struct st_mysql_ftparser *parser; /* Fulltext [pre]parser */
int (*bin_search)(struct st_myisam_info *info,struct st_mi_keydef *keyinfo,
uchar *page,uchar *key,
uint key_len,uint comp_flag,uchar * *ret_pos,
@@ -228,7 +241,7 @@ typedef struct st_mi_decode_tree /* Decode huff-table */
{
uint16 *table;
uint quick_table_bits;
- byte *intervalls;
+ uchar *intervalls;
} MI_DECODE_TREE;
@@ -257,10 +270,8 @@ typedef struct st_columndef /* column information */
#endif
} MI_COLUMNDEF;
-/* invalidator function reference for Query Cache */
-typedef void (* invalidator_by_filename)(const char * filename);
-extern my_string myisam_log_filename; /* Name of logfile */
+extern char * myisam_log_filename; /* Name of logfile */
extern ulong myisam_block_size;
extern ulong myisam_concurrent_insert;
extern my_bool myisam_flush,myisam_delay_key_write,myisam_single_user;
@@ -276,27 +287,26 @@ extern pthread_mutex_t THR_LOCK_myisam_mmap;
/* Prototypes for myisam-functions */
extern int mi_close(struct st_myisam_info *file);
-extern int mi_delete(struct st_myisam_info *file,const byte *buff);
+extern int mi_delete(struct st_myisam_info *file,const uchar *buff);
extern struct st_myisam_info *mi_open(const char *name,int mode,
uint wait_if_locked);
extern int mi_panic(enum ha_panic_function function);
-extern int mi_rfirst(struct st_myisam_info *file,byte *buf,int inx);
-extern int mi_rkey(struct st_myisam_info *file,byte *buf,int inx,
- const byte *key,
- uint key_len, enum ha_rkey_function search_flag);
-extern int mi_rlast(struct st_myisam_info *file,byte *buf,int inx);
-extern int mi_rnext(struct st_myisam_info *file,byte *buf,int inx);
-extern int mi_rnext_same(struct st_myisam_info *info, byte *buf);
-extern int mi_rprev(struct st_myisam_info *file,byte *buf,int inx);
-extern int mi_rrnd(struct st_myisam_info *file,byte *buf, my_off_t pos);
+extern int mi_rfirst(struct st_myisam_info *file,uchar *buf,int inx);
+extern int mi_rkey(MI_INFO *info, uchar *buf, int inx, const uchar *key,
+ key_part_map keypart_map, enum ha_rkey_function search_flag);
+extern int mi_rlast(struct st_myisam_info *file,uchar *buf,int inx);
+extern int mi_rnext(struct st_myisam_info *file,uchar *buf,int inx);
+extern int mi_rnext_same(struct st_myisam_info *info, uchar *buf);
+extern int mi_rprev(struct st_myisam_info *file,uchar *buf,int inx);
+extern int mi_rrnd(struct st_myisam_info *file,uchar *buf, my_off_t pos);
extern int mi_scan_init(struct st_myisam_info *file);
-extern int mi_scan(struct st_myisam_info *file,byte *buf);
-extern int mi_rsame(struct st_myisam_info *file,byte *record,int inx);
-extern int mi_rsame_with_pos(struct st_myisam_info *file,byte *record,
+extern int mi_scan(struct st_myisam_info *file,uchar *buf);
+extern int mi_rsame(struct st_myisam_info *file,uchar *record,int inx);
+extern int mi_rsame_with_pos(struct st_myisam_info *file,uchar *record,
int inx, my_off_t pos);
-extern int mi_update(struct st_myisam_info *file,const byte *old,
- byte *new_record);
-extern int mi_write(struct st_myisam_info *file,byte *buff);
+extern int mi_update(struct st_myisam_info *file,const uchar *old,
+ uchar *new_record);
+extern int mi_write(struct st_myisam_info *file,uchar *buff);
extern my_off_t mi_position(struct st_myisam_info *file);
extern int mi_status(struct st_myisam_info *info, MI_ISAMINFO *x, uint flag);
extern int mi_lock_database(struct st_myisam_info *file,int lock_type);
@@ -309,17 +319,17 @@ extern int mi_rename(const char *from, const char *to);
extern int mi_extra(struct st_myisam_info *file,
enum ha_extra_function function,
void *extra_arg);
-extern ha_rows mi_records_in_range(struct st_myisam_info *info,int inx,
+extern int mi_reset(struct st_myisam_info *file);
+extern ha_rows mi_records_in_range(MI_INFO *info, int inx,
key_range *min_key, key_range *max_key);
extern int mi_log(int activate_log);
extern int mi_is_changed(struct st_myisam_info *info);
extern int mi_delete_all_rows(struct st_myisam_info *info);
-extern ulong _mi_calc_blob_length(uint length , const byte *pos);
+extern ulong _mi_calc_blob_length(uint length , const uchar *pos);
extern uint mi_get_pointer_length(ulonglong file_length, uint def);
#define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for mmap file */
-
-/* this is used to pass to mysql_myisamchk_table -- by Sasha Pachev */
+/* this is used to pass to mysql_myisamchk_table */
#define MYISAMCHK_REPAIR 1 /* equivalent to myisamchk -r */
#define MYISAMCHK_VERIFY 2 /* Verify, run repair if failure */
@@ -419,7 +429,8 @@ typedef struct st_mi_check_param
my_off_t keydata,totaldata,key_blocks,start_check_pos;
ha_rows total_records,total_deleted;
ha_checksum record_checksum,glob_crc;
- ulong use_buffers,read_buffer_length,write_buffer_length,
+ ulonglong use_buffers;
+ ulong read_buffer_length,write_buffer_length,
sort_buffer_length,sort_key_blocks;
uint out_flag,warning_printed,error_printed,verbose;
uint opt_sort_key,total_files,max_level;
@@ -440,12 +451,16 @@ typedef struct st_mi_check_param
ulonglong unique_count[MI_MAX_KEY_SEG+1];
ulonglong notnull_count[MI_MAX_KEY_SEG+1];
- ha_checksum key_crc[MI_MAX_POSSIBLE_KEY];
- ulong rec_per_key_part[MI_MAX_KEY_SEG*MI_MAX_POSSIBLE_KEY];
+ ha_checksum key_crc[HA_MAX_POSSIBLE_KEY];
+ ulong rec_per_key_part[MI_MAX_KEY_SEG*HA_MAX_POSSIBLE_KEY];
void *thd;
const char *db_name, *table_name;
const char *op_name;
enum_mi_stats_method stats_method;
+#ifdef THREAD
+ pthread_mutex_t print_msg_mutex;
+ my_bool need_print_msg_lock;
+#endif
} MI_CHECK;
typedef struct st_sort_ft_buf
@@ -464,7 +479,7 @@ typedef struct st_sort_info
enum data_file_type new_data_file_type;
MI_INFO *info;
MI_CHECK *param;
- char *buff;
+ uchar *buff;
SORT_KEY_BLOCKS *key_block,*key_block_end;
SORT_FT_BUF *ft_buf;
/* sync things */
@@ -483,8 +498,8 @@ int chk_size(MI_CHECK *param, MI_INFO *info);
int chk_key(MI_CHECK *param, MI_INFO *info);
int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend);
int mi_repair(MI_CHECK *param, register MI_INFO *info,
- my_string name, int rep_quick);
-int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name);
+ char * name, int rep_quick);
+int mi_sort_index(MI_CHECK *param, register MI_INFO *info, char * name);
int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
const char * name, int rep_quick);
int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
@@ -503,7 +518,7 @@ void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part,
ulonglong records);
int filecopy(MI_CHECK *param, File to,File from,my_off_t start,
my_off_t length, const char *type);
-int movepoint(MI_INFO *info,byte *record,my_off_t oldpos,
+int movepoint(MI_INFO *info,uchar *record,my_off_t oldpos,
my_off_t newpos, uint prot_key);
int write_data_suffix(SORT_INFO *sort_info, my_bool fix_datafile);
int test_if_almost_full(MI_INFO *info);
diff --git a/include/myisammrg.h b/include/myisammrg.h
index e18d4aef126..15a8b8aae76 100644
--- a/include/myisammrg.h
+++ b/include/myisammrg.h
@@ -1,4 +1,6 @@
-/* Copyright (C) 2000 MySQL AB
+/*
+ Copyright (c) 2000-2002, 2004, 2006-2008 MySQL AB, 2009 Sun Microsystems, Inc.
+ Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,7 +13,8 @@
You 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 should be included when using merge_isam_funktions */
@@ -47,6 +50,7 @@ typedef struct st_mymerge_info /* Struct from h_info */
ulonglong deleted; /* Deleted records in database */
ulonglong recpos; /* Pos for last used record */
ulonglong data_file_length;
+ ulonglong dupp_key_pos; /* Offset of the Duplicate key in the merge table */
uint reclength; /* Recordlength */
int errkey; /* With key was dupplicated on err */
uint options; /* HA_OPTION_... used */
@@ -69,38 +73,51 @@ typedef struct st_myrg_info
uint merge_insert_method;
uint tables,options,reclength,keys;
my_bool cache_in_use;
+ /* If MERGE children attached to parent. See top comment in ha_myisammrg.cc */
+ my_bool children_attached;
LIST open_list;
QUEUE by_key;
ulong *rec_per_key_part; /* for sql optimizing */
+ pthread_mutex_t mutex;
} MYRG_INFO;
/* Prototypes for merge-functions */
extern int myrg_close(MYRG_INFO *file);
-extern int myrg_delete(MYRG_INFO *file,const byte *buff);
+extern int myrg_delete(MYRG_INFO *file,const uchar *buff);
extern MYRG_INFO *myrg_open(const char *name,int mode,int wait_if_locked);
+extern MYRG_INFO *myrg_parent_open(const char *parent_name,
+ int (*callback)(void*, const char*),
+ void *callback_param);
+extern int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
+ MI_INFO *(*callback)(void*),
+ void *callback_param,
+ my_bool *need_compat_check);
+extern int myrg_detach_children(MYRG_INFO *m_info);
extern int myrg_panic(enum ha_panic_function function);
-extern int myrg_rfirst(MYRG_INFO *file,byte *buf,int inx);
-extern int myrg_rlast(MYRG_INFO *file,byte *buf,int inx);
-extern int myrg_rnext(MYRG_INFO *file,byte *buf,int inx);
-extern int myrg_rprev(MYRG_INFO *file,byte *buf,int inx);
-extern int myrg_rnext_same(MYRG_INFO *file,byte *buf);
-extern int myrg_rkey(MYRG_INFO *file,byte *buf,int inx,const byte *key,
- uint key_len, enum ha_rkey_function search_flag);
-extern int myrg_rrnd(MYRG_INFO *file,byte *buf,ulonglong pos);
-extern int myrg_rsame(MYRG_INFO *file,byte *record,int inx);
-extern int myrg_update(MYRG_INFO *file,const byte *old,byte *new_rec);
-extern int myrg_write(MYRG_INFO *info,byte *rec);
+extern int myrg_rfirst(MYRG_INFO *file,uchar *buf,int inx);
+extern int myrg_rlast(MYRG_INFO *file,uchar *buf,int inx);
+extern int myrg_rnext(MYRG_INFO *file,uchar *buf,int inx);
+extern int myrg_rprev(MYRG_INFO *file,uchar *buf,int inx);
+extern int myrg_rnext_same(MYRG_INFO *file,uchar *buf);
+extern int myrg_rkey(MYRG_INFO *info,uchar *buf,int inx, const uchar *key,
+ key_part_map keypart_map, enum ha_rkey_function search_flag);
+extern int myrg_rrnd(MYRG_INFO *file,uchar *buf,ulonglong pos);
+extern int myrg_rsame(MYRG_INFO *file,uchar *record,int inx);
+extern int myrg_update(MYRG_INFO *file,const uchar *old,uchar *new_rec);
+extern int myrg_write(MYRG_INFO *info,uchar *rec);
extern int myrg_status(MYRG_INFO *file,MYMERGE_INFO *x,int flag);
extern int myrg_lock_database(MYRG_INFO *file,int lock_type);
extern int myrg_create(const char *name, const char **table_names,
uint insert_method, my_bool fix_names);
extern int myrg_extra(MYRG_INFO *file,enum ha_extra_function function,
void *extra_arg);
+extern int myrg_reset(MYRG_INFO *info);
extern void myrg_extrafunc(MYRG_INFO *info,invalidator_by_filename inv);
-extern ha_rows myrg_records_in_range(MYRG_INFO *info,int inx,
+extern ha_rows myrg_records_in_range(MYRG_INFO *info, int inx,
key_range *min_key, key_range *max_key);
+extern ha_rows myrg_records(MYRG_INFO *info);
extern ulonglong myrg_position(MYRG_INFO *info);
#ifdef __cplusplus
diff --git a/include/mysql.h b/include/mysql.h
index 95130b9fc36..da477278e70 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000-2007 MySQL AB, 2009 Sun Microsystems, Inc.
- Use is subject to license terms.
+/*
+ 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
@@ -12,7 +12,8 @@
You should have received a copy of the GNU 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 */
+ 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
@@ -45,9 +46,11 @@ extern "C" {
#endif
#ifndef _global_h /* If not standard header */
+#ifndef MYSQL_ABI_CHECK
#include <sys/types.h>
+#endif
#ifdef __LCC__
-#include <winsock.h> /* For windows */
+#include <winsock2.h> /* For windows */
#endif
typedef char my_bool;
#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)
@@ -58,7 +61,6 @@ typedef char my_bool;
#else
#define STDCALL __stdcall
#endif
-typedef char * gptr;
#ifndef my_socket_defined
#ifdef __WIN__
@@ -72,7 +74,6 @@ typedef int my_socket;
#include "mysql_version.h"
#include "mysql_com.h"
#include "mysql_time.h"
-#include "typelib.h"
#include "my_list.h" /* for LISTs used in 'MYSQL' and 'MYSQL_STMT' */
@@ -89,9 +90,9 @@ extern char *mysql_unix_port;
#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(t) ((t) <= MYSQL_TYPE_INT24 || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_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)
+#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR)
#define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING)
@@ -116,6 +117,7 @@ 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 */
@@ -131,6 +133,8 @@ 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 */
@@ -148,12 +152,13 @@ typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */
typedef struct embedded_query_result EMBEDDED_QUERY_RESULT;
typedef struct st_mysql_data {
- my_ulonglong rows;
- unsigned int fields;
MYSQL_ROWS *data;
+ struct embedded_query_result *embedded_info;
MEM_ROOT alloc;
+ my_ulonglong rows;
+ unsigned int fields;
/* extra info for embedded library */
- struct embedded_query_result *embedded_info;
+ void *extension;
} MYSQL_DATA;
enum mysql_option
@@ -216,11 +221,13 @@ struct st_mysql_options {
void (*local_infile_end)(void *);
int (*local_infile_error)(void *, char *, unsigned int);
void *local_infile_userdata;
+ void *extension;
};
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
@@ -256,9 +263,9 @@ 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;
@@ -305,27 +312,28 @@ typedef struct st_mysql
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;
+ void *extension;
} MYSQL_RES;
#define MAX_MYSQL_MANAGER_ERR 256
@@ -345,21 +353,23 @@ typedef struct st_mysql_res {
typedef struct st_mysql_manager
{
NET net;
- char *host,*user,*passwd;
+ char *host, *user, *passwd;
+ char *net_buf, *net_buf_pos, *net_data_end;
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;
+ my_bool free_me;
+ my_bool eof;
char last_error[MAX_MYSQL_MANAGER_ERR];
+ void *extension;
} MYSQL_MANAGER;
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)
@@ -374,6 +384,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
@@ -530,7 +541,7 @@ 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);
void STDCALL mysql_free_result(MYSQL_RES *result);
void STDCALL mysql_data_seek(MYSQL_RES *result,
my_ulonglong offset);
@@ -551,16 +562,6 @@ 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);
@@ -662,23 +663,24 @@ 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 */
+ unsigned char *row_ptr; /* for the current data position */
+ void (*store_param_func)(NET *net, struct st_mysql_bind *param);
+ void (*fetch_result)(struct st_mysql_bind *, MYSQL_FIELD *,
+ unsigned char **row);
+ void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *,
+ unsigned char **row);
/* output buffer length, must be set when fetching str/binary */
unsigned long buffer_length;
- unsigned 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 */
+ 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 (*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);
+ void *extension;
} MYSQL_BIND;
@@ -693,15 +695,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,
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 */
@@ -727,6 +729,7 @@ typedef struct st_mysql_stmt
metadata fields when doing mysql_stmt_store_result.
*/
my_bool update_max_length;
+ void *extension;
} MYSQL_STMT;
enum enum_stmt_attr_type
@@ -757,9 +760,9 @@ 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,
+ const unsigned char *header,
unsigned long header_length,
- const char *arg,
+ const unsigned char *arg,
unsigned long arg_length,
my_bool skip_check,
MYSQL_STMT *stmt);
@@ -852,10 +855,10 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
*/
#define simple_command(mysql, command, arg, length, skip_check) \
- (*(mysql)->methods->advanced_command)(mysql, command, NullS, \
+ (*(mysql)->methods->advanced_command)(mysql, command, 0, \
0, arg, length, skip_check, NULL)
#define stmt_command(mysql, command, arg, length, stmt) \
- (*(mysql)->methods->advanced_command)(mysql, command, NullS, \
+ (*(mysql)->methods->advanced_command)(mysql, command, 0, \
0, arg, length, 1, stmt)
#ifdef __NETWARE__
diff --git a/include/mysql.h.pp b/include/mysql.h.pp
new file mode 100644
index 00000000000..ceb4b2d591c
--- /dev/null
+++ b/include/mysql.h.pp
@@ -0,0 +1,674 @@
+typedef char my_bool;
+typedef int my_socket;
+#include "mysql_version.h"
+#include "mysql_com.h"
+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_END
+};
+struct st_vio;
+typedef struct st_vio Vio;
+typedef struct st_net {
+ Vio *vio;
+ unsigned char *buff,*buff_end,*write_pos,*read_pos;
+ my_socket fd;
+ 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 unused0;
+ my_bool unused;
+ my_bool compress;
+ my_bool unused1;
+ unsigned char *query_cache_query;
+ unsigned int last_errno;
+ unsigned char error;
+ my_bool unused2;
+ my_bool return_errno;
+ char last_error[512];
+ char sqlstate[5 +1];
+ void *extension;
+} NET;
+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
+};
+enum mysql_enum_shutdown_level {
+ SHUTDOWN_DEFAULT = 0,
+ SHUTDOWN_WAIT_CONNECTIONS= (unsigned char)(1 << 0),
+ SHUTDOWN_WAIT_TRANSACTIONS= (unsigned char)(1 << 1),
+ SHUTDOWN_WAIT_UPDATES= (unsigned char)(1 << 3),
+ SHUTDOWN_WAIT_ALL_BUFFERS= ((unsigned char)(1 << 3) << 1),
+ SHUTDOWN_WAIT_CRITICAL_BUFFERS= ((unsigned char)(1 << 3) << 1) + 1,
+ KILL_QUERY= 254,
+ KILL_CONNECTION= 255
+};
+enum enum_cursor_type
+{
+ CURSOR_TYPE_NO_CURSOR= 0,
+ CURSOR_TYPE_READ_ONLY= 1,
+ CURSOR_TYPE_FOR_UPDATE= 2,
+ CURSOR_TYPE_SCROLLABLE= 4
+};
+enum enum_mysql_set_option
+{
+ MYSQL_OPTION_MULTI_STATEMENTS_ON,
+ MYSQL_OPTION_MULTI_STATEMENTS_OFF
+};
+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 clear_buffer);
+my_bool net_realloc(NET *net, size_t length);
+my_bool net_flush(NET *net);
+my_bool my_net_write(NET *net,const unsigned char *packet, size_t len);
+my_bool net_write_command(NET *net,unsigned char command,
+ const unsigned char *header, size_t head_len,
+ const unsigned char *packet, size_t len);
+int net_real_write(NET *net,const unsigned char *packet, size_t len);
+unsigned long my_net_read(NET *net);
+struct sockaddr;
+int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen,
+ unsigned int timeout);
+struct rand_struct {
+ unsigned long seed1,seed2,max_value;
+ double max_value_dbl;
+};
+enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT,
+ DECIMAL_RESULT};
+typedef struct st_udf_args
+{
+ unsigned int arg_count;
+ enum Item_result *arg_type;
+ char **args;
+ unsigned long *lengths;
+ char *maybe_null;
+ char **attributes;
+ unsigned long *attribute_lengths;
+ void *extension;
+} UDF_ARGS;
+typedef struct st_udf_init
+{
+ my_bool maybe_null;
+ unsigned int decimals;
+ unsigned long max_length;
+ char *ptr;
+ my_bool const_item;
+ void *extension;
+} UDF_INIT;
+void randominit(struct rand_struct *, unsigned long seed1,
+ unsigned long seed2);
+double my_rnd(struct rand_struct *);
+void create_random_string(char *to, unsigned int length, struct rand_struct *rand_st);
+void hash_password(unsigned long *to, const char *password, unsigned int password_len);
+void make_scrambled_password_323(char *to, const char *password);
+void scramble_323(char *to, const char *message, const char *password);
+my_bool check_scramble_323(const char *, 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,
+ 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);
+char *octet2hex(char *to, const char *str, unsigned int len);
+char *get_tty_password(const char *opt_message);
+const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
+my_bool my_thread_init(void);
+void my_thread_end(void);
+#include "mysql_time.h"
+enum enum_mysql_timestamp_type
+{
+ MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
+ MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
+};
+typedef struct st_mysql_time
+{
+ unsigned int year, month, day, hour, minute, second;
+ unsigned long second_part;
+ my_bool neg;
+ enum enum_mysql_timestamp_type time_type;
+} MYSQL_TIME;
+#include "my_list.h"
+typedef struct st_list {
+ struct st_list *prev,*next;
+ void *data;
+} LIST;
+typedef int (*list_walk_action)(void *,void *);
+extern LIST *list_add(LIST *root,LIST *element);
+extern LIST *list_delete(LIST *root,LIST *element);
+extern LIST *list_cons(void *data,LIST *root);
+extern LIST *list_reverse(LIST *root);
+extern void list_free(LIST *root,unsigned int free_data);
+extern unsigned int list_length(LIST *);
+extern int list_walk(LIST *,list_walk_action action,unsigned char * argument);
+extern unsigned int mysql_port;
+extern char *mysql_unix_port;
+typedef struct st_mysql_field {
+ char *name;
+ char *org_name;
+ char *table;
+ char *org_table;
+ char *db;
+ char *catalog;
+ char *def;
+ unsigned long length;
+ unsigned long max_length;
+ unsigned int name_length;
+ unsigned int org_name_length;
+ unsigned int table_length;
+ unsigned int org_table_length;
+ unsigned int db_length;
+ unsigned int catalog_length;
+ unsigned int def_length;
+ unsigned int flags;
+ unsigned int decimals;
+ unsigned int charsetnr;
+ enum enum_field_types type;
+ void *extension;
+} MYSQL_FIELD;
+typedef char **MYSQL_ROW;
+typedef unsigned int MYSQL_FIELD_OFFSET;
+typedef unsigned long long my_ulonglong;
+#include "typelib.h"
+#include "my_alloc.h"
+typedef struct st_used_mem
+{
+ struct st_used_mem *next;
+ unsigned int left;
+ unsigned int size;
+} USED_MEM;
+typedef struct st_mem_root
+{
+ USED_MEM *free;
+ USED_MEM *used;
+ USED_MEM *pre_alloc;
+ size_t min_malloc;
+ size_t block_size;
+ unsigned int block_num;
+ unsigned int first_block_usage;
+ void (*error_handler)(void);
+} MEM_ROOT;
+typedef struct st_typelib {
+ unsigned int count;
+ const char *name;
+ const char **type_names;
+ unsigned int *type_lengths;
+} TYPELIB;
+extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
+extern int find_type_or_exit(const char *x, TYPELIB *typelib,
+ const char *option);
+extern int find_type(char *x, const TYPELIB *typelib, unsigned int full_name);
+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;
+typedef struct st_mysql_rows {
+ struct st_mysql_rows *next;
+ MYSQL_ROW data;
+ unsigned long length;
+} MYSQL_ROWS;
+typedef MYSQL_ROWS *MYSQL_ROW_OFFSET;
+#include "my_alloc.h"
+typedef struct embedded_query_result EMBEDDED_QUERY_RESULT;
+typedef struct st_mysql_data {
+ MYSQL_ROWS *data;
+ struct embedded_query_result *embedded_info;
+ MEM_ROOT alloc;
+ my_ulonglong rows;
+ unsigned int fields;
+ void *extension;
+} MYSQL_DATA;
+enum mysql_option
+{
+ MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE,
+ MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,
+ MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE,
+ MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT,
+ MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT,
+ MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION,
+ MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH,
+ MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT,
+ MYSQL_OPT_SSL_VERIFY_SERVER_CERT
+};
+struct st_mysql_options {
+ unsigned int connect_timeout, read_timeout, write_timeout;
+ unsigned int port, protocol;
+ unsigned long client_flag;
+ char *host,*user,*password,*unix_socket,*db;
+ struct st_dynamic_array *init_commands;
+ char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name;
+ char *ssl_key;
+ char *ssl_cert;
+ char *ssl_ca;
+ char *ssl_capath;
+ char *ssl_cipher;
+ char *shared_memory_base_name;
+ unsigned long max_allowed_packet;
+ my_bool use_ssl;
+ my_bool compress,named_pipe;
+ my_bool rpl_probe;
+ my_bool rpl_parse;
+ my_bool no_master_reads;
+ my_bool separate_thread;
+ enum mysql_option methods_to_use;
+ char *client_ip;
+ my_bool secure_auth;
+ my_bool report_data_truncation;
+ int (*local_infile_init)(void **, const char *, void *);
+ int (*local_infile_read)(void *, char *, unsigned int);
+ void (*local_infile_end)(void *);
+ int (*local_infile_error)(void *, char *, unsigned int);
+ void *local_infile_userdata;
+ void *extension;
+};
+enum mysql_status
+{
+ MYSQL_STATUS_READY, MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT,
+ MYSQL_STATUS_STATEMENT_GET_RESULT
+};
+enum mysql_protocol_type
+{
+ MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
+ MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
+};
+enum mysql_rpl_type
+{
+ MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN
+};
+typedef struct character_set
+{
+ unsigned int number;
+ unsigned int state;
+ const char *csname;
+ const char *name;
+ const char *comment;
+ const char *dir;
+ unsigned int mbminlen;
+ unsigned int mbmaxlen;
+} MY_CHARSET_INFO;
+struct st_mysql_methods;
+struct st_mysql_stmt;
+typedef struct st_mysql
+{
+ NET net;
+ unsigned char *connector_fd;
+ 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;
+ my_ulonglong affected_rows;
+ my_ulonglong insert_id;
+ my_ulonglong extra_info;
+ unsigned long thread_id;
+ unsigned long packet_length;
+ unsigned int port;
+ unsigned long client_flag,server_capabilities;
+ unsigned int protocol_version;
+ unsigned int field_count;
+ unsigned int server_status;
+ unsigned int server_language;
+ unsigned int warning_count;
+ struct st_mysql_options options;
+ enum mysql_status status;
+ my_bool free_me;
+ my_bool reconnect;
+ char scramble[20 +1];
+ my_bool rpl_pivot;
+ struct st_mysql* master, *next_slave;
+ struct st_mysql* last_used_slave;
+ struct st_mysql* last_used_con;
+ LIST *stmts;
+ const struct st_mysql_methods *methods;
+ void *thd;
+ my_bool *unbuffered_fetch_owner;
+ char *info_buffer;
+ void *extension;
+} MYSQL;
+typedef struct st_mysql_res {
+ my_ulonglong row_count;
+ MYSQL_FIELD *fields;
+ MYSQL_DATA *data;
+ MYSQL_ROWS *data_cursor;
+ unsigned long *lengths;
+ MYSQL *handle;
+ const struct st_mysql_methods *methods;
+ MYSQL_ROW row;
+ MYSQL_ROW current_row;
+ MEM_ROOT field_alloc;
+ unsigned int field_count, current_field;
+ my_bool eof;
+ my_bool unbuffered_fetch_cancelled;
+ void *extension;
+} MYSQL_RES;
+typedef struct st_mysql_manager
+{
+ NET net;
+ char *host, *user, *passwd;
+ char *net_buf, *net_buf_pos, *net_data_end;
+ unsigned int port;
+ int cmd_status;
+ int last_errno;
+ int net_buf_size;
+ my_bool free_me;
+ my_bool eof;
+ char last_error[256];
+ void *extension;
+} MYSQL_MANAGER;
+typedef struct st_mysql_parameters
+{
+ unsigned long *p_max_allowed_packet;
+ unsigned long *p_net_buffer_length;
+ void *extension;
+} MYSQL_PARAMETERS;
+int mysql_server_init(int argc, char **argv, char **groups);
+void mysql_server_end(void);
+MYSQL_PARAMETERS * mysql_get_parameters(void);
+my_bool mysql_thread_init(void);
+void mysql_thread_end(void);
+my_ulonglong mysql_num_rows(MYSQL_RES *res);
+unsigned int mysql_num_fields(MYSQL_RES *res);
+my_bool mysql_eof(MYSQL_RES *res);
+MYSQL_FIELD * mysql_fetch_field_direct(MYSQL_RES *res,
+ unsigned int fieldnr);
+MYSQL_FIELD * mysql_fetch_fields(MYSQL_RES *res);
+MYSQL_ROW_OFFSET mysql_row_tell(MYSQL_RES *res);
+MYSQL_FIELD_OFFSET mysql_field_tell(MYSQL_RES *res);
+unsigned int mysql_field_count(MYSQL *mysql);
+my_ulonglong mysql_affected_rows(MYSQL *mysql);
+my_ulonglong mysql_insert_id(MYSQL *mysql);
+unsigned int mysql_errno(MYSQL *mysql);
+const char * mysql_error(MYSQL *mysql);
+const char * mysql_sqlstate(MYSQL *mysql);
+unsigned int mysql_warning_count(MYSQL *mysql);
+const char * mysql_info(MYSQL *mysql);
+unsigned long mysql_thread_id(MYSQL *mysql);
+const char * mysql_character_set_name(MYSQL *mysql);
+int mysql_set_character_set(MYSQL *mysql, const char *csname);
+MYSQL * mysql_init(MYSQL *mysql);
+my_bool mysql_ssl_set(MYSQL *mysql, const char *key,
+ const char *cert, const char *ca,
+ const char *capath, const char *cipher);
+const char * mysql_get_ssl_cipher(MYSQL *mysql);
+my_bool mysql_change_user(MYSQL *mysql, const char *user,
+ const char *passwd, const char *db);
+MYSQL * mysql_real_connect(MYSQL *mysql, const char *host,
+ const char *user,
+ const char *passwd,
+ const char *db,
+ unsigned int port,
+ const char *unix_socket,
+ unsigned long clientflag);
+int mysql_select_db(MYSQL *mysql, const char *db);
+int mysql_query(MYSQL *mysql, const char *q);
+int mysql_send_query(MYSQL *mysql, const char *q,
+ unsigned long length);
+int mysql_real_query(MYSQL *mysql, const char *q,
+ unsigned long length);
+MYSQL_RES * mysql_store_result(MYSQL *mysql);
+MYSQL_RES * mysql_use_result(MYSQL *mysql);
+my_bool mysql_master_query(MYSQL *mysql, const char *q,
+ unsigned long length);
+my_bool mysql_master_send_query(MYSQL *mysql, const char *q,
+ unsigned long length);
+my_bool mysql_slave_query(MYSQL *mysql, const char *q,
+ unsigned long length);
+my_bool mysql_slave_send_query(MYSQL *mysql, const char *q,
+ unsigned long length);
+void mysql_get_character_set_info(MYSQL *mysql,
+ MY_CHARSET_INFO *charset);
+void
+mysql_set_local_infile_handler(MYSQL *mysql,
+ int (*local_infile_init)(void **, const char *,
+ void *),
+ int (*local_infile_read)(void *, char *,
+ unsigned int),
+ void (*local_infile_end)(void *),
+ int (*local_infile_error)(void *, char*,
+ unsigned int),
+ void *);
+void
+mysql_set_local_infile_default(MYSQL *mysql);
+void mysql_enable_rpl_parse(MYSQL* mysql);
+void mysql_disable_rpl_parse(MYSQL* mysql);
+int mysql_rpl_parse_enabled(MYSQL* mysql);
+void mysql_enable_reads_from_master(MYSQL* mysql);
+void mysql_disable_reads_from_master(MYSQL* mysql);
+my_bool mysql_reads_from_master_enabled(MYSQL* mysql);
+enum mysql_rpl_type mysql_rpl_query_type(const char* q, int len);
+my_bool mysql_rpl_probe(MYSQL* mysql);
+int mysql_set_master(MYSQL* mysql, const char* host,
+ unsigned int port,
+ const char* user,
+ const char* passwd);
+int mysql_add_slave(MYSQL* mysql, const char* host,
+ unsigned int port,
+ const char* user,
+ const char* passwd);
+int mysql_shutdown(MYSQL *mysql,
+ enum mysql_enum_shutdown_level
+ shutdown_level);
+int mysql_dump_debug_info(MYSQL *mysql);
+int mysql_refresh(MYSQL *mysql,
+ unsigned int refresh_options);
+int mysql_kill(MYSQL *mysql,unsigned long pid);
+int mysql_set_server_option(MYSQL *mysql,
+ enum enum_mysql_set_option
+ option);
+int mysql_ping(MYSQL *mysql);
+const char * mysql_stat(MYSQL *mysql);
+const char * mysql_get_server_info(MYSQL *mysql);
+const char * mysql_get_client_info(void);
+unsigned long mysql_get_client_version(void);
+const char * mysql_get_host_info(MYSQL *mysql);
+unsigned long mysql_get_server_version(MYSQL *mysql);
+unsigned int mysql_get_proto_info(MYSQL *mysql);
+MYSQL_RES * mysql_list_dbs(MYSQL *mysql,const char *wild);
+MYSQL_RES * mysql_list_tables(MYSQL *mysql,const char *wild);
+MYSQL_RES * mysql_list_processes(MYSQL *mysql);
+int mysql_options(MYSQL *mysql,enum mysql_option option,
+ const void *arg);
+void mysql_free_result(MYSQL_RES *result);
+void mysql_data_seek(MYSQL_RES *result,
+ my_ulonglong offset);
+MYSQL_ROW_OFFSET mysql_row_seek(MYSQL_RES *result,
+ MYSQL_ROW_OFFSET offset);
+MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES *result,
+ MYSQL_FIELD_OFFSET offset);
+MYSQL_ROW mysql_fetch_row(MYSQL_RES *result);
+unsigned long * mysql_fetch_lengths(MYSQL_RES *result);
+MYSQL_FIELD * mysql_fetch_field(MYSQL_RES *result);
+MYSQL_RES * mysql_list_fields(MYSQL *mysql, const char *table,
+ const char *wild);
+unsigned long mysql_escape_string(char *to,const char *from,
+ unsigned long from_length);
+unsigned long mysql_hex_string(char *to,const char *from,
+ unsigned long from_length);
+unsigned long mysql_real_escape_string(MYSQL *mysql,
+ char *to,const char *from,
+ unsigned long length);
+void mysql_debug(const char *debug);
+void myodbc_remove_escape(MYSQL *mysql,char *name);
+unsigned int mysql_thread_safe(void);
+my_bool mysql_embedded(void);
+MYSQL_MANAGER* mysql_manager_init(MYSQL_MANAGER* con);
+MYSQL_MANAGER* mysql_manager_connect(MYSQL_MANAGER* con,
+ const char* host,
+ const char* user,
+ const char* passwd,
+ unsigned int port);
+void mysql_manager_close(MYSQL_MANAGER* con);
+int mysql_manager_command(MYSQL_MANAGER* con,
+ const char* cmd, int cmd_len);
+int mysql_manager_fetch_line(MYSQL_MANAGER* con,
+ char* res_buf,
+ int res_buf_size);
+my_bool mysql_read_query_result(MYSQL *mysql);
+enum enum_mysql_stmt_state
+{
+ MYSQL_STMT_INIT_DONE= 1, MYSQL_STMT_PREPARE_DONE, MYSQL_STMT_EXECUTE_DONE,
+ MYSQL_STMT_FETCH_DONE
+};
+typedef struct st_mysql_bind
+{
+ unsigned long *length;
+ my_bool *is_null;
+ void *buffer;
+ my_bool *error;
+ unsigned char *row_ptr;
+ 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);
+ unsigned long buffer_length;
+ unsigned long offset;
+ unsigned long length_value;
+ unsigned int param_number;
+ unsigned int pack_length;
+ enum enum_field_types buffer_type;
+ my_bool error_value;
+ my_bool is_unsigned;
+ my_bool long_data_used;
+ my_bool is_null_value;
+ void *extension;
+} MYSQL_BIND;
+typedef struct st_mysql_stmt
+{
+ MEM_ROOT mem_root;
+ LIST list;
+ MYSQL *mysql;
+ MYSQL_BIND *params;
+ MYSQL_BIND *bind;
+ MYSQL_FIELD *fields;
+ MYSQL_DATA result;
+ MYSQL_ROWS *data_cursor;
+ int (*read_row_func)(struct st_mysql_stmt *stmt,
+ unsigned char **row);
+ my_ulonglong affected_rows;
+ my_ulonglong insert_id;
+ unsigned long stmt_id;
+ unsigned long flags;
+ unsigned long prefetch_rows;
+ unsigned int server_status;
+ unsigned int last_errno;
+ unsigned int param_count;
+ unsigned int field_count;
+ enum enum_mysql_stmt_state state;
+ char last_error[512];
+ char sqlstate[5 +1];
+ my_bool send_types_to_server;
+ my_bool bind_param_done;
+ unsigned char bind_result_done;
+ my_bool unbuffered_fetch_cancelled;
+ my_bool update_max_length;
+ void *extension;
+} MYSQL_STMT;
+enum enum_stmt_attr_type
+{
+ STMT_ATTR_UPDATE_MAX_LENGTH,
+ STMT_ATTR_CURSOR_TYPE,
+ STMT_ATTR_PREFETCH_ROWS
+};
+typedef struct st_mysql_methods
+{
+ my_bool (*read_query_result)(MYSQL *mysql);
+ my_bool (*advanced_command)(MYSQL *mysql,
+ enum enum_server_command command,
+ const unsigned char *header,
+ unsigned long header_length,
+ const unsigned char *arg,
+ unsigned long arg_length,
+ my_bool skip_check,
+ MYSQL_STMT *stmt);
+ MYSQL_DATA *(*read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
+ unsigned int fields);
+ MYSQL_RES * (*use_result)(MYSQL *mysql);
+ void (*fetch_lengths)(unsigned long *to,
+ MYSQL_ROW column, unsigned int field_count);
+ void (*flush_use_result)(MYSQL *mysql);
+ 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);
+} MYSQL_METHODS;
+MYSQL_STMT * mysql_stmt_init(MYSQL *mysql);
+int mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
+ unsigned long length);
+int mysql_stmt_execute(MYSQL_STMT *stmt);
+int mysql_stmt_fetch(MYSQL_STMT *stmt);
+int mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg,
+ unsigned int column,
+ unsigned long offset);
+int mysql_stmt_store_result(MYSQL_STMT *stmt);
+unsigned long mysql_stmt_param_count(MYSQL_STMT * stmt);
+my_bool mysql_stmt_attr_set(MYSQL_STMT *stmt,
+ enum enum_stmt_attr_type attr_type,
+ const void *attr);
+my_bool mysql_stmt_attr_get(MYSQL_STMT *stmt,
+ enum enum_stmt_attr_type attr_type,
+ void *attr);
+my_bool mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
+my_bool mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
+my_bool mysql_stmt_close(MYSQL_STMT * stmt);
+my_bool mysql_stmt_reset(MYSQL_STMT * stmt);
+my_bool mysql_stmt_free_result(MYSQL_STMT *stmt);
+my_bool mysql_stmt_send_long_data(MYSQL_STMT *stmt,
+ unsigned int param_number,
+ const char *data,
+ unsigned long length);
+MYSQL_RES * mysql_stmt_result_metadata(MYSQL_STMT *stmt);
+MYSQL_RES * mysql_stmt_param_metadata(MYSQL_STMT *stmt);
+unsigned int mysql_stmt_errno(MYSQL_STMT * stmt);
+const char * mysql_stmt_error(MYSQL_STMT * stmt);
+const char * mysql_stmt_sqlstate(MYSQL_STMT * stmt);
+MYSQL_ROW_OFFSET mysql_stmt_row_seek(MYSQL_STMT *stmt,
+ MYSQL_ROW_OFFSET offset);
+MYSQL_ROW_OFFSET mysql_stmt_row_tell(MYSQL_STMT *stmt);
+void mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset);
+my_ulonglong mysql_stmt_num_rows(MYSQL_STMT *stmt);
+my_ulonglong mysql_stmt_affected_rows(MYSQL_STMT *stmt);
+my_ulonglong mysql_stmt_insert_id(MYSQL_STMT *stmt);
+unsigned int mysql_stmt_field_count(MYSQL_STMT *stmt);
+my_bool mysql_commit(MYSQL * mysql);
+my_bool mysql_rollback(MYSQL * mysql);
+my_bool mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
+my_bool mysql_more_results(MYSQL *mysql);
+int mysql_next_result(MYSQL *mysql);
+void mysql_close(MYSQL *sock);
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
new file mode 100644
index 00000000000..b49a5c22186
--- /dev/null
+++ b/include/mysql/plugin.h
@@ -0,0 +1,841 @@
+/*
+ Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef _my_plugin_h
+#define _my_plugin_h
+
+
+/*
+ On Windows, exports from DLL need to be declared
+*/
+#if (defined(_WIN32) && defined(MYSQL_DYNAMIC_PLUGIN))
+#define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport)
+#else
+#define MYSQL_PLUGIN_EXPORT
+#endif
+
+#ifdef __cplusplus
+class THD;
+class Item;
+#define MYSQL_THD THD*
+#else
+#define MYSQL_THD void*
+#endif
+
+#ifndef _m_string_h
+/* This definition must match the one given in m_string.h */
+struct st_mysql_lex_string
+{
+ char *str;
+ unsigned int length;
+};
+#endif /* _m_string_h */
+typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
+
+#define MYSQL_XIDDATASIZE 128
+/**
+ struct st_mysql_xid is binary compatible with the XID structure as
+ in the X/Open CAE Specification, Distributed Transaction Processing:
+ The XA Specification, X/Open Company Ltd., 1991.
+ http://www.opengroup.org/bookstore/catalog/c193.htm
+
+ @see XID in sql/handler.h
+*/
+struct st_mysql_xid {
+ long formatID;
+ long gtrid_length;
+ long bqual_length;
+ char data[MYSQL_XIDDATASIZE]; /* Not \0-terminated */
+};
+typedef struct st_mysql_xid MYSQL_XID;
+
+/*************************************************************************
+ Plugin API. Common for all plugin types.
+*/
+
+#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0100
+
+/*
+ The allowable types of plugins
+*/
+#define MYSQL_UDF_PLUGIN 0 /* User-defined function */
+#define MYSQL_STORAGE_ENGINE_PLUGIN 1 /* Storage Engine */
+#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */
+#define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */
+#define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */
+#define MYSQL_MAX_PLUGIN_TYPE_NUM 5 /* The number of plugin types */
+
+/* We use the following strings to define licenses for plugins */
+#define PLUGIN_LICENSE_PROPRIETARY 0
+#define PLUGIN_LICENSE_GPL 1
+#define PLUGIN_LICENSE_BSD 2
+
+#define PLUGIN_LICENSE_PROPRIETARY_STRING "PROPRIETARY"
+#define PLUGIN_LICENSE_GPL_STRING "GPL"
+#define PLUGIN_LICENSE_BSD_STRING "BSD"
+
+/*
+ Macros for beginning and ending plugin declarations. Between
+ mysql_declare_plugin and mysql_declare_plugin_end there should
+ be a st_mysql_plugin struct for each plugin to be declared.
+*/
+
+
+#ifndef MYSQL_DYNAMIC_PLUGIN
+#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \
+int VERSION= MYSQL_PLUGIN_INTERFACE_VERSION; \
+int PSIZE= sizeof(struct st_mysql_plugin); \
+struct st_mysql_plugin DECLS[]= {
+#else
+#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \
+MYSQL_PLUGIN_EXPORT int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \
+MYSQL_PLUGIN_EXPORT int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \
+MYSQL_PLUGIN_EXPORT struct st_mysql_plugin _mysql_plugin_declarations_[]= {
+#endif
+
+#define mysql_declare_plugin(NAME) \
+__MYSQL_DECLARE_PLUGIN(NAME, \
+ builtin_ ## NAME ## _plugin_interface_version, \
+ builtin_ ## NAME ## _sizeof_struct_st_plugin, \
+ builtin_ ## NAME ## _plugin)
+
+#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0}}
+
+/*
+ declarations for SHOW STATUS support in plugins
+*/
+enum enum_mysql_show_type
+{
+ SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG,
+ SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
+ SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE
+};
+
+struct st_mysql_show_var {
+ const char *name;
+ char *value;
+ enum enum_mysql_show_type type;
+};
+
+#define SHOW_VAR_FUNC_BUFF_SIZE 1024
+typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *);
+
+
+/*
+ declarations for server variables and command line options
+*/
+
+
+#define PLUGIN_VAR_BOOL 0x0001
+#define PLUGIN_VAR_INT 0x0002
+#define PLUGIN_VAR_LONG 0x0003
+#define PLUGIN_VAR_LONGLONG 0x0004
+#define PLUGIN_VAR_STR 0x0005
+#define PLUGIN_VAR_ENUM 0x0006
+#define PLUGIN_VAR_SET 0x0007
+#define PLUGIN_VAR_UNSIGNED 0x0080
+#define PLUGIN_VAR_THDLOCAL 0x0100 /* Variable is per-connection */
+#define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */
+#define PLUGIN_VAR_NOSYSVAR 0x0400 /* Not a server variable */
+#define PLUGIN_VAR_NOCMDOPT 0x0800 /* Not a command line option */
+#define PLUGIN_VAR_NOCMDARG 0x1000 /* No argument for cmd line */
+#define PLUGIN_VAR_RQCMDARG 0x0000 /* Argument required for cmd line */
+#define PLUGIN_VAR_OPCMDARG 0x2000 /* Argument optional for cmd line */
+#define PLUGIN_VAR_MEMALLOC 0x8000 /* String needs memory allocated */
+
+struct st_mysql_sys_var;
+struct st_mysql_value;
+
+/*
+ SYNOPSIS
+ (*mysql_var_check_func)()
+ thd thread handle
+ var dynamic variable being altered
+ save pointer to temporary storage
+ value user provided value
+ RETURN
+ 0 user provided value is OK and the update func may be called.
+ any other value indicates error.
+
+ This function should parse the user provided value and store in the
+ provided temporary storage any data as required by the update func.
+ There is sufficient space in the temporary storage to store a double.
+ Note that the update func may not be called if any other error occurs
+ so any memory allocated should be thread-local so that it may be freed
+ automatically at the end of the statement.
+*/
+
+typedef int (*mysql_var_check_func)(MYSQL_THD thd,
+ struct st_mysql_sys_var *var,
+ void *save, struct st_mysql_value *value);
+
+/*
+ SYNOPSIS
+ (*mysql_var_update_func)()
+ thd thread handle
+ var dynamic variable being altered
+ var_ptr pointer to dynamic variable
+ save pointer to temporary storage
+ RETURN
+ NONE
+
+ This function should use the validated value stored in the temporary store
+ and persist it in the provided pointer to the dynamic variable.
+ For example, strings may require memory to be allocated.
+*/
+typedef void (*mysql_var_update_func)(MYSQL_THD thd,
+ struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save);
+
+
+/* the following declarations are for internal use only */
+
+
+#define PLUGIN_VAR_MASK \
+ (PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | \
+ PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \
+ PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC)
+
+#define MYSQL_PLUGIN_VAR_HEADER \
+ int flags; \
+ const char *name; \
+ const char *comment; \
+ mysql_var_check_func check; \
+ mysql_var_update_func update
+
+#define MYSQL_SYSVAR_NAME(name) mysql_sysvar_ ## name
+#define MYSQL_SYSVAR(name) \
+ ((struct st_mysql_sys_var *)&(MYSQL_SYSVAR_NAME(name)))
+
+/*
+ for global variables, the value pointer is the first
+ element after the header, the default value is the second.
+ for thread variables, the value offset is the first
+ element after the header, the default value is the second.
+*/
+
+
+#define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ type *value; \
+ const type def_val; \
+} MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ type *value; type def_val; \
+ type min_val; type max_val; \
+ type blk_sz; \
+} MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ type *value; type def_val; \
+ TYPELIB *typelib; \
+} MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_THDVAR_FUNC(type) \
+ type *(*resolve)(MYSQL_THD thd, int offset)
+
+#define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ int offset; \
+ const type def_val; \
+ DECLARE_THDVAR_FUNC(type); \
+} MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ int offset; \
+ type def_val; type min_val; \
+ type max_val; type blk_sz; \
+ DECLARE_THDVAR_FUNC(type); \
+} MYSQL_SYSVAR_NAME(name)
+
+#define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) struct { \
+ MYSQL_PLUGIN_VAR_HEADER; \
+ int offset; \
+ type def_val; \
+ DECLARE_THDVAR_FUNC(type); \
+ TYPELIB *typelib; \
+} MYSQL_SYSVAR_NAME(name)
+
+
+/*
+ the following declarations are for use by plugin implementors
+*/
+
+#define MYSQL_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
+DECLARE_MYSQL_SYSVAR_BASIC(name, char) = { \
+ PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def}
+
+#define MYSQL_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
+DECLARE_MYSQL_SYSVAR_BASIC(name, char *) = { \
+ PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def}
+
+#define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \
+ PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, min, max, blk }
+
+#define MYSQL_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned int) = { \
+ PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, min, max, blk }
+
+#define MYSQL_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_SYSVAR_SIMPLE(name, long) = { \
+ PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, min, max, blk }
+
+#define MYSQL_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \
+ PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, min, max, blk }
+
+#define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_SYSVAR_SIMPLE(name, long long) = { \
+ PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, min, max, blk }
+
+#define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \
+ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, min, max, blk }
+
+#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
+DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \
+ PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, typelib }
+
+#define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \
+DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long long) = { \
+ PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, &varname, def, typelib }
+
+#define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \
+DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \
+ PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, NULL}
+
+#define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \
+DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \
+ PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, NULL}
+
+#define MYSQL_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_THDVAR_SIMPLE(name, int) = { \
+ PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, min, max, blk, NULL }
+
+#define MYSQL_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned int) = { \
+ PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, min, max, blk, NULL }
+
+#define MYSQL_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_THDVAR_SIMPLE(name, long) = { \
+ PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, min, max, blk, NULL }
+
+#define MYSQL_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \
+ PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, min, max, blk, NULL }
+
+#define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_THDVAR_SIMPLE(name, long long) = { \
+ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, min, max, blk, NULL }
+
+#define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
+DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long long) = { \
+ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, min, max, blk, NULL }
+
+#define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
+DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long) = { \
+ PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, NULL, typelib }
+
+#define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
+DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long long) = { \
+ PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
+ #name, comment, check, update, -1, def, NULL, typelib }
+
+/* accessor macros */
+
+#define SYSVAR(name) \
+ (*(MYSQL_SYSVAR_NAME(name).value))
+
+/* when thd == null, result points to global value */
+#define THDVAR(thd, name) \
+ (*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset)))
+
+
+/*
+ Plugin description structure.
+*/
+
+struct st_mysql_plugin
+{
+ int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */
+ void *info; /* pointer to type-specific plugin descriptor */
+ const char *name; /* plugin name */
+ const char *author; /* plugin author (for I_S.PLUGINS) */
+ const char *descr; /* general descriptive text (for I_S.PLUGINS) */
+ int license; /* the plugin license (PLUGIN_LICENSE_XXX) */
+ int (*init)(void *); /* the function to invoke when plugin is loaded */
+ int (*deinit)(void *);/* the function to invoke when plugin is unloaded */
+ unsigned int version; /* plugin version (for I_S.PLUGINS) */
+ struct st_mysql_show_var *status_vars;
+ struct st_mysql_sys_var **system_vars;
+ void * __reserved1; /* reserved for dependency checking */
+};
+
+/*************************************************************************
+ API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN)
+*/
+
+#define MYSQL_FTPARSER_INTERFACE_VERSION 0x0100
+
+/* Parsing modes. Set in MYSQL_FTPARSER_PARAM::mode */
+enum enum_ftparser_mode
+{
+/*
+ Fast and simple mode. This mode is used for indexing, and natural
+ language queries.
+
+ The parser is expected to return only those words that go into the
+ index. Stopwords or too short/long words should not be returned. The
+ 'boolean_info' argument of mysql_add_word() does not have to be set.
+*/
+ MYSQL_FTPARSER_SIMPLE_MODE= 0,
+
+/*
+ Parse with stopwords mode. This mode is used in boolean searches for
+ "phrase matching."
+
+ The parser is not allowed to ignore words in this mode. Every word
+ should be returned, including stopwords and words that are too short
+ or long. The 'boolean_info' argument of mysql_add_word() does not
+ have to be set.
+*/
+ MYSQL_FTPARSER_WITH_STOPWORDS= 1,
+
+/*
+ Parse in boolean mode. This mode is used to parse a boolean query string.
+
+ The parser should provide a valid MYSQL_FTPARSER_BOOLEAN_INFO
+ structure in the 'boolean_info' argument to mysql_add_word().
+ Usually that means that the parser should recognize boolean operators
+ in the parsing stream and set appropriate fields in
+ MYSQL_FTPARSER_BOOLEAN_INFO structure accordingly. As for
+ MYSQL_FTPARSER_WITH_STOPWORDS mode, no word should be ignored.
+ Instead, use FT_TOKEN_STOPWORD for the token type of such a word.
+*/
+ MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2
+};
+
+/*
+ Token types for boolean mode searching (used for the type member of
+ MYSQL_FTPARSER_BOOLEAN_INFO struct)
+
+ FT_TOKEN_EOF: End of data.
+ FT_TOKEN_WORD: Regular word.
+ FT_TOKEN_LEFT_PAREN: Left parenthesis (start of group/sub-expression).
+ FT_TOKEN_RIGHT_PAREN: Right parenthesis (end of group/sub-expression).
+ FT_TOKEN_STOPWORD: Stopword.
+*/
+
+enum enum_ft_token_type
+{
+ FT_TOKEN_EOF= 0,
+ FT_TOKEN_WORD= 1,
+ FT_TOKEN_LEFT_PAREN= 2,
+ FT_TOKEN_RIGHT_PAREN= 3,
+ FT_TOKEN_STOPWORD= 4
+};
+
+/*
+ This structure is used in boolean search mode only. It conveys
+ boolean-mode metadata to the MySQL search engine for every word in
+ the search query. A valid instance of this structure must be filled
+ in by the plugin parser and passed as an argument in the call to
+ mysql_add_word (the callback function in the MYSQL_FTPARSER_PARAM
+ structure) when a query is parsed in boolean mode.
+
+ type: The token type. Should be one of the enum_ft_token_type values.
+
+ yesno: Whether the word must be present for a match to occur:
+ >0 Must be present
+ <0 Must not be present
+ 0 Neither; the word is optional but its presence increases the relevance
+ With the default settings of the ft_boolean_syntax system variable,
+ >0 corresponds to the '+' operator, <0 corrresponds to the '-' operator,
+ and 0 means neither operator was used.
+
+ weight_adjust: A weighting factor that determines how much a match
+ for the word counts. Positive values increase, negative - decrease the
+ relative word's importance in the query.
+
+ wasign: The sign of the word's weight in the query. If it's non-negative
+ the match for the word will increase document relevance, if it's
+ negative - decrease (the word becomes a "noise word", the less of it the
+ better).
+
+ trunc: Corresponds to the '*' operator in the default setting of the
+ ft_boolean_syntax system variable.
+*/
+
+typedef struct st_mysql_ftparser_boolean_info
+{
+ enum enum_ft_token_type type;
+ int yesno;
+ int weight_adjust;
+ char wasign;
+ char trunc;
+ /* These are parser state and must be removed. */
+ char prev;
+ char *quot;
+} MYSQL_FTPARSER_BOOLEAN_INFO;
+
+/*
+ The following flag means that buffer with a string (document, word)
+ may be overwritten by the caller before the end of the parsing (that is
+ before st_mysql_ftparser::deinit() call). If one needs the string
+ to survive between two successive calls of the parsing function, she
+ needs to save a copy of it. The flag may be set by MySQL before calling
+ st_mysql_ftparser::parse(), or it may be set by a plugin before calling
+ st_mysql_ftparser_param::mysql_parse() or
+ st_mysql_ftparser_param::mysql_add_word().
+*/
+#define MYSQL_FTFLAGS_NEED_COPY 1
+
+/*
+ An argument of the full-text parser plugin. This structure is
+ filled in by MySQL server and passed to the parsing function of the
+ plugin as an in/out parameter.
+
+ mysql_parse: A pointer to the built-in parser implementation of the
+ server. It's set by the server and can be used by the parser plugin
+ to invoke the MySQL default parser. If plugin's role is to extract
+ textual data from .doc, .pdf or .xml content, it might extract
+ plaintext from the content, and then pass the text to the default
+ MySQL parser to be parsed.
+
+ mysql_add_word: A server callback to add a new word. When parsing
+ a document, the server sets this to point at a function that adds
+ the word to MySQL full-text index. When parsing a search query,
+ this function will add the new word to the list of words to search
+ for. The boolean_info argument can be NULL for all cases except
+ when mode is MYSQL_FTPARSER_FULL_BOOLEAN_INFO.
+
+ ftparser_state: A generic pointer. The plugin can set it to point
+ to information to be used internally for its own purposes.
+
+ mysql_ftparam: This is set by the server. It is used by MySQL functions
+ called via mysql_parse() and mysql_add_word() callback. The plugin
+ should not modify it.
+
+ cs: Information about the character set of the document or query string.
+
+ doc: A pointer to the document or query string to be parsed.
+
+ length: Length of the document or query string, in bytes.
+
+ flags: See MYSQL_FTFLAGS_* constants above.
+
+ mode: The parsing mode. With boolean operators, with stopwords, or
+ nothing. See enum_ftparser_mode above.
+*/
+
+typedef struct st_mysql_ftparser_param
+{
+ int (*mysql_parse)(struct st_mysql_ftparser_param *,
+ char *doc, int doc_len);
+ int (*mysql_add_word)(struct st_mysql_ftparser_param *,
+ char *word, int word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
+ void *ftparser_state;
+ void *mysql_ftparam;
+ struct charset_info_st *cs;
+ char *doc;
+ int length;
+ int flags;
+ enum enum_ftparser_mode mode;
+} MYSQL_FTPARSER_PARAM;
+
+/*
+ Full-text parser descriptor.
+
+ interface_version is, e.g., MYSQL_FTPARSER_INTERFACE_VERSION.
+ The parsing, initialization, and deinitialization functions are
+ invoked per SQL statement for which the parser is used.
+*/
+
+struct st_mysql_ftparser
+{
+ int interface_version;
+ int (*parse)(MYSQL_FTPARSER_PARAM *param);
+ int (*init)(MYSQL_FTPARSER_PARAM *param);
+ int (*deinit)(MYSQL_FTPARSER_PARAM *param);
+};
+
+/*************************************************************************
+ API for Storage Engine plugin. (MYSQL_DAEMON_PLUGIN)
+*/
+
+/* handlertons of different MySQL releases are incompatible */
+#define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
+
+/*************************************************************************
+ API for I_S plugin. (MYSQL_INFORMATION_SCHEMA_PLUGIN)
+*/
+
+/* handlertons of different MySQL releases are incompatible */
+#define MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
+
+/*************************************************************************
+ API for Storage Engine plugin. (MYSQL_STORAGE_ENGINE_PLUGIN)
+*/
+
+/* handlertons of different MySQL releases are incompatible */
+#define MYSQL_HANDLERTON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
+
+/*
+ The real API is in the sql/handler.h
+ Here we define only the descriptor structure, that is referred from
+ st_mysql_plugin.
+*/
+
+struct st_mysql_storage_engine
+{
+ int interface_version;
+};
+
+struct handlerton;
+
+/*
+ Here we define only the descriptor structure, that is referred from
+ st_mysql_plugin.
+*/
+
+struct st_mysql_daemon
+{
+ int interface_version;
+};
+
+/*
+ Here we define only the descriptor structure, that is referred from
+ st_mysql_plugin.
+*/
+
+struct st_mysql_information_schema
+{
+ int interface_version;
+};
+
+
+/*
+ st_mysql_value struct for reading values from mysqld.
+ Used by server variables framework to parse user-provided values.
+ Will be used for arguments when implementing UDFs.
+
+ Note that val_str() returns a string in temporary memory
+ that will be freed at the end of statement. Copy the string
+ if you need it to persist.
+*/
+
+#define MYSQL_VALUE_TYPE_STRING 0
+#define MYSQL_VALUE_TYPE_REAL 1
+#define MYSQL_VALUE_TYPE_INT 2
+
+struct st_mysql_value
+{
+ int (*value_type)(struct st_mysql_value *);
+ const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
+ int (*val_real)(struct st_mysql_value *, double *realbuf);
+ int (*val_int)(struct st_mysql_value *, long long *intbuf);
+};
+
+
+/*************************************************************************
+ Miscellaneous functions for plugin implementors
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int thd_in_lock_tables(const MYSQL_THD thd);
+int thd_tablespace_op(const MYSQL_THD thd);
+long long thd_test_options(const MYSQL_THD thd, long long test_options);
+int thd_sql_command(const MYSQL_THD thd);
+const char *thd_proc_info(MYSQL_THD thd, const char *info);
+void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
+int thd_tx_isolation(const MYSQL_THD thd);
+char *thd_security_context(MYSQL_THD thd, char *buffer, unsigned int length,
+ unsigned int max_query_len);
+/* Increments the row counter, see THD::row_count */
+void thd_inc_row_count(MYSQL_THD thd);
+
+/**
+ Create a temporary file.
+
+ @details
+ The temporary file is created in a location specified by the mysql
+ server configuration (--tmpdir option). The caller does not need to
+ delete the file, it will be deleted automatically.
+
+ @param prefix prefix for temporary file name
+ @retval -1 error
+ @retval >= 0 a file handle that can be passed to dup or my_close
+*/
+int mysql_tmpfile(const char *prefix);
+
+/**
+ Check the killed state of a connection
+
+ @details
+ In MySQL support for the KILL statement is cooperative. The KILL
+ statement only sets a "killed" flag. This function returns the value
+ of that flag. A thread should check it often, especially inside
+ time-consuming loops, and gracefully abort the operation if it is
+ non-zero.
+
+ @param thd user thread connection handle
+ @retval 0 the connection is active
+ @retval 1 the connection has been killed
+*/
+int thd_killed(const MYSQL_THD thd);
+
+
+/**
+ Return the thread id of a user thread
+
+ @param thd user thread connection handle
+ @return thread id
+*/
+unsigned long thd_get_thread_id(const MYSQL_THD thd);
+
+
+/**
+ Allocate memory in the connection's local memory pool
+
+ @details
+ When properly used in place of @c my_malloc(), this can significantly
+ improve concurrency. Don't use this or related functions to allocate
+ large chunks of memory. Use for temporary storage only. The memory
+ will be freed automatically at the end of the statement; no explicit
+ code is required to prevent memory leaks.
+
+ @see alloc_root()
+*/
+void *thd_alloc(MYSQL_THD thd, unsigned int size);
+/**
+ @see thd_alloc()
+*/
+void *thd_calloc(MYSQL_THD thd, unsigned int size);
+/**
+ @see thd_alloc()
+*/
+char *thd_strdup(MYSQL_THD thd, const char *str);
+/**
+ @see thd_alloc()
+*/
+char *thd_strmake(MYSQL_THD thd, const char *str, unsigned int size);
+/**
+ @see thd_alloc()
+*/
+void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size);
+
+/**
+ Create a LEX_STRING in this connection's local memory pool
+
+ @param thd user thread connection handle
+ @param lex_str pointer to LEX_STRING object to be initialized
+ @param str initializer to be copied into lex_str
+ @param size length of str, in bytes
+ @param allocate_lex_string flag: if TRUE, allocate new LEX_STRING object,
+ instead of using lex_str value
+ @return NULL on failure, or pointer to the LEX_STRING object
+
+ @see thd_alloc()
+*/
+MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str,
+ const char *str, unsigned int size,
+ int allocate_lex_string);
+
+/**
+ Get the XID for this connection's transaction
+
+ @param thd user thread connection handle
+ @param xid location where identifier is stored
+*/
+void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid);
+
+/**
+ Invalidate the query cache for a given table.
+
+ @param thd user thread connection handle
+ @param key databasename\\0tablename\\0
+ @param key_length length of key in bytes, including the NUL bytes
+ @param using_trx flag: TRUE if using transactions, FALSE otherwise
+*/
+void mysql_query_cache_invalidate4(MYSQL_THD thd,
+ const char *key, unsigned int key_length,
+ int using_trx);
+
+
+/**
+ Provide a handler data getter to simplify coding
+*/
+void *thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
+
+
+/**
+ Provide a handler data setter to simplify coding
+
+ @details
+ Set ha_data pointer (storage engine per-connection information).
+
+ To avoid unclean deactivation (uninstall) of storage engine plugin
+ in the middle of transaction, additional storage engine plugin
+ lock is acquired.
+
+ If ha_data is not null and storage engine plugin was not locked
+ by thd_set_ha_data() in this connection before, storage engine
+ plugin gets locked.
+
+ If ha_data is null and storage engine plugin was locked by
+ thd_set_ha_data() in this connection before, storage engine
+ plugin lock gets released.
+
+ If handlerton::close_connection() didn't reset ha_data, server does
+ it immediately after calling handlerton::close_connection().
+*/
+void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton,
+ const void *ha_data);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/include/mysql/plugin.h.pp b/include/mysql/plugin.h.pp
new file mode 100644
index 00000000000..e4906ea6547
--- /dev/null
+++ b/include/mysql/plugin.h.pp
@@ -0,0 +1,142 @@
+struct st_mysql_lex_string
+{
+ char *str;
+ unsigned int length;
+};
+typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
+struct st_mysql_xid {
+ long formatID;
+ long gtrid_length;
+ long bqual_length;
+ char data[128];
+};
+typedef struct st_mysql_xid MYSQL_XID;
+enum enum_mysql_show_type
+{
+ SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG,
+ SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
+ SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE
+};
+struct st_mysql_show_var {
+ const char *name;
+ char *value;
+ enum enum_mysql_show_type type;
+};
+typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *);
+struct st_mysql_sys_var;
+struct st_mysql_value;
+typedef int (*mysql_var_check_func)(void* thd,
+ struct st_mysql_sys_var *var,
+ void *save, struct st_mysql_value *value);
+typedef void (*mysql_var_update_func)(void* thd,
+ struct st_mysql_sys_var *var,
+ void *var_ptr, const void *save);
+struct st_mysql_plugin
+{
+ int type;
+ void *info;
+ const char *name;
+ const char *author;
+ const char *descr;
+ int license;
+ int (*init)(void *);
+ int (*deinit)(void *);
+ unsigned int version;
+ struct st_mysql_show_var *status_vars;
+ struct st_mysql_sys_var **system_vars;
+ void * __reserved1;
+};
+enum enum_ftparser_mode
+{
+ MYSQL_FTPARSER_SIMPLE_MODE= 0,
+ MYSQL_FTPARSER_WITH_STOPWORDS= 1,
+ MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2
+};
+enum enum_ft_token_type
+{
+ FT_TOKEN_EOF= 0,
+ FT_TOKEN_WORD= 1,
+ FT_TOKEN_LEFT_PAREN= 2,
+ FT_TOKEN_RIGHT_PAREN= 3,
+ FT_TOKEN_STOPWORD= 4
+};
+typedef struct st_mysql_ftparser_boolean_info
+{
+ enum enum_ft_token_type type;
+ int yesno;
+ int weight_adjust;
+ char wasign;
+ char trunc;
+ char prev;
+ char *quot;
+} MYSQL_FTPARSER_BOOLEAN_INFO;
+typedef struct st_mysql_ftparser_param
+{
+ int (*mysql_parse)(struct st_mysql_ftparser_param *,
+ char *doc, int doc_len);
+ int (*mysql_add_word)(struct st_mysql_ftparser_param *,
+ char *word, int word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
+ void *ftparser_state;
+ void *mysql_ftparam;
+ struct charset_info_st *cs;
+ char *doc;
+ int length;
+ int flags;
+ enum enum_ftparser_mode mode;
+} MYSQL_FTPARSER_PARAM;
+struct st_mysql_ftparser
+{
+ int interface_version;
+ int (*parse)(MYSQL_FTPARSER_PARAM *param);
+ int (*init)(MYSQL_FTPARSER_PARAM *param);
+ int (*deinit)(MYSQL_FTPARSER_PARAM *param);
+};
+struct st_mysql_storage_engine
+{
+ int interface_version;
+};
+struct handlerton;
+struct st_mysql_daemon
+{
+ int interface_version;
+};
+struct st_mysql_information_schema
+{
+ int interface_version;
+};
+struct st_mysql_value
+{
+ int (*value_type)(struct st_mysql_value *);
+ const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
+ int (*val_real)(struct st_mysql_value *, double *realbuf);
+ int (*val_int)(struct st_mysql_value *, long long *intbuf);
+};
+int thd_in_lock_tables(const void* thd);
+int thd_tablespace_op(const void* thd);
+long long thd_test_options(const void* thd, long long test_options);
+int thd_sql_command(const void* thd);
+const char *thd_proc_info(void* thd, const char *info);
+void **thd_ha_data(const void* thd, const struct handlerton *hton);
+int thd_tx_isolation(const void* thd);
+char *thd_security_context(void* thd, char *buffer, unsigned int length,
+ unsigned int max_query_len);
+void thd_inc_row_count(void* thd);
+int mysql_tmpfile(const char *prefix);
+int thd_killed(const void* thd);
+unsigned long thd_get_thread_id(const void* thd);
+void *thd_alloc(void* thd, unsigned int size);
+void *thd_calloc(void* thd, unsigned int size);
+char *thd_strdup(void* thd, const char *str);
+char *thd_strmake(void* thd, const char *str, unsigned int size);
+void *thd_memdup(void* thd, const void* str, unsigned int size);
+MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
+ const char *str, unsigned int size,
+ int allocate_lex_string);
+void thd_get_xid(const void* thd, MYSQL_XID *xid);
+void mysql_query_cache_invalidate4(void* thd,
+ const char *key, unsigned int key_length,
+ int using_trx);
+void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
+void thd_set_ha_data(void* thd, const struct handlerton *hton,
+ const void *ha_data);
diff --git a/include/mysql_com.h b/include/mysql_com.h
index b3fadb9ee48..357519d549a 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -11,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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
** Common definition between mysql server & client
@@ -20,9 +20,13 @@
#ifndef _mysql_com_h
#define _mysql_com_h
-#define NAME_LEN 64 /* Field/table name length */
#define HOSTNAME_LENGTH 60
-#define USERNAME_LENGTH 16
+#define SYSTEM_CHARSET_MBMAXLEN 3
+#define NAME_CHAR_LEN 64 /* Field/table name length */
+#define USERNAME_CHAR_LENGTH 16
+#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
+#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
+
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5
@@ -56,7 +60,7 @@ enum enum_server_command
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_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON,
/* don't forget to update const char *command_name[] in sql_parse.cc */
/* Must be last */
@@ -90,11 +94,16 @@ 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 */
+#define FIELD_IN_ADD_INDEX (1<< 20) /* Intern: Field used in ADD INDEX */
+#define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */
#define REFRESH_GRANT 1 /* Refresh grant tables */
#define REFRESH_LOG 2 /* Start on new log file */
@@ -139,24 +148,74 @@ enum enum_server_command
#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
#define CLIENT_REMEMBER_OPTIONS (1UL << 31)
+/* 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_SECURE_CONNECTION | \
+ CLIENT_MULTI_STATEMENTS | \
+ CLIENT_MULTI_RESULTS | \
+ CLIENT_SSL_VERIFY_SERVER_CERT | \
+ CLIENT_REMEMBER_OPTIONS)
+
+/*
+ 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)
+
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
#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
+
+/**
+ 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)
#define MYSQL_ERRMSG_SIZE 512
#define NET_READ_TIMEOUT 30 /* Timeout on read */
@@ -165,6 +224,7 @@ enum enum_server_command
#define ONLY_KILL_QUERY 1
+
struct st_vio; /* Only C */
typedef struct st_vio Vio;
@@ -174,51 +234,49 @@ 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 unused0; /* Please remove with the next incompatible ABI change. */
+ my_bool unused; /* Please remove with the next incompatible ABI change */
+ my_bool compress;
+ my_bool unused1; /* 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];
- unsigned int last_errno;
- unsigned char error;
-
/*
'query_cache_query' should be accessed only via query cache
functions and methods to maintain proper locking.
*/
- gptr query_cache_query;
-
- my_bool report_error; /* We should report error (we have unreported error) */
+ unsigned char *query_cache_query;
+ unsigned int last_errno;
+ unsigned char error;
+ my_bool unused2; /* Please remove with the next incompatible ABI change. */
my_bool return_errno;
+ /** Client library error message buffer. Actually belongs to struct MYSQL. */
+ char last_error[MYSQL_ERRMSG_SIZE];
+ /** Client library sqlstate buffer. Set along with the error message. */
+ char sqlstate[SQLSTATE_LENGTH+1];
+ void *extension;
#if defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
/*
Controls whether a big packet should be skipped.
@@ -231,6 +289,7 @@ typedef struct st_net {
#endif
} NET;
+
#define packet_error (~(unsigned long) 0)
enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
@@ -345,14 +404,14 @@ extern "C" {
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 net_clear(NET *net, my_bool clear_buffer);
+my_bool net_realloc(NET *net, size_t length);
my_bool net_flush(NET *net);
-my_bool my_net_write(NET *net,const 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);
+int net_real_write(NET *net,const unsigned char *packet, size_t len);
unsigned long my_net_read(NET *net);
#ifdef _global_h
@@ -391,6 +450,7 @@ 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 */
@@ -402,6 +462,7 @@ typedef struct st_udf_init
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.
@@ -446,24 +507,18 @@ 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
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);
#endif
#ifdef __cplusplus
diff --git a/include/mysql_embed.h b/include/mysql_embed.h
index 7416283d83d..e3318864f17 100644
--- a/include/mysql_embed.h
+++ b/include/mysql_embed.h
@@ -1,4 +1,5 @@
-/* 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
@@ -11,7 +12,8 @@
You 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
+*/
/* Defines that are unique to the embedded version of MySQL */
@@ -20,8 +22,6 @@
/* 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_PSTACK /* No stacktrace */
-#undef HAVE_DLOPEN /* No udf functions */
#undef HAVE_OPENSSL
#undef HAVE_SMEM /* No shared memory */
#undef HAVE_NDBCLUSTER_DB /* No NDB cluster */
diff --git a/include/mysql_h.ic b/include/mysql_h.ic
deleted file mode 100644
index 2ad8121fbc7..00000000000
--- a/include/mysql_h.ic
+++ /dev/null
@@ -1,969 +0,0 @@
-struct character_set;
-struct rand_struct;
-struct st_list;
-struct st_mem_root;
-struct st_mysql;
-struct st_mysql_bind;
-struct st_mysql_data;
-struct st_mysql_field;
-struct st_mysql_manager;
-struct st_mysql_methods;
-struct st_mysql_options;
-struct st_mysql_parameters;
-struct st_mysql_res;
-struct st_mysql_rows;
-struct st_mysql_stmt;
-struct st_mysql_time;
-struct st_net;
-struct st_typelib;
-struct st_udf_args;
-struct st_udf_init;
-struct st_used_mem;
-enum Item_result;
-enum enum_cursor_type;
-enum enum_field_types;
-enum enum_mysql_set_option;
-enum enum_mysql_stmt_state;
-enum enum_mysql_timestamp_type;
-enum enum_server_command;
-enum enum_stmt_attr_type;
-enum mysql_enum_shutdown_level;
-enum mysql_option;
-enum mysql_protocol_type;
-enum mysql_rpl_type;
-enum mysql_status;
-# 138 "mysql.h"
-typedef struct st_mysql_rows MYSQL_ROWS;
-# 23 "my_list.h"
-typedef struct st_list LIST;
-# 34 "my_alloc.h"
-typedef struct st_mem_root MEM_ROOT;
-# 255 "mysql.h"
-typedef struct st_mysql MYSQL;
-# 657 "mysql.h"
-typedef struct st_mysql_bind MYSQL_BIND;
-# 97 "mysql.h"
-typedef struct st_mysql_field MYSQL_FIELD;
-# 121 "mysql.h"
-typedef unsigned int MYSQL_FIELD_OFFSET;
-# 344 "mysql.h"
-typedef struct st_mysql_manager MYSQL_MANAGER;
-# 358 "mysql.h"
-typedef struct st_mysql_parameters MYSQL_PARAMETERS;
-# 313 "mysql.h"
-typedef struct st_mysql_res MYSQL_RES;
-# 120 "mysql.h"
-typedef char * * MYSQL_ROW;
-# 144 "mysql.h"
-typedef MYSQL_ROWS * MYSQL_ROW_OFFSET;
-# 685 "mysql.h"
-typedef struct st_mysql_stmt MYSQL_STMT;
-# 240 "mysql.h"
-typedef struct character_set MY_CHARSET_INFO;
-# 179 "mysql_com.h"
-typedef struct st_net NET;
-# 22 "typelib.h"
-typedef struct st_typelib TYPELIB;
-# 169 "mysql_com.h"
-typedef struct st_vio Vio;
-# 60 "mysql.h"
-typedef char * gptr;
-# 28 "my_list.h"
-typedef int (* list_walk_action)(void *, void *);
-# 51 "mysql.h"
-typedef char my_bool;
-# 66 "mysql.h"
-typedef int my_socket;
-# 129 "mysql.h"
-typedef unsigned long long int my_ulonglong;
-# 148 "mysql.h"
-typedef struct embedded_query_result EMBEDDED_QUERY_RESULT;
-# 149 "mysql.h"
-typedef struct st_mysql_data MYSQL_DATA;
-# 754 "mysql.h"
-typedef struct st_mysql_methods MYSQL_METHODS;
-# 47 "mysql_time.h"
-typedef struct st_mysql_time MYSQL_TIME;
-# 375 "mysql_com.h"
-typedef struct st_udf_args UDF_ARGS;
-# 388 "mysql_com.h"
-typedef struct st_udf_init UDF_INIT;
-# 26 "my_alloc.h"
-typedef struct st_used_mem USED_MEM;
-# 240 "mysql.h"
-struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) character_set
- {
- unsigned int number;
- unsigned int state;
- char const * csname;
- char const * name;
- char const * comment;
- char const * dir;
- unsigned int mbminlen;
- unsigned int mbmaxlen;
- };
-# 361 "mysql_com.h"
-struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(double)))) rand_struct
- {
- unsigned long int seed1;
- unsigned long int seed2;
- unsigned long int max_value;
- double max_value_dbl;
- };
-# 23 "my_list.h"
-struct __attribute__((aligned(__alignof__(void *)))) st_list
- {
- struct st_list * prev;
- struct st_list * next;
- void * data;
- };
-# 34 "my_alloc.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned int)))) st_mem_root
- {
- USED_MEM * free;
- USED_MEM * used;
- USED_MEM * pre_alloc;
- unsigned int min_malloc;
- unsigned int block_size;
- unsigned int block_num;
- unsigned int first_block_usage;
- void (* error_handler)(void);
- };
-# 255 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long long int)))) st_mysql
- {
- NET net;
- gptr connector_fd;
- char * host;
- char * user;
- char * passwd;
- char * unix_socket;
- char * server_version;
- char * host_info;
- char * info;
- char * db;
- struct charset_info_st * charset;
- MYSQL_FIELD * fields;
- MEM_ROOT field_alloc;
- my_ulonglong affected_rows;
- my_ulonglong insert_id;
- my_ulonglong extra_info;
- unsigned long int thread_id;
- unsigned long int packet_length;
- unsigned int port;
- unsigned long int client_flag;
- unsigned long int server_capabilities;
- unsigned int protocol_version;
- unsigned int field_count;
- unsigned int server_status;
- unsigned int server_language;
- unsigned int warning_count;
- struct st_mysql_options options;
- enum mysql_status status;
- my_bool free_me;
- my_bool reconnect;
- char scramble[(20 + 1)];
- my_bool rpl_pivot;
- struct st_mysql * master;
- struct st_mysql * next_slave;
- struct st_mysql * last_used_slave;
- struct st_mysql * last_used_con;
- LIST * stmts;
- struct st_mysql_methods const * methods;
- void * thd;
- my_bool * unbuffered_fetch_owner;
- };
-# 657 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_bind
- {
- unsigned long int * length;
- my_bool * is_null;
- void * buffer;
- my_bool * error;
- enum enum_field_types buffer_type;
- unsigned long int buffer_length;
- unsigned char * row_ptr;
- unsigned long int offset;
- unsigned long int length_value;
- unsigned int param_number;
- unsigned int pack_length;
- my_bool error_value;
- my_bool is_unsigned;
- my_bool long_data_used;
- my_bool is_null_value;
- 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);
- };
-# 149 "mysql.h"
-struct __attribute__((aligned(__alignof__(unsigned long long int)), aligned(__alignof__(void *)))) st_mysql_data
- {
- my_ulonglong rows;
- unsigned int fields;
- MYSQL_ROWS * data;
- MEM_ROOT alloc;
- struct embedded_query_result * embedded_info;
- };
-# 97 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_field
- {
- char * name;
- char * org_name;
- char * table;
- char * org_table;
- char * db;
- char * catalog;
- char * def;
- unsigned long int length;
- unsigned long int max_length;
- unsigned int name_length;
- unsigned int org_name_length;
- unsigned int table_length;
- unsigned int org_table_length;
- unsigned int db_length;
- unsigned int catalog_length;
- unsigned int def_length;
- unsigned int flags;
- unsigned int decimals;
- unsigned int charsetnr;
- enum enum_field_types type;
- };
-# 344 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_manager
- {
- NET net;
- char * host;
- char * user;
- char * passwd;
- unsigned int port;
- my_bool free_me;
- my_bool eof;
- int cmd_status;
- int last_errno;
- char * net_buf;
- char * net_buf_pos;
- char * net_data_end;
- int net_buf_size;
- char last_error[256];
- };
-# 754 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)))) st_mysql_methods
- {
- my_bool (* read_query_result)(MYSQL * mysql);
- my_bool (* advanced_command)(MYSQL * mysql, enum enum_server_command, char const * header, unsigned long int, char const * arg, unsigned long int, my_bool, MYSQL_STMT * stmt);
- MYSQL_DATA * (* read_rows)(MYSQL * mysql, MYSQL_FIELD * mysql_fields, unsigned int);
- MYSQL_RES * (* use_result)(MYSQL * mysql);
- void (* fetch_lengths)(unsigned long int * to, MYSQL_ROW, unsigned int);
- void (* flush_use_result)(MYSQL * mysql);
- 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);
- char const * (* read_statistics)(MYSQL * mysql);
- my_bool (* next_result)(MYSQL * mysql);
- int (* read_change_user_result)(MYSQL * mysql, char * buff, char const * passwd);
- int (* read_rows_from_cursor)(MYSQL_STMT * stmt);
- };
-# 171 "mysql.h"
-struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(void *)))) st_mysql_options
- {
- unsigned int connect_timeout;
- unsigned int read_timeout;
- unsigned int write_timeout;
- unsigned int port;
- unsigned int protocol;
- unsigned long int client_flag;
- char * host;
- char * user;
- char * password;
- char * unix_socket;
- char * db;
- struct st_dynamic_array * init_commands;
- char * my_cnf_file;
- char * my_cnf_group;
- char * charset_dir;
- char * charset_name;
- char * ssl_key;
- char * ssl_cert;
- char * ssl_ca;
- char * ssl_capath;
- char * ssl_cipher;
- char * shared_memory_base_name;
- unsigned long int max_allowed_packet;
- my_bool use_ssl;
- my_bool compress;
- my_bool named_pipe;
- my_bool rpl_probe;
- my_bool rpl_parse;
- my_bool no_master_reads;
- my_bool separate_thread;
- enum mysql_option methods_to_use;
- char * client_ip;
- my_bool secure_auth;
- my_bool report_data_truncation;
- int (* local_infile_init)(void * *, char const *, void *);
- int (* local_infile_read)(void *, char *, unsigned int);
- void (* local_infile_end)(void);
- int (* local_infile_error)(void *, char *, unsigned int);
- void * local_infile_userdata;
- };
-# 358 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)))) st_mysql_parameters
- {
- unsigned long int * p_max_allowed_packet;
- unsigned long int * p_net_buffer_length;
- };
-# 313 "mysql.h"
-struct __attribute__((aligned(__alignof__(unsigned long long int)), aligned(__alignof__(void *)))) st_mysql_res
- {
- my_ulonglong row_count;
- MYSQL_FIELD * fields;
- MYSQL_DATA * data;
- MYSQL_ROWS * data_cursor;
- unsigned long int * lengths;
- MYSQL * handle;
- MEM_ROOT field_alloc;
- unsigned int field_count;
- unsigned int current_field;
- MYSQL_ROW row;
- MYSQL_ROW current_row;
- my_bool eof;
- my_bool unbuffered_fetch_cancelled;
- struct st_mysql_methods const * methods;
- };
-# 138 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_rows
- {
- struct st_mysql_rows * next;
- MYSQL_ROW data;
- unsigned long int length;
- };
-# 685 "mysql.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long long int)))) st_mysql_stmt
- {
- MEM_ROOT mem_root;
- LIST list;
- MYSQL * mysql;
- MYSQL_BIND * params;
- MYSQL_BIND * bind;
- MYSQL_FIELD * fields;
- MYSQL_DATA result;
- MYSQL_ROWS * data_cursor;
- my_ulonglong affected_rows;
- my_ulonglong insert_id;
- int (* read_row_func)(struct st_mysql_stmt * stmt, unsigned char * * row);
- unsigned long int stmt_id;
- unsigned long int flags;
- unsigned long int prefetch_rows;
- unsigned int server_status;
- unsigned int last_errno;
- unsigned int param_count;
- unsigned int field_count;
- enum enum_mysql_stmt_state state;
- char last_error[512];
- char sqlstate[(5 + 1)];
- my_bool send_types_to_server;
- my_bool bind_param_done;
- unsigned char bind_result_done;
- my_bool unbuffered_fetch_cancelled;
- my_bool update_max_length;
- };
-# 47 "mysql_time.h"
-struct __attribute__((aligned(__alignof__(unsigned long int)))) st_mysql_time
- {
- unsigned int year;
- unsigned int month;
- unsigned int day;
- unsigned int hour;
- unsigned int minute;
- unsigned int second;
- unsigned long int second_part;
- my_bool neg;
- enum enum_mysql_timestamp_type time_type;
- };
-# 179 "mysql_com.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_net
- {
- Vio * vio;
- unsigned char * buff;
- unsigned char * buff_end;
- unsigned char * write_pos;
- unsigned char * read_pos;
- my_socket fd;
- unsigned long int max_packet;
- unsigned long int max_packet_size;
- unsigned int pkt_nr;
- unsigned int compress_pkt_nr;
- unsigned int write_timeout;
- unsigned int read_timeout;
- unsigned int retry_count;
- int fcntl;
- my_bool compress;
- unsigned long int remain_in_buf;
- unsigned long int length;
- unsigned long int buf_length;
- unsigned long int where_b;
- unsigned int * return_status;
- unsigned char reading_or_writing;
- char save_char;
- my_bool no_send_ok;
- my_bool no_send_eof;
- my_bool no_send_error;
- char last_error[512];
- char sqlstate[(5 + 1)];
- unsigned int last_errno;
- unsigned char error;
- gptr query_cache_query;
- my_bool report_error;
- my_bool return_errno;
- };
-# 22 "typelib.h"
-struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_typelib
- {
- unsigned int count;
- char const * name;
- char const * * type_names;
- unsigned int * type_lengths;
- };
-# 375 "mysql_com.h"
-struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_udf_args
- {
- unsigned int arg_count;
- enum Item_result * arg_type;
- char * * args;
- unsigned long int * lengths;
- char * maybe_null;
- char * * attributes;
- unsigned long int * attribute_lengths;
- };
-# 388 "mysql_com.h"
-struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(void *)))) st_udf_init
- {
- my_bool maybe_null;
- unsigned int decimals;
- unsigned long int max_length;
- char * ptr;
- my_bool const_item;
- };
-# 26 "my_alloc.h"
-struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned int)))) st_used_mem
- {
- struct st_used_mem * next;
- unsigned int left;
- unsigned int size;
- };
-# 372 "mysql_com.h"
-enum Item_result
- {
- STRING_RESULT = 0,
- REAL_RESULT = 1,
- INT_RESULT = 2,
- ROW_RESULT = 3,
- DECIMAL_RESULT = 4,
- };
-# 313 "mysql_com.h"
-enum enum_cursor_type
- {
- CURSOR_TYPE_NO_CURSOR = 0,
- CURSOR_TYPE_READ_ONLY = 1,
- CURSOR_TYPE_FOR_UPDATE = 2,
- CURSOR_TYPE_SCROLLABLE = 4,
- };
-# 226 "mysql_com.h"
-enum enum_field_types
- {
- MYSQL_TYPE_DECIMAL = 0,
- MYSQL_TYPE_TINY = 1,
- MYSQL_TYPE_SHORT = 2,
- MYSQL_TYPE_LONG = 3,
- MYSQL_TYPE_FLOAT = 4,
- MYSQL_TYPE_DOUBLE = 5,
- MYSQL_TYPE_NULL = 6,
- MYSQL_TYPE_TIMESTAMP = 7,
- MYSQL_TYPE_LONGLONG = 8,
- MYSQL_TYPE_INT24 = 9,
- MYSQL_TYPE_DATE = 10,
- MYSQL_TYPE_TIME = 11,
- MYSQL_TYPE_DATETIME = 12,
- MYSQL_TYPE_YEAR = 13,
- MYSQL_TYPE_NEWDATE = 14,
- MYSQL_TYPE_VARCHAR = 15,
- MYSQL_TYPE_BIT = 16,
- 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,
- };
-# 323 "mysql_com.h"
-enum enum_mysql_set_option
- {
- MYSQL_OPTION_MULTI_STATEMENTS_ON = 0,
- MYSQL_OPTION_MULTI_STATEMENTS_OFF = 1,
- };
-# 587 "mysql.h"
-enum enum_mysql_stmt_state
- {
- MYSQL_STMT_INIT_DONE = 1,
- MYSQL_STMT_PREPARE_DONE = 2,
- MYSQL_STMT_EXECUTE_DONE = 3,
- MYSQL_STMT_FETCH_DONE = 4,
- };
-# 28 "mysql_time.h"
-enum enum_mysql_timestamp_type
- {
- MYSQL_TIMESTAMP_NONE = -(2),
- MYSQL_TIMESTAMP_ERROR = -(1),
- MYSQL_TIMESTAMP_DATE = 0,
- MYSQL_TIMESTAMP_DATETIME = 1,
- MYSQL_TIMESTAMP_TIME = 2,
- };
-# 51 "mysql_com.h"
-enum enum_server_command
- {
- COM_SLEEP = 0,
- COM_QUIT = 1,
- COM_INIT_DB = 2,
- COM_QUERY = 3,
- COM_FIELD_LIST = 4,
- COM_CREATE_DB = 5,
- COM_DROP_DB = 6,
- COM_REFRESH = 7,
- COM_SHUTDOWN = 8,
- COM_STATISTICS = 9,
- COM_PROCESS_INFO = 10,
- COM_CONNECT = 11,
- COM_PROCESS_KILL = 12,
- COM_DEBUG = 13,
- COM_PING = 14,
- COM_TIME = 15,
- COM_DELAYED_INSERT = 16,
- COM_CHANGE_USER = 17,
- COM_BINLOG_DUMP = 18,
- COM_TABLE_DUMP = 19,
- COM_CONNECT_OUT = 20,
- COM_REGISTER_SLAVE = 21,
- COM_STMT_PREPARE = 22,
- COM_STMT_EXECUTE = 23,
- COM_STMT_SEND_LONG_DATA = 24,
- COM_STMT_CLOSE = 25,
- COM_STMT_RESET = 26,
- COM_SET_OPTION = 27,
- COM_STMT_FETCH = 28,
- COM_END = 29,
- };
-# 731 "mysql.h"
-enum enum_stmt_attr_type
- {
- STMT_ATTR_UPDATE_MAX_LENGTH = 0,
- STMT_ATTR_CURSOR_TYPE = 1,
- STMT_ATTR_PREFETCH_ROWS = 2,
- };
-# 288 "mysql_com.h"
-enum mysql_enum_shutdown_level
- {
- SHUTDOWN_DEFAULT = 0,
- SHUTDOWN_WAIT_CONNECTIONS = (unsigned char)((1 << 0)),
- SHUTDOWN_WAIT_TRANSACTIONS = (unsigned char)((1 << 1)),
- SHUTDOWN_WAIT_UPDATES = (unsigned char)((1 << 3)),
- SHUTDOWN_WAIT_ALL_BUFFERS = ((unsigned char)((1 << 3)) << 1),
- SHUTDOWN_WAIT_CRITICAL_BUFFERS = (((unsigned char)((1 << 3)) << 1) + 1),
- KILL_QUERY = 254,
- KILL_CONNECTION = 255,
- };
-# 158 "mysql.h"
-enum mysql_option
- {
- MYSQL_OPT_CONNECT_TIMEOUT = 0,
- MYSQL_OPT_COMPRESS = 1,
- MYSQL_OPT_NAMED_PIPE = 2,
- MYSQL_INIT_COMMAND = 3,
- MYSQL_READ_DEFAULT_FILE = 4,
- MYSQL_READ_DEFAULT_GROUP = 5,
- MYSQL_SET_CHARSET_DIR = 6,
- MYSQL_SET_CHARSET_NAME = 7,
- MYSQL_OPT_LOCAL_INFILE = 8,
- MYSQL_OPT_PROTOCOL = 9,
- MYSQL_SHARED_MEMORY_BASE_NAME = 10,
- MYSQL_OPT_READ_TIMEOUT = 11,
- MYSQL_OPT_WRITE_TIMEOUT = 12,
- MYSQL_OPT_USE_RESULT = 13,
- MYSQL_OPT_USE_REMOTE_CONNECTION = 14,
- MYSQL_OPT_USE_EMBEDDED_CONNECTION = 15,
- MYSQL_OPT_GUESS_CONNECTION = 16,
- MYSQL_SET_CLIENT_IP = 17,
- MYSQL_SECURE_AUTH = 18,
- MYSQL_REPORT_DATA_TRUNCATION = 19,
- MYSQL_OPT_RECONNECT = 20,
- MYSQL_OPT_SSL_VERIFY_SERVER_CERT = 21,
- };
-# 225 "mysql.h"
-enum mysql_protocol_type
- {
- MYSQL_PROTOCOL_DEFAULT = 0,
- MYSQL_PROTOCOL_TCP = 1,
- MYSQL_PROTOCOL_SOCKET = 2,
- MYSQL_PROTOCOL_PIPE = 3,
- MYSQL_PROTOCOL_MEMORY = 4,
- };
-# 235 "mysql.h"
-enum mysql_rpl_type
- {
- MYSQL_RPL_MASTER = 0,
- MYSQL_RPL_SLAVE = 1,
- MYSQL_RPL_ADMIN = 2,
- };
-# 220 "mysql.h"
-enum mysql_status
- {
- MYSQL_STATUS_READY = 0,
- MYSQL_STATUS_GET_RESULT = 1,
- MYSQL_STATUS_USE_RESULT = 2,
- };
-# 431 "mysql_com.h"
-extern my_bool check_scramble(char const * reply, char const * message, unsigned char const * hash_stage2);
-# 424 "mysql_com.h"
-extern my_bool check_scramble_323(char const *, char const * message, unsigned long int * salt);
-# 32 "typelib.h"
-extern TYPELIB * copy_typelib(MEM_ROOT * root, TYPELIB * from);
-# 419 "mysql_com.h"
-extern void create_random_string(char * to, unsigned int, struct rand_struct * rand_st);
-# 29 "typelib.h"
-extern int find_type(char * x, TYPELIB * typelib, unsigned int);
-# 433 "mysql_com.h"
-extern void get_salt_from_password(unsigned char * res, char const * password);
-# 426 "mysql_com.h"
-extern void get_salt_from_password_323(unsigned long int * res, char const * password);
-# 439 "mysql_com.h"
-extern char * get_tty_password(char * opt_message);
-# 31 "typelib.h"
-extern char const * get_type(TYPELIB * typelib, unsigned int);
-# 421 "mysql_com.h"
-extern void hash_password(unsigned long int * to, char const * password, unsigned int);
-# 30 "my_list.h"
-extern LIST * list_add(LIST * root, LIST * element);
-# 32 "my_list.h"
-extern LIST * list_cons(void * data, LIST * root);
-# 31 "my_list.h"
-extern LIST * list_delete(LIST * root, LIST * element);
-# 34 "my_list.h"
-extern void list_free(LIST * root, unsigned int);
-# 35 "my_list.h"
-extern unsigned int list_length(LIST *);
-# 33 "my_list.h"
-extern LIST * list_reverse(LIST * root);
-# 36 "my_list.h"
-extern int list_walk(LIST *, list_walk_action, gptr);
-# 448 "mysql_com.h"
-extern int load_defaults(char const * conf_file, char const * * groups, int * argc, char * * * argv);
-# 434 "mysql_com.h"
-extern void make_password_from_salt(char * to, unsigned char const * hash_stage2);
-# 427 "mysql_com.h"
-extern void make_password_from_salt_323(char * to, unsigned long int const * salt);
-# 429 "mysql_com.h"
-extern void make_scrambled_password(char * to, char const * password);
-# 422 "mysql_com.h"
-extern void make_scrambled_password_323(char * to, char const * password);
-# 30 "typelib.h"
-extern void make_type(char * to, unsigned int, TYPELIB * typelib);
-# 445 "mysql_com.h"
-extern int modify_defaults_file(char const * file_location, char const * option, char const * option_value, char const * section_name, int);
-# 358 "mysql_com.h"
-extern int my_connect(my_socket, struct sockaddr const * name, unsigned int, unsigned int);
-# 444 "mysql_com.h"
-extern my_bool my_init(void);
-# 335 "mysql_com.h"
-extern my_bool my_net_init(NET * net, Vio * vio);
-# 336 "mysql_com.h"
-extern void my_net_local_init(NET * net);
-# 346 "mysql_com.h"
-extern unsigned long int my_net_read(NET * net);
-# 341 "mysql_com.h"
-extern my_bool my_net_write(NET * net, char const * packet, unsigned long int);
-# 418 "mysql_com.h"
-extern double my_rnd(struct rand_struct *);
-# 451 "mysql_com.h"
-extern void my_thread_end(void);
-# 450 "mysql_com.h"
-extern my_bool my_thread_init(void);
-# 563 "mysql.h"
-extern void myodbc_remove_escape(MYSQL * mysql, char * name);
-# 505 "mysql.h"
-extern int mysql_add_slave(MYSQL * mysql, char const * host, unsigned int, char const * user, char const * passwd);
-# 414 "mysql.h"
-extern my_ulonglong mysql_affected_rows(MYSQL * mysql);
-# 827 "mysql.h"
-extern my_bool mysql_autocommit(MYSQL * mysql, my_bool);
-# 430 "mysql.h"
-extern my_bool mysql_change_user(MYSQL * mysql, char const * user, char const * passwd, char const * db);
-# 422 "mysql.h"
-extern char const * mysql_character_set_name(MYSQL * mysql);
-# 830 "mysql.h"
-extern void mysql_close(MYSQL * sock);
-# 825 "mysql.h"
-extern my_bool mysql_commit(MYSQL * mysql);
-# 534 "mysql.h"
-extern void mysql_data_seek(MYSQL_RES * result, my_ulonglong);
-# 552 "mysql.h"
-extern void mysql_debug(char const * debug);
-# 491 "mysql.h"
-extern void mysql_disable_reads_from_master(MYSQL * mysql);
-# 485 "mysql.h"
-extern void mysql_disable_rpl_parse(MYSQL * mysql);
-# 513 "mysql.h"
-extern int mysql_dump_debug_info(MYSQL * mysql);
-# 565 "mysql.h"
-extern my_bool mysql_embedded(void);
-# 490 "mysql.h"
-extern void mysql_enable_reads_from_master(MYSQL * mysql);
-# 484 "mysql.h"
-extern void mysql_enable_rpl_parse(MYSQL * mysql);
-# 406 "mysql.h"
-extern my_bool mysql_eof(MYSQL_RES * res);
-# 416 "mysql.h"
-extern unsigned int mysql_errno(MYSQL * mysql);
-# 440 "mysql_com.h"
-extern char const * mysql_errno_to_sqlstate(unsigned int);
-# 417 "mysql.h"
-extern char const * mysql_error(MYSQL * mysql);
-# 545 "mysql.h"
-extern unsigned long int mysql_escape_string(char * to, char const * from, unsigned long int);
-# 542 "mysql.h"
-extern MYSQL_FIELD * mysql_fetch_field(MYSQL_RES * result);
-# 407 "mysql.h"
-extern MYSQL_FIELD * mysql_fetch_field_direct(MYSQL_RES * res, unsigned int);
-# 409 "mysql.h"
-extern MYSQL_FIELD * mysql_fetch_fields(MYSQL_RES * res);
-# 541 "mysql.h"
-extern unsigned long int * mysql_fetch_lengths(MYSQL_RES * result);
-# 540 "mysql.h"
-extern MYSQL_ROW mysql_fetch_row(MYSQL_RES * result);
-# 413 "mysql.h"
-extern unsigned int mysql_field_count(MYSQL * mysql);
-# 538 "mysql.h"
-extern MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES * result, MYSQL_FIELD_OFFSET);
-# 411 "mysql.h"
-extern MYSQL_FIELD_OFFSET mysql_field_tell(MYSQL_RES * res);
-# 533 "mysql.h"
-extern void mysql_free_result(MYSQL_RES * result);
-# 458 "mysql.h"
-extern void mysql_get_character_set_info(MYSQL * mysql, MY_CHARSET_INFO * charset);
-# 523 "mysql.h"
-extern char const * mysql_get_client_info(void);
-# 524 "mysql.h"
-extern unsigned long int mysql_get_client_version(void);
-# 525 "mysql.h"
-extern char const * mysql_get_host_info(MYSQL * mysql);
-# 388 "mysql.h"
-extern MYSQL_PARAMETERS * mysql_get_parameters(void);
-# 527 "mysql.h"
-extern unsigned int mysql_get_proto_info(MYSQL * mysql);
-# 522 "mysql.h"
-extern char const * mysql_get_server_info(MYSQL * mysql);
-# 526 "mysql.h"
-extern unsigned long int mysql_get_server_version(MYSQL * mysql);
-# 429 "mysql.h"
-extern char const * mysql_get_ssl_cipher(MYSQL * mysql);
-# 547 "mysql.h"
-extern unsigned long int mysql_hex_string(char * to, char const * from, unsigned long int);
-# 420 "mysql.h"
-extern char const * mysql_info(MYSQL * mysql);
-# 425 "mysql.h"
-extern MYSQL * mysql_init(MYSQL * mysql);
-# 415 "mysql.h"
-extern my_ulonglong mysql_insert_id(MYSQL * mysql);
-# 516 "mysql.h"
-extern int mysql_kill(MYSQL * mysql, unsigned long int);
-# 528 "mysql.h"
-extern MYSQL_RES * mysql_list_dbs(MYSQL * mysql, char const * wild);
-# 543 "mysql.h"
-extern MYSQL_RES * mysql_list_fields(MYSQL * mysql, char const * table, char const * wild);
-# 530 "mysql.h"
-extern MYSQL_RES * mysql_list_processes(MYSQL * mysql);
-# 529 "mysql.h"
-extern MYSQL_RES * mysql_list_tables(MYSQL * mysql, char const * wild);
-# 572 "mysql.h"
-extern void mysql_manager_close(MYSQL_MANAGER * con);
-# 573 "mysql.h"
-extern int mysql_manager_command(MYSQL_MANAGER * con, char const * cmd, int);
-# 567 "mysql.h"
-extern MYSQL_MANAGER * mysql_manager_connect(MYSQL_MANAGER * con, char const * host, char const * user, char const * passwd, unsigned int);
-# 575 "mysql.h"
-extern int mysql_manager_fetch_line(MYSQL_MANAGER * con, char * res_buf, int);
-# 566 "mysql.h"
-extern MYSQL_MANAGER * mysql_manager_init(MYSQL_MANAGER * con);
-# 449 "mysql.h"
-extern my_bool mysql_master_query(MYSQL * mysql, char const * q, unsigned long int);
-# 451 "mysql.h"
-extern my_bool mysql_master_send_query(MYSQL * mysql, char const * q, unsigned long int);
-# 828 "mysql.h"
-extern my_bool mysql_more_results(MYSQL * mysql);
-# 829 "mysql.h"
-extern int mysql_next_result(MYSQL * mysql);
-# 405 "mysql.h"
-extern unsigned int mysql_num_fields(MYSQL_RES * res);
-# 404 "mysql.h"
-extern my_ulonglong mysql_num_rows(MYSQL_RES * res);
-# 553 "mysql.h"
-extern char * mysql_odbc_escape_string(MYSQL * mysql, char * to, unsigned long int, char const * from, unsigned long int, void * param, char * (* extend_buffer)(void *, char * to, unsigned long int * length));
-# 531 "mysql.h"
-extern int mysql_options(MYSQL * mysql, enum mysql_option, char const * arg);
-# 520 "mysql.h"
-extern int mysql_ping(MYSQL * mysql);
-# 78 "mysql.h"
-extern unsigned int mysql_port;
-# 440 "mysql.h"
-extern int mysql_query(MYSQL * mysql, char const * q);
-# 578 "mysql.h"
-extern my_bool mysql_read_query_result(MYSQL * mysql);
-# 493 "mysql.h"
-extern my_bool mysql_reads_from_master_enabled(MYSQL * mysql);
-# 432 "mysql.h"
-extern MYSQL * mysql_real_connect(MYSQL * mysql, char const * host, char const * user, char const * passwd, char const * db, unsigned int, char const * unix_socket, unsigned long int);
-# 549 "mysql.h"
-extern unsigned long int mysql_real_escape_string(MYSQL * mysql, char * to, char const * from, unsigned long int);
-# 443 "mysql.h"
-extern int mysql_real_query(MYSQL * mysql, char const * q, unsigned long int);
-# 514 "mysql.h"
-extern int mysql_refresh(MYSQL * mysql, unsigned int);
-# 826 "mysql.h"
-extern my_bool mysql_rollback(MYSQL * mysql);
-# 536 "mysql.h"
-extern MYSQL_ROW_OFFSET mysql_row_seek(MYSQL_RES * result, MYSQL_ROW_OFFSET);
-# 410 "mysql.h"
-extern MYSQL_ROW_OFFSET mysql_row_tell(MYSQL_RES * res);
-# 487 "mysql.h"
-extern int mysql_rpl_parse_enabled(MYSQL * mysql);
-# 498 "mysql.h"
-extern my_bool mysql_rpl_probe(MYSQL * mysql);
-# 495 "mysql.h"
-extern enum mysql_rpl_type mysql_rpl_query_type(char const * q, int);
-# 439 "mysql.h"
-extern int mysql_select_db(MYSQL * mysql, char const * db);
-# 441 "mysql.h"
-extern int mysql_send_query(MYSQL * mysql, char const * q, unsigned long int);
-# 375 "mysql.h"
-extern void mysql_server_end(void);
-# 374 "mysql.h"
-extern int mysql_server_init(int, char * * argv, char * * groups);
-# 423 "mysql.h"
-extern int mysql_set_character_set(MYSQL * mysql, char const * csname);
-# 476 "mysql.h"
-extern void mysql_set_local_infile_default(MYSQL * mysql);
-# 465 "mysql.h"
-extern void mysql_set_local_infile_handler(MYSQL * mysql, int (* local_infile_init)(void * *, char const *, void *), int (* local_infile_read)(void *, char *, unsigned int), void (* local_infile_end)(void), int (* local_infile_error)(void *, char *, unsigned int), void *);
-# 501 "mysql.h"
-extern int mysql_set_master(MYSQL * mysql, char const * host, unsigned int, char const * user, char const * passwd);
-# 517 "mysql.h"
-extern int mysql_set_server_option(MYSQL * mysql, enum enum_mysql_set_option);
-# 510 "mysql.h"
-extern int mysql_shutdown(MYSQL * mysql, enum mysql_enum_shutdown_level);
-# 454 "mysql.h"
-extern my_bool mysql_slave_query(MYSQL * mysql, char const * q, unsigned long int);
-# 456 "mysql.h"
-extern my_bool mysql_slave_send_query(MYSQL * mysql, char const * q, unsigned long int);
-# 418 "mysql.h"
-extern char const * mysql_sqlstate(MYSQL * mysql);
-# 426 "mysql.h"
-extern my_bool mysql_ssl_set(MYSQL * mysql, char const * key, char const * cert, char const * ca, char const * capath, char const * cipher);
-# 521 "mysql.h"
-extern char const * mysql_stat(MYSQL * mysql);
-# 821 "mysql.h"
-extern my_ulonglong mysql_stmt_affected_rows(MYSQL_STMT * stmt);
-# 799 "mysql.h"
-extern my_bool mysql_stmt_attr_get(MYSQL_STMT * stmt, enum enum_stmt_attr_type, void * attr);
-# 796 "mysql.h"
-extern my_bool mysql_stmt_attr_set(MYSQL_STMT * stmt, enum enum_stmt_attr_type, void const * attr);
-# 802 "mysql.h"
-extern my_bool mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
-# 803 "mysql.h"
-extern my_bool mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
-# 804 "mysql.h"
-extern my_bool mysql_stmt_close(MYSQL_STMT * stmt);
-# 819 "mysql.h"
-extern void mysql_stmt_data_seek(MYSQL_STMT * stmt, my_ulonglong);
-# 813 "mysql.h"
-extern unsigned int mysql_stmt_errno(MYSQL_STMT * stmt);
-# 814 "mysql.h"
-extern char const * mysql_stmt_error(MYSQL_STMT * stmt);
-# 789 "mysql.h"
-extern int mysql_stmt_execute(MYSQL_STMT * stmt);
-# 790 "mysql.h"
-extern int mysql_stmt_fetch(MYSQL_STMT * stmt);
-# 791 "mysql.h"
-extern int mysql_stmt_fetch_column(MYSQL_STMT * stmt, MYSQL_BIND * bind_arg, unsigned int, unsigned long int);
-# 823 "mysql.h"
-extern unsigned int mysql_stmt_field_count(MYSQL_STMT * stmt);
-# 806 "mysql.h"
-extern my_bool mysql_stmt_free_result(MYSQL_STMT * stmt);
-# 786 "mysql.h"
-extern MYSQL_STMT * mysql_stmt_init(MYSQL * mysql);
-# 822 "mysql.h"
-extern my_ulonglong mysql_stmt_insert_id(MYSQL_STMT * stmt);
-# 820 "mysql.h"
-extern my_ulonglong mysql_stmt_num_rows(MYSQL_STMT * stmt);
-# 795 "mysql.h"
-extern unsigned long int mysql_stmt_param_count(MYSQL_STMT * stmt);
-# 812 "mysql.h"
-extern MYSQL_RES * mysql_stmt_param_metadata(MYSQL_STMT * stmt);
-# 787 "mysql.h"
-extern int mysql_stmt_prepare(MYSQL_STMT * stmt, char const * query, unsigned long int);
-# 805 "mysql.h"
-extern my_bool mysql_stmt_reset(MYSQL_STMT * stmt);
-# 811 "mysql.h"
-extern MYSQL_RES * mysql_stmt_result_metadata(MYSQL_STMT * stmt);
-# 816 "mysql.h"
-extern MYSQL_ROW_OFFSET mysql_stmt_row_seek(MYSQL_STMT * stmt, MYSQL_ROW_OFFSET);
-# 818 "mysql.h"
-extern MYSQL_ROW_OFFSET mysql_stmt_row_tell(MYSQL_STMT * stmt);
-# 807 "mysql.h"
-extern my_bool mysql_stmt_send_long_data(MYSQL_STMT * stmt, unsigned int, char const * data, unsigned long int);
-# 815 "mysql.h"
-extern char const * mysql_stmt_sqlstate(MYSQL_STMT * stmt);
-# 794 "mysql.h"
-extern int mysql_stmt_store_result(MYSQL_STMT * stmt);
-# 445 "mysql.h"
-extern MYSQL_RES * mysql_store_result(MYSQL * mysql);
-# 397 "mysql.h"
-extern void mysql_thread_end(void);
-# 421 "mysql.h"
-extern unsigned long int mysql_thread_id(MYSQL * mysql);
-# 396 "mysql.h"
-extern my_bool mysql_thread_init(void);
-# 564 "mysql.h"
-extern unsigned int mysql_thread_safe(void);
-# 79 "mysql.h"
-extern char * mysql_unix_port;
-# 446 "mysql.h"
-extern MYSQL_RES * mysql_use_result(MYSQL * mysql);
-# 419 "mysql.h"
-extern unsigned int mysql_warning_count(MYSQL * mysql);
-# 338 "mysql_com.h"
-extern void net_clear(NET * net);
-# 337 "mysql_com.h"
-extern void net_end(NET * net);
-# 340 "mysql_com.h"
-extern my_bool net_flush(NET * net);
-# 345 "mysql_com.h"
-extern int net_real_write(NET * net, char const * packet, unsigned long int);
-# 339 "mysql_com.h"
-extern my_bool net_realloc(NET * net, unsigned long int);
-# 342 "mysql_com.h"
-extern my_bool net_write_command(NET * net, unsigned char, char const * header, unsigned long int, char const * packet, unsigned long int);
-# 435 "mysql_com.h"
-extern char * octet2hex(char * to, char const * str, unsigned int);
-# 416 "mysql_com.h"
-extern void randominit(struct rand_struct *, unsigned long int, unsigned long int);
-# 430 "mysql_com.h"
-extern void scramble(char * to, char const * message, char const * password);
-# 423 "mysql_com.h"
-extern void scramble_323(char * to, char const * message, char const * password);
-# 34 "typelib.h"
-extern TYPELIB sql_protocol_typelib;
diff --git a/include/mysys_err.h b/include/mysys_err.h
index 877b9c41856..e51ccf0163c 100644
--- a/include/mysys_err.h
+++ b/include/mysys_err.h
@@ -1,4 +1,5 @@
-/* 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
@@ -11,7 +12,8 @@
You 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 _mysys_err_h
#define _mysys_err_h
@@ -61,7 +63,11 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EE_SYNC 27
#define EE_UNKNOWN_COLLATION 28
#define EE_FILENOTFOUND 29
-#define EE_ERROR_LAST 29 /*Copy last error nr.*/
+#define EE_FILE_NOT_CLOSED 30
+#define EE_CHANGE_OWNERSHIP 31
+#define EE_CHANGE_PERMISSIONS 32
+#define EE_CANT_SEEK 33
+#define EE_ERROR_LAST 33 /* Copy last error nr */
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
/* exit codes for all MySQL programs */
@@ -78,6 +84,7 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EXIT_NO_PTR_TO_VARIABLE 10
#define EXIT_CANNOT_CONNECT_TO_SERVICE 11
#define EXIT_OPTION_DISABLED 12
+#define EXIT_ARGUMENT_INVALID 13
#ifdef __cplusplus
diff --git a/include/queues.h b/include/queues.h
index 14f0922e19c..d01b73ba999 100644
--- a/include/queues.h
+++ b/include/queues.h
@@ -27,32 +27,41 @@ extern "C" {
#endif
typedef struct st_queue {
- byte **root;
+ uchar **root;
void *first_cmp_arg;
uint elements;
uint max_elements;
- uint offset_to_key; /* compare is done on element+offset */
- int max_at_top; /* Set if queue_top gives max */
- int (*compare)(void *, byte *,byte *);
+ uint offset_to_key; /* compare is done on element+offset */
+ int max_at_top; /* Normally 1, set to -1 if queue_top gives max */
+ int (*compare)(void *, uchar *,uchar *);
+ uint auto_extent;
} QUEUE;
#define queue_top(queue) ((queue)->root[1])
#define queue_element(queue,index) ((queue)->root[index+1])
#define queue_end(queue) ((queue)->root[(queue)->elements])
#define queue_replaced(queue) _downheap(queue,1)
-typedef int (*queue_compare)(void *,byte *, byte *);
+#define queue_set_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg
+#define queue_set_max_at_top(queue, set_arg) \
+ (queue)->max_at_top= set_arg ? -1 : 1
+typedef int (*queue_compare)(void *,uchar *, uchar *);
int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
pbool max_at_top, queue_compare compare,
void *first_cmp_arg);
+int init_queue_ex(QUEUE *queue,uint max_elements,uint offset_to_key,
+ pbool max_at_top, queue_compare compare,
+ void *first_cmp_arg, uint auto_extent);
int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
pbool max_at_top, queue_compare compare,
void *first_cmp_arg);
int resize_queue(QUEUE *queue, uint max_elements);
void delete_queue(QUEUE *queue);
-void queue_insert(QUEUE *queue,byte *element);
-byte *queue_remove(QUEUE *queue,uint idx);
+void queue_insert(QUEUE *queue,uchar *element);
+int queue_insert_safe(QUEUE *queue, uchar *element);
+uchar *queue_remove(QUEUE *queue,uint idx);
#define queue_remove_all(queue) { (queue)->elements= 0; }
+#define queue_is_full(queue) (queue->elements == queue->max_elements)
void _downheap(QUEUE *queue,uint idx);
void queue_fix(QUEUE *queue);
#define is_queue_inited(queue) ((queue)->root != 0)
diff --git a/include/raid.h b/include/raid.h
deleted file mode 100644
index 9d098305d14..00000000000
--- a/include/raid.h
+++ /dev/null
@@ -1,158 +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; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You 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: %lu _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: %lu this_block: %d _remaining_bytes: %d",
- _total_block, _this_block, _remaining_bytes));
- DBUG_VOID_RETURN;
- }
-};
-
-#endif /* __cplusplus */
-#endif /* USE_RAID */
diff --git a/include/sql_common.h b/include/sql_common.h
index 32487f7e569..9e43d076ba9 100644
--- a/include/sql_common.h
+++ b/include/sql_common.h
@@ -33,12 +33,14 @@ 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 char *header, ulong header_length,
- const char *arg, ulong arg_length, my_bool skip_check,
- MYSQL_STMT *stmt);
+ const unsigned char *header, ulong header_length,
+ const unsigned char *arg, ulong arg_length,
+ my_bool skip_check, MYSQL_STMT *stmt);
unsigned long cli_safe_read(MYSQL *mysql);
-void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
- const char *sqlstate);
+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);
#ifdef __cplusplus
}
diff --git a/include/sslopt-longopts.h b/include/sslopt-longopts.h
index d4aaf50992d..16037e4d6cd 100644
--- a/include/sslopt-longopts.h
+++ b/include/sslopt-longopts.h
@@ -1,4 +1,5 @@
-/* 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
@@ -11,35 +12,37 @@
You 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
+*/
#ifdef HAVE_OPENSSL
{"ssl", OPT_SSL_SSL,
- "Enable SSL for connection (automatically enabled with other flags). Disable with --skip-ssl.",
- (gptr*) &opt_use_ssl, (gptr*) &opt_use_ssl, 0, GET_BOOL, NO_ARG, 0, 0, 0,
- 0, 0, 0},
+ "Enable SSL for connection (automatically enabled with other flags)."
+ "Disable with --skip-ssl.", &opt_use_ssl, &opt_use_ssl, 0, GET_BOOL,
+ NO_ARG, 0, 0, 0, 0, 0, 0},
{"ssl-ca", OPT_SSL_CA,
"CA file in PEM format (check OpenSSL docs, implies --ssl).",
- (gptr*) &opt_ssl_ca, (gptr*) &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
+ &opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-capath", OPT_SSL_CAPATH,
"CA directory (check OpenSSL docs, implies --ssl).",
- (gptr*) &opt_ssl_capath, (gptr*) &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
+ &opt_ssl_capath, &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-cert", OPT_SSL_CERT, "X509 cert in PEM format (implies --ssl).",
- (gptr*) &opt_ssl_cert, (gptr*) &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
+ &opt_ssl_cert, &opt_ssl_cert, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-cipher", OPT_SSL_CIPHER, "SSL cipher to use (implies --ssl).",
- (gptr*) &opt_ssl_cipher, (gptr*) &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG,
+ &opt_ssl_cipher, &opt_ssl_cipher, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).",
- (gptr*) &opt_ssl_key, (gptr*) &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
+ &opt_ssl_key, &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifdef MYSQL_CLIENT
{"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT,
- "Verify server's \"Common Name\" in its cert against hostname used when connecting. This option is disabled by default.",
- (gptr*) &opt_ssl_verify_server_cert, (gptr*) &opt_ssl_verify_server_cert,
+ "Verify server's \"Common Name\" in its cert against hostname used "
+ "when connecting. This option is disabled by default.",
+ &opt_ssl_verify_server_cert, &opt_ssl_verify_server_cert,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
#endif /* HAVE_OPENSSL */
diff --git a/include/thr_alarm.h b/include/thr_alarm.h
index fe0a8f21b92..fb906039269 100644
--- a/include/thr_alarm.h
+++ b/include/thr_alarm.h
@@ -67,14 +67,6 @@ typedef struct st_thr_alarm_entry
rf_SetTimer crono;
} thr_alarm_entry;
-#elif defined(__EMX__) || defined(OS2)
-
-typedef struct st_thr_alarm_entry
-{
- uint crono;
- uint event;
-} thr_alarm_entry;
-
#else /* System with posix threads */
typedef int thr_alarm_entry;
@@ -89,6 +81,7 @@ typedef struct st_alarm {
ulong expire_time;
thr_alarm_entry alarmed; /* set when alarm is due */
pthread_t thread;
+ my_thread_id thread_id;
my_bool malloced;
} ALARM;
@@ -100,12 +93,12 @@ extern pthread_t alarm_thread;
void init_thr_alarm(uint max_alarm);
void resize_thr_alarm(uint max_alarms);
my_bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
-void thr_alarm_kill(pthread_t thread_id);
+void thr_alarm_kill(my_thread_id thread_id);
void thr_end_alarm(thr_alarm_t *alarmed);
void end_thr_alarm(my_bool free_structures);
sig_handler process_alarm(int);
#ifndef thr_got_alarm
-bool thr_got_alarm(thr_alarm_t *alrm);
+my_bool thr_got_alarm(thr_alarm_t *alrm);
#endif
diff --git a/include/thr_lock.h b/include/thr_lock.h
index aa5eb7426ae..90e34fc15f6 100644
--- a/include/thr_lock.h
+++ b/include/thr_lock.h
@@ -1,4 +1,6 @@
-/* Copyright (C) 2000 MySQL AB
+/*
+ Copyright (c) 2000-2003, 2005-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
+ Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,7 +13,8 @@
You 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
+*/
/* For use with thr_lock:s */
@@ -27,8 +30,20 @@ extern "C" {
struct st_thr_lock;
extern ulong locks_immediate,locks_waited ;
+/*
+ Important: if a new lock type is added, a matching lock description
+ must be added to sql_test.cc's lock_descriptions array.
+*/
enum thr_lock_type { TL_IGNORE=-1,
TL_UNLOCK, /* UNLOCK ANY LOCK */
+ /*
+ Parser only! At open_tables() becomes TL_READ or
+ TL_READ_NO_INSERT depending on the binary log format
+ (SBR/RBR) and on the table category (log table).
+ Used for tables that are read by statements which
+ modify tables.
+ */
+ TL_READ_DEFAULT,
TL_READ, /* Read lock */
TL_READ_WITH_SHARED_LOCKS,
/* High prior. than TL_WRITE. Allow concurrent insert */
@@ -83,7 +98,7 @@ extern enum thr_lock_type thr_upgraded_concurrent_insert_lock;
typedef struct st_thr_lock_info
{
pthread_t thread;
- ulong thread_id;
+ my_thread_id thread_id;
ulong n_cursors;
} THR_LOCK_INFO;
@@ -148,10 +163,13 @@ void thr_unlock(THR_LOCK_DATA *data);
enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data,
uint count, THR_LOCK_OWNER *owner);
void thr_multi_unlock(THR_LOCK_DATA **data,uint count);
-void thr_abort_locks(THR_LOCK *lock);
-my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread);
+void thr_abort_locks(THR_LOCK *lock, my_bool upgrade_lock);
+my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread);
void thr_print_locks(void); /* For debugging */
-my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data);
+my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data,
+ enum thr_lock_type new_lock_type);
+void thr_downgrade_write_lock(THR_LOCK_DATA *data,
+ enum thr_lock_type new_lock_type);
my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data);
#ifdef __cplusplus
}
diff --git a/include/typelib.h b/include/typelib.h
index 75d170e59d3..46106d1bdab 100644
--- a/include/typelib.h
+++ b/include/typelib.h
@@ -26,7 +26,10 @@ 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);
+extern int find_type(char *x, const TYPELIB *typelib, unsigned int full_name);
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);
diff --git a/include/violite.h b/include/violite.h
index add42bf03ca..32354938e13 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -47,15 +47,15 @@ enum enum_vio_type
Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags);
#ifdef __WIN__
Vio* vio_new_win32pipe(HANDLE hPipe);
-Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map,
+Vio* vio_new_win32shared_memory(HANDLE handle_file_map,
HANDLE handle_map,
HANDLE event_server_wrote,
HANDLE event_server_read,
HANDLE event_client_wrote,
HANDLE event_client_read,
HANDLE event_conn_closed);
-int vio_read_pipe(Vio *vio, gptr buf, int size);
-int vio_write_pipe(Vio *vio, const gptr buf, int size);
+size_t vio_read_pipe(Vio *vio, uchar * buf, size_t size);
+size_t vio_write_pipe(Vio *vio, const uchar * buf, size_t size);
int vio_close_pipe(Vio * vio);
#else
#define HANDLE void *
@@ -65,9 +65,9 @@ void vio_delete(Vio* vio);
int vio_close(Vio* vio);
void vio_reset(Vio* vio, enum enum_vio_type type,
my_socket sd, HANDLE hPipe, uint flags);
-int vio_read(Vio *vio, gptr buf, int size);
-int vio_read_buff(Vio *vio, gptr buf, int size);
-int vio_write(Vio *vio, const gptr buf, int size);
+size_t vio_read(Vio *vio, uchar * buf, size_t size);
+size_t vio_read_buff(Vio *vio, uchar * buf, size_t size);
+size_t vio_write(Vio *vio, const uchar * buf, size_t size);
int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode);
my_bool vio_is_blocking(Vio *vio);
/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */
@@ -136,11 +136,12 @@ struct st_VioSSLFd
*new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
const char *ca_file,const char *ca_path,
const char *cipher, enum enum_ssl_init_error* error);
+void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd);
#endif /* HAVE_OPENSSL */
#ifdef HAVE_SMEM
-int vio_read_shared_memory(Vio *vio, gptr buf, int size);
-int vio_write_shared_memory(Vio *vio, const gptr buf, int size);
+size_t vio_read_shared_memory(Vio *vio, uchar * buf, size_t size);
+size_t vio_write_shared_memory(Vio *vio, const uchar * buf, size_t size);
int vio_close_shared_memory(Vio * vio);
#endif
@@ -198,8 +199,8 @@ struct st_vio
/* function pointers. They are similar for socket/SSL/whatever */
void (*viodelete)(Vio*);
int (*vioerrno)(Vio*);
- int (*read)(Vio*, gptr, int);
- int (*write)(Vio*, const gptr, int);
+ size_t (*read)(Vio*, uchar *, size_t);
+ size_t (*write)(Vio*, const uchar *, size_t);
int (*vioblocking)(Vio*, my_bool, my_bool *);
my_bool (*is_blocking)(Vio*);
int (*viokeepalive)(Vio*, my_bool);
@@ -221,9 +222,13 @@ struct st_vio
HANDLE event_client_wrote;
HANDLE event_client_read;
HANDLE event_conn_closed;
- long shared_memory_remain;
+ size_t shared_memory_remain;
char *shared_memory_pos;
- NET *net;
#endif /* HAVE_SMEM */
+#ifdef _WIN32
+ OVERLAPPED pipe_overlapped;
+ DWORD read_timeout_ms;
+ DWORD write_timeout_ms;
+#endif
};
#endif /* vio_violite_h_ */