mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-05 12:03:48 +00:00
restructured repository based on following standards:
https://github.com/HW-Core/directory-structure
This commit is contained in:
42
modules/dep/mysqllite/include/internal/atomic/gcc_builtins.h
Normal file
42
modules/dep/mysqllite/include/internal/atomic/gcc_builtins.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef ATOMIC_GCC_BUILTINS_INCLUDED
|
||||
#define ATOMIC_GCC_BUILTINS_INCLUDED
|
||||
|
||||
/* Copyright (C) 2008 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define make_atomic_add_body(S) \
|
||||
v= __sync_fetch_and_add(a, v);
|
||||
#define make_atomic_fas_body(S) \
|
||||
v= __sync_lock_test_and_set(a, v);
|
||||
#define make_atomic_cas_body(S) \
|
||||
int ## S sav; \
|
||||
int ## S cmp_val= *cmp; \
|
||||
sav= __sync_val_compare_and_swap(a, cmp_val, set);\
|
||||
if (!(ret= (sav == cmp_val))) *cmp= sav
|
||||
|
||||
#ifdef MY_ATOMIC_MODE_DUMMY
|
||||
#define make_atomic_load_body(S) ret= *a
|
||||
#define make_atomic_store_body(S) *a= v
|
||||
#define MY_ATOMIC_MODE "gcc-builtins-up"
|
||||
|
||||
#else
|
||||
#define MY_ATOMIC_MODE "gcc-builtins-smp"
|
||||
#define make_atomic_load_body(S) \
|
||||
ret= __sync_fetch_and_or(a, 0);
|
||||
#define make_atomic_store_body(S) \
|
||||
(void) __sync_lock_test_and_set(a, v);
|
||||
#endif
|
||||
|
||||
#endif /* ATOMIC_GCC_BUILTINS_INCLUDED */
|
||||
134
modules/dep/mysqllite/include/internal/atomic/generic-msvc.h
Normal file
134
modules/dep/mysqllite/include/internal/atomic/generic-msvc.h
Normal file
@@ -0,0 +1,134 @@
|
||||
/* Copyright (C) 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifndef _atomic_h_cleanup_
|
||||
#define _atomic_h_cleanup_ "atomic/generic-msvc.h"
|
||||
|
||||
/*
|
||||
We don't implement anything specific for MY_ATOMIC_MODE_DUMMY, always use
|
||||
intrinsics.
|
||||
8 and 16-bit atomics are not implemented, but it can be done if necessary.
|
||||
*/
|
||||
#undef MY_ATOMIC_HAS_8_16
|
||||
|
||||
#include <windows.h>
|
||||
/*
|
||||
x86 compilers (both VS2003 or VS2005) never use instrinsics, but generate
|
||||
function calls to kernel32 instead, even in the optimized build.
|
||||
We force intrinsics as described in MSDN documentation for
|
||||
_InterlockedCompareExchange.
|
||||
*/
|
||||
#ifdef _M_IX86
|
||||
|
||||
#if (_MSC_VER >= 1500)
|
||||
#include <intrin.h>
|
||||
#else
|
||||
C_MODE_START
|
||||
/*Visual Studio 2003 and earlier do not have prototypes for atomic intrinsics*/
|
||||
LONG _InterlockedCompareExchange (LONG volatile *Target, LONG Value, LONG Comp);
|
||||
LONGLONG _InterlockedCompareExchange64 (LONGLONG volatile *Target,
|
||||
LONGLONG Value, LONGLONG Comp);
|
||||
C_MODE_END
|
||||
|
||||
#pragma intrinsic(_InterlockedCompareExchange)
|
||||
#pragma intrinsic(_InterlockedCompareExchange64)
|
||||
#endif
|
||||
|
||||
#define InterlockedCompareExchange _InterlockedCompareExchange
|
||||
#define InterlockedCompareExchange64 _InterlockedCompareExchange64
|
||||
/*
|
||||
No need to do something special for InterlockedCompareExchangePointer
|
||||
as it is a #define to InterlockedCompareExchange. The same applies to
|
||||
InterlockedExchangePointer.
|
||||
*/
|
||||
#endif /*_M_IX86*/
|
||||
|
||||
#define MY_ATOMIC_MODE "msvc-intrinsics"
|
||||
/* Implement using CAS on WIN32 */
|
||||
#define IL_COMP_EXCHG32(X,Y,Z) \
|
||||
InterlockedCompareExchange((volatile LONG *)(X),(Y),(Z))
|
||||
#define IL_COMP_EXCHG64(X,Y,Z) \
|
||||
InterlockedCompareExchange64((volatile LONGLONG *)(X), \
|
||||
(LONGLONG)(Y),(LONGLONG)(Z))
|
||||
#define IL_COMP_EXCHGptr InterlockedCompareExchangePointer
|
||||
|
||||
#define make_atomic_cas_body(S) \
|
||||
int ## S initial_cmp= *cmp; \
|
||||
int ## S initial_a= IL_COMP_EXCHG ## S (a, set, initial_cmp); \
|
||||
if (!(ret= (initial_a == initial_cmp))) *cmp= initial_a;
|
||||
|
||||
#ifndef _M_IX86
|
||||
/* Use full set of optimised functions on WIN64 */
|
||||
#define IL_EXCHG_ADD32(X,Y) \
|
||||
InterlockedExchangeAdd((volatile LONG *)(X),(Y))
|
||||
#define IL_EXCHG_ADD64(X,Y) \
|
||||
InterlockedExchangeAdd64((volatile LONGLONG *)(X),(LONGLONG)(Y))
|
||||
#define IL_EXCHG32(X,Y) \
|
||||
InterlockedExchange((volatile LONG *)(X),(Y))
|
||||
#define IL_EXCHG64(X,Y) \
|
||||
InterlockedExchange64((volatile LONGLONG *)(X),(LONGLONG)(Y))
|
||||
#define IL_EXCHGptr InterlockedExchangePointer
|
||||
|
||||
#define make_atomic_add_body(S) \
|
||||
v= IL_EXCHG_ADD ## S (a, v)
|
||||
#define make_atomic_swap_body(S) \
|
||||
v= IL_EXCHG ## S (a, v)
|
||||
#define make_atomic_load_body(S) \
|
||||
ret= 0; /* avoid compiler warning */ \
|
||||
ret= IL_COMP_EXCHG ## S (a, ret, ret);
|
||||
#endif
|
||||
/*
|
||||
my_yield_processor (equivalent of x86 PAUSE instruction) should be used
|
||||
to improve performance on hyperthreaded CPUs. Intel recommends to use it in
|
||||
spin loops also on non-HT machines to reduce power consumption (see e.g
|
||||
http://softwarecommunity.intel.com/articles/eng/2004.htm)
|
||||
|
||||
Running benchmarks for spinlocks implemented with InterlockedCompareExchange
|
||||
and YieldProcessor shows that much better performance is achieved by calling
|
||||
YieldProcessor in a loop - that is, yielding longer. On Intel boxes setting
|
||||
loop count in the range 200-300 brought best results.
|
||||
*/
|
||||
#ifndef YIELD_LOOPS
|
||||
#define YIELD_LOOPS 200
|
||||
#endif
|
||||
|
||||
static __inline int my_yield_processor()
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<YIELD_LOOPS; i++)
|
||||
{
|
||||
#if (_MSC_VER <= 1310)
|
||||
/* On older compilers YieldProcessor is not available, use inline assembly*/
|
||||
__asm { rep nop }
|
||||
#else
|
||||
YieldProcessor();
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define LF_BACKOFF my_yield_processor()
|
||||
#else /* cleanup */
|
||||
|
||||
#undef IL_EXCHG_ADD32
|
||||
#undef IL_EXCHG_ADD64
|
||||
#undef IL_COMP_EXCHG32
|
||||
#undef IL_COMP_EXCHG64
|
||||
#undef IL_COMP_EXCHGptr
|
||||
#undef IL_EXCHG32
|
||||
#undef IL_EXCHG64
|
||||
#undef IL_EXCHGptr
|
||||
|
||||
#endif
|
||||
69
modules/dep/mysqllite/include/internal/atomic/nolock.h
Normal file
69
modules/dep/mysqllite/include/internal/atomic/nolock.h
Normal file
@@ -0,0 +1,69 @@
|
||||
#ifndef ATOMIC_NOLOCK_INCLUDED
|
||||
#define ATOMIC_NOLOCK_INCLUDED
|
||||
|
||||
/* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#if defined(__i386__) || defined(_MSC_VER) || defined(__x86_64__) \
|
||||
|| defined(HAVE_GCC_ATOMIC_BUILTINS) \
|
||||
|| defined(HAVE_SOLARIS_ATOMIC)
|
||||
|
||||
# ifdef MY_ATOMIC_MODE_DUMMY
|
||||
# define LOCK_prefix ""
|
||||
# else
|
||||
# define LOCK_prefix "lock"
|
||||
# endif
|
||||
/*
|
||||
We choose implementation as follows:
|
||||
------------------------------------
|
||||
On Windows using Visual C++ the native implementation should be
|
||||
preferrable. When using gcc we prefer the Solaris implementation
|
||||
before the gcc because of stability preference, we choose gcc
|
||||
builtins if available, otherwise we choose the somewhat broken
|
||||
native x86 implementation. If neither Visual C++ or gcc we still
|
||||
choose the Solaris implementation on Solaris (mainly for SunStudio
|
||||
compilers).
|
||||
*/
|
||||
# if defined(_MSV_VER)
|
||||
# include "generic-msvc.h"
|
||||
# elif __GNUC__
|
||||
# if defined(HAVE_SOLARIS_ATOMIC)
|
||||
# include "solaris.h"
|
||||
# elif defined(HAVE_GCC_ATOMIC_BUILTINS)
|
||||
# include "gcc_builtins.h"
|
||||
# elif defined(__i386__) || defined(__x86_64__)
|
||||
# include "x86-gcc.h"
|
||||
# endif
|
||||
# elif defined(HAVE_SOLARIS_ATOMIC)
|
||||
# include "solaris.h"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(make_atomic_cas_body)
|
||||
/*
|
||||
Type not used so minimal size (emptry struct has different size between C
|
||||
and C++, zero-length array is gcc-specific).
|
||||
*/
|
||||
typedef char my_atomic_rwlock_t __attribute__ ((unused));
|
||||
#define my_atomic_rwlock_destroy(name)
|
||||
#define my_atomic_rwlock_init(name)
|
||||
#define my_atomic_rwlock_rdlock(name)
|
||||
#define my_atomic_rwlock_wrlock(name)
|
||||
#define my_atomic_rwlock_rdunlock(name)
|
||||
#define my_atomic_rwlock_wrunlock(name)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ATOMIC_NOLOCK_INCLUDED */
|
||||
100
modules/dep/mysqllite/include/internal/atomic/rwlock.h
Normal file
100
modules/dep/mysqllite/include/internal/atomic/rwlock.h
Normal file
@@ -0,0 +1,100 @@
|
||||
#ifndef ATOMIC_RWLOCK_INCLUDED
|
||||
#define ATOMIC_RWLOCK_INCLUDED
|
||||
|
||||
/* Copyright (C) 2006 MySQL AB, 2009 Sun Microsystems, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#define MY_ATOMIC_MODE_RWLOCKS 1
|
||||
|
||||
#ifdef MY_ATOMIC_MODE_DUMMY
|
||||
/*
|
||||
the following can never be enabled by ./configure, one need to put #define in
|
||||
a source to trigger the following warning. The resulting code will be broken,
|
||||
it only makes sense to do it to see now test_atomic detects broken
|
||||
implementations (another way is to run a UP build on an SMP box).
|
||||
*/
|
||||
#warning MY_ATOMIC_MODE_DUMMY and MY_ATOMIC_MODE_RWLOCKS are incompatible
|
||||
|
||||
typedef char my_atomic_rwlock_t;
|
||||
|
||||
#define my_atomic_rwlock_destroy(name)
|
||||
#define my_atomic_rwlock_init(name)
|
||||
#define my_atomic_rwlock_rdlock(name)
|
||||
#define my_atomic_rwlock_wrlock(name)
|
||||
#define my_atomic_rwlock_rdunlock(name)
|
||||
#define my_atomic_rwlock_wrunlock(name)
|
||||
#define MY_ATOMIC_MODE "dummy (non-atomic)"
|
||||
#else /* not MY_ATOMIC_MODE_DUMMY */
|
||||
|
||||
typedef struct {pthread_mutex_t rw;} my_atomic_rwlock_t;
|
||||
|
||||
#ifndef SAFE_MUTEX
|
||||
|
||||
/*
|
||||
we're using read-write lock macros but map them to mutex locks, and they're
|
||||
faster. Still, having semantically rich API we can change the
|
||||
underlying implementation, if necessary.
|
||||
*/
|
||||
#define my_atomic_rwlock_destroy(name) pthread_mutex_destroy(& (name)->rw)
|
||||
#define my_atomic_rwlock_init(name) pthread_mutex_init(& (name)->rw, 0)
|
||||
#define my_atomic_rwlock_rdlock(name) pthread_mutex_lock(& (name)->rw)
|
||||
#define my_atomic_rwlock_wrlock(name) pthread_mutex_lock(& (name)->rw)
|
||||
#define my_atomic_rwlock_rdunlock(name) pthread_mutex_unlock(& (name)->rw)
|
||||
#define my_atomic_rwlock_wrunlock(name) pthread_mutex_unlock(& (name)->rw)
|
||||
|
||||
#else /* SAFE_MUTEX */
|
||||
|
||||
/*
|
||||
SAFE_MUTEX pollutes the compiling name space with macros
|
||||
that alter pthread_mutex_t, pthread_mutex_init, etc.
|
||||
Atomic operations should never use the safe mutex wrappers.
|
||||
Unfortunately, there is no way to have both:
|
||||
- safe mutex macros expanding pthread_mutex_lock to safe_mutex_lock
|
||||
- my_atomic macros expanding to unmodified pthread_mutex_lock
|
||||
inlined in the same compilation unit.
|
||||
So, in case of SAFE_MUTEX, a function call is required.
|
||||
Given that SAFE_MUTEX is a debugging facility,
|
||||
this extra function call is not a performance concern for
|
||||
production builds.
|
||||
*/
|
||||
C_MODE_START
|
||||
extern void plain_pthread_mutex_init(safe_mutex_t *);
|
||||
extern void plain_pthread_mutex_destroy(safe_mutex_t *);
|
||||
extern void plain_pthread_mutex_lock(safe_mutex_t *);
|
||||
extern void plain_pthread_mutex_unlock(safe_mutex_t *);
|
||||
C_MODE_END
|
||||
|
||||
#define my_atomic_rwlock_destroy(name) plain_pthread_mutex_destroy(&(name)->rw)
|
||||
#define my_atomic_rwlock_init(name) plain_pthread_mutex_init(&(name)->rw)
|
||||
#define my_atomic_rwlock_rdlock(name) plain_pthread_mutex_lock(&(name)->rw)
|
||||
#define my_atomic_rwlock_wrlock(name) plain_pthread_mutex_lock(&(name)->rw)
|
||||
#define my_atomic_rwlock_rdunlock(name) plain_pthread_mutex_unlock(&(name)->rw)
|
||||
#define my_atomic_rwlock_wrunlock(name) plain_pthread_mutex_unlock(&(name)->rw)
|
||||
|
||||
#endif /* SAFE_MUTEX */
|
||||
|
||||
#define MY_ATOMIC_MODE "mutex"
|
||||
#ifndef MY_ATOMIC_MODE_RWLOCKS
|
||||
#define MY_ATOMIC_MODE_RWLOCKS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define make_atomic_add_body(S) int ## S sav; sav= *a; *a+= v; v=sav;
|
||||
#define make_atomic_fas_body(S) int ## S sav; sav= *a; *a= v; v=sav;
|
||||
#define make_atomic_cas_body(S) if ((ret= (*a == *cmp))) *a= set; else *cmp=*a;
|
||||
#define make_atomic_load_body(S) ret= *a;
|
||||
#define make_atomic_store_body(S) *a= v;
|
||||
|
||||
#endif /* ATOMIC_RWLOCK_INCLUDED */
|
||||
72
modules/dep/mysqllite/include/internal/atomic/solaris.h
Normal file
72
modules/dep/mysqllite/include/internal/atomic/solaris.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/* Copyright (C) 2008 MySQL AB, 2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifndef _atomic_h_cleanup_
|
||||
#define _atomic_h_cleanup_ "atomic/solaris.h"
|
||||
|
||||
#include <atomic.h>
|
||||
|
||||
#define MY_ATOMIC_MODE "solaris-atomic"
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define atomic_typeof(T,V) __typeof__(V)
|
||||
#else
|
||||
#define atomic_typeof(T,V) T
|
||||
#endif
|
||||
|
||||
#define uintptr_t void *
|
||||
#define atomic_or_ptr_nv(X,Y) (void *)atomic_or_ulong_nv((volatile ulong_t *)X, Y)
|
||||
|
||||
#define make_atomic_cas_body(S) \
|
||||
atomic_typeof(uint ## S ## _t, *cmp) sav; \
|
||||
sav = atomic_cas_ ## S( \
|
||||
(volatile uint ## S ## _t *)a, \
|
||||
(uint ## S ## _t)*cmp, \
|
||||
(uint ## S ## _t)set); \
|
||||
if (! (ret= (sav == *cmp))) \
|
||||
*cmp= sav;
|
||||
|
||||
#define make_atomic_add_body(S) \
|
||||
int ## S nv; /* new value */ \
|
||||
nv= atomic_add_ ## S ## _nv((volatile uint ## S ## _t *)a, v); \
|
||||
v= nv - v
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#ifdef MY_ATOMIC_MODE_DUMMY
|
||||
|
||||
#define make_atomic_load_body(S) ret= *a
|
||||
#define make_atomic_store_body(S) *a= v
|
||||
|
||||
#else /* MY_ATOMIC_MODE_DUMMY */
|
||||
|
||||
#define make_atomic_load_body(S) \
|
||||
ret= atomic_or_ ## S ## _nv((volatile uint ## S ## _t *)a, 0)
|
||||
|
||||
#define make_atomic_store_body(S) \
|
||||
(void) atomic_swap_ ## S((volatile uint ## S ## _t *)a, (uint ## S ## _t)v)
|
||||
|
||||
#endif
|
||||
|
||||
#define make_atomic_fas_body(S) \
|
||||
v= atomic_swap_ ## S((volatile uint ## S ## _t *)a, (uint ## S ## _t)v)
|
||||
|
||||
#else /* cleanup */
|
||||
|
||||
#undef uintptr_t
|
||||
#undef atomic_or_ptr_nv
|
||||
|
||||
#endif
|
||||
|
||||
145
modules/dep/mysqllite/include/internal/atomic/x86-gcc.h
Normal file
145
modules/dep/mysqllite/include/internal/atomic/x86-gcc.h
Normal file
@@ -0,0 +1,145 @@
|
||||
#ifndef ATOMIC_X86_GCC_INCLUDED
|
||||
#define ATOMIC_X86_GCC_INCLUDED
|
||||
|
||||
/* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/*
|
||||
XXX 64-bit atomic operations can be implemented using
|
||||
cmpxchg8b, if necessary. Though I've heard that not all 64-bit
|
||||
architectures support double-word (128-bit) cas.
|
||||
*/
|
||||
|
||||
/*
|
||||
No special support of 8 and 16 bit operations are implemented here
|
||||
currently.
|
||||
*/
|
||||
#undef MY_ATOMIC_HAS_8_AND_16
|
||||
|
||||
#ifdef __x86_64__
|
||||
# ifdef MY_ATOMIC_NO_XADD
|
||||
# define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix "-no-xadd"
|
||||
# else
|
||||
# define MY_ATOMIC_MODE "gcc-amd64" LOCK_prefix
|
||||
# endif
|
||||
#else
|
||||
# ifdef MY_ATOMIC_NO_XADD
|
||||
# define MY_ATOMIC_MODE "gcc-x86" LOCK_prefix "-no-xadd"
|
||||
# else
|
||||
# define MY_ATOMIC_MODE "gcc-x86" LOCK_prefix
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* fix -ansi errors while maintaining readability */
|
||||
#ifndef asm
|
||||
#define asm __asm__
|
||||
#endif
|
||||
|
||||
#ifndef MY_ATOMIC_NO_XADD
|
||||
#define make_atomic_add_body(S) make_atomic_add_body ## S
|
||||
#define make_atomic_cas_body(S) make_atomic_cas_body ## S
|
||||
#endif
|
||||
|
||||
#define make_atomic_add_body32 \
|
||||
asm volatile (LOCK_prefix "; xadd %0, %1;" \
|
||||
: "+r" (v), "=m" (*a) \
|
||||
: "m" (*a) \
|
||||
: "memory")
|
||||
|
||||
#define make_atomic_cas_body32 \
|
||||
__typeof__(*cmp) sav; \
|
||||
asm volatile (LOCK_prefix "; cmpxchg %3, %0; setz %2;" \
|
||||
: "=m" (*a), "=a" (sav), "=q" (ret) \
|
||||
: "r" (set), "m" (*a), "a" (*cmp) \
|
||||
: "memory"); \
|
||||
if (!ret) \
|
||||
*cmp= sav
|
||||
|
||||
#ifdef __x86_64__
|
||||
#define make_atomic_add_body64 make_atomic_add_body32
|
||||
#define make_atomic_cas_body64 make_atomic_cas_body32
|
||||
|
||||
#define make_atomic_fas_body(S) \
|
||||
asm volatile ("xchg %0, %1;" \
|
||||
: "+r" (v), "=m" (*a) \
|
||||
: "m" (*a) \
|
||||
: "memory")
|
||||
|
||||
/*
|
||||
Actually 32/64-bit reads/writes are always atomic on x86_64,
|
||||
nonetheless issue memory barriers as appropriate.
|
||||
*/
|
||||
#define make_atomic_load_body(S) \
|
||||
/* Serialize prior load and store operations. */ \
|
||||
asm volatile ("mfence" ::: "memory"); \
|
||||
ret= *a; \
|
||||
/* Prevent compiler from reordering instructions. */ \
|
||||
asm volatile ("" ::: "memory")
|
||||
#define make_atomic_store_body(S) \
|
||||
asm volatile ("; xchg %0, %1;" \
|
||||
: "=m" (*a), "+r" (v) \
|
||||
: "m" (*a) \
|
||||
: "memory")
|
||||
|
||||
#else
|
||||
/*
|
||||
Use default implementations of 64-bit operations since we solved
|
||||
the 64-bit problem on 32-bit platforms for CAS, no need to solve it
|
||||
once more for ADD, LOAD, STORE and FAS as well.
|
||||
Since we already added add32 support, we need to define add64
|
||||
here, but we haven't defined fas, load and store at all, so
|
||||
we can fallback on default implementations.
|
||||
*/
|
||||
#define make_atomic_add_body64 \
|
||||
int64 tmp=*a; \
|
||||
while (!my_atomic_cas64(a, &tmp, tmp+v)) ; \
|
||||
v=tmp;
|
||||
|
||||
/*
|
||||
On some platforms (e.g. Mac OS X and Solaris) the ebx register
|
||||
is held as a pointer to the global offset table. Thus we're not
|
||||
allowed to use the b-register on those platforms when compiling
|
||||
PIC code, to avoid this we push ebx and pop ebx. The new value
|
||||
is copied directly from memory to avoid problems with a implicit
|
||||
manipulation of the stack pointer by the push.
|
||||
|
||||
cmpxchg8b works on both 32-bit platforms and 64-bit platforms but
|
||||
the code here is only used on 32-bit platforms, on 64-bit
|
||||
platforms the much simpler make_atomic_cas_body32 will work
|
||||
fine.
|
||||
*/
|
||||
#define make_atomic_cas_body64 \
|
||||
asm volatile ("push %%ebx;" \
|
||||
"movl (%%ecx), %%ebx;" \
|
||||
"movl 4(%%ecx), %%ecx;" \
|
||||
LOCK_prefix "; cmpxchg8b %0;" \
|
||||
"setz %2; pop %%ebx" \
|
||||
: "=m" (*a), "+A" (*cmp), "=c" (ret) \
|
||||
: "c" (&set), "m" (*a) \
|
||||
: "memory", "esp")
|
||||
#endif
|
||||
|
||||
/*
|
||||
The implementation of make_atomic_cas_body32 is adaptable to
|
||||
the OS word size, so on 64-bit platforms it will automatically
|
||||
adapt to 64-bits and so it will work also on 64-bit platforms
|
||||
*/
|
||||
#define make_atomic_cas_bodyptr make_atomic_cas_body32
|
||||
|
||||
#ifdef MY_ATOMIC_MODE_DUMMY
|
||||
#define make_atomic_load_body(S) ret=*a
|
||||
#define make_atomic_store_body(S) *a=v
|
||||
#endif
|
||||
#endif /* ATOMIC_X86_GCC_INCLUDED */
|
||||
48
modules/dep/mysqllite/include/internal/base64.h
Normal file
48
modules/dep/mysqllite/include/internal/base64.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* Copyright (C) 2003 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 __BASE64_H_INCLUDED__
|
||||
#define __BASE64_H_INCLUDED__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
Calculate how much memory needed for dst of base64_encode()
|
||||
*/
|
||||
int base64_needed_encoded_length(int length_of_data);
|
||||
|
||||
/*
|
||||
Calculate how much memory needed for dst of base64_decode()
|
||||
*/
|
||||
int base64_needed_decoded_length(int length_of_encoded_data);
|
||||
|
||||
/*
|
||||
Encode data as a base64 string
|
||||
*/
|
||||
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, const char **end_ptr);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !__BASE64_H_INCLUDED__ */
|
||||
108
modules/dep/mysqllite/include/internal/hash.h
Normal file
108
modules/dep/mysqllite/include/internal/hash.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/* Dynamic hashing of record with different key-length */
|
||||
|
||||
#ifndef _hash_h
|
||||
#define _hash_h
|
||||
|
||||
#include "my_global.h" /* uchar */
|
||||
#include "my_sys.h" /* DYNAMIC_ARRAY */
|
||||
|
||||
/*
|
||||
This forward declaration is used from C files where the real
|
||||
definition is included before. Since C does not allow repeated
|
||||
typedef declarations, even when identical, the definition may not be
|
||||
repeated.
|
||||
*/
|
||||
#ifndef CHARSET_INFO_DEFINED
|
||||
#define CHARSET_INFO_DEFINED
|
||||
typedef struct charset_info_st CHARSET_INFO;
|
||||
#endif /* CHARSET_INFO_DEFINED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
Overhead to store an element in hash
|
||||
Can be used to approximate memory consumption for a hash
|
||||
*/
|
||||
#define HASH_OVERHEAD (sizeof(char*)*2)
|
||||
|
||||
/* flags for hash_init */
|
||||
#define HASH_UNIQUE 1 /* hash_insert fails on duplicate key */
|
||||
|
||||
typedef uint my_hash_value_type;
|
||||
typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool);
|
||||
typedef void (*my_hash_free_key)(void *);
|
||||
|
||||
typedef struct st_hash {
|
||||
size_t key_offset,key_length; /* Length of key if const length */
|
||||
size_t blength;
|
||||
ulong records;
|
||||
uint flags;
|
||||
DYNAMIC_ARRAY array; /* Place for hash_keys */
|
||||
my_hash_get_key get_key;
|
||||
void (*free)(void *);
|
||||
CHARSET_INFO *charset;
|
||||
} HASH;
|
||||
|
||||
/* A search iterator state */
|
||||
typedef uint HASH_SEARCH_STATE;
|
||||
|
||||
#define my_hash_init(A,B,C,D,E,F,G,H) \
|
||||
_my_hash_init(A,0,B,C,D,E,F,G,H)
|
||||
#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)
|
||||
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);
|
||||
void my_hash_free(HASH *tree);
|
||||
void my_hash_reset(HASH *hash);
|
||||
uchar *my_hash_element(HASH *hash, ulong idx);
|
||||
uchar *my_hash_search(const HASH *info, const uchar *key, size_t length);
|
||||
uchar *my_hash_search_using_hash_value(const HASH *info,
|
||||
my_hash_value_type hash_value,
|
||||
const uchar *key, size_t length);
|
||||
my_hash_value_type my_calc_hash(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_first_from_hash_value(const HASH *info,
|
||||
my_hash_value_type hash_value,
|
||||
const uchar *key,
|
||||
size_t length,
|
||||
HASH_SEARCH_STATE *state);
|
||||
uchar *my_hash_next(const HASH *info, const uchar *key, size_t length,
|
||||
HASH_SEARCH_STATE *state);
|
||||
my_bool my_hash_insert(HASH *info, const uchar *data);
|
||||
my_bool my_hash_delete(HASH *hash, uchar *record);
|
||||
my_bool my_hash_update(HASH *hash, uchar *record, uchar *old_key,
|
||||
size_t old_key_length);
|
||||
void my_hash_replace(HASH *hash, HASH_SEARCH_STATE *state, uchar *new_row);
|
||||
my_bool my_hash_check(HASH *hash); /* Only in debug library */
|
||||
|
||||
#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))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
265
modules/dep/mysqllite/include/internal/lf.h
Normal file
265
modules/dep/mysqllite/include/internal/lf.h
Normal file
@@ -0,0 +1,265 @@
|
||||
/* Copyright (C) 2007-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifndef _lf_h
|
||||
#define _lf_h
|
||||
|
||||
#include <my_atomic.h>
|
||||
|
||||
C_MODE_START
|
||||
|
||||
/*
|
||||
Helpers to define both func() and _func(), where
|
||||
func() is a _func() protected by my_atomic_rwlock_wrlock()
|
||||
*/
|
||||
|
||||
#define lock_wrap(f, t, proto_args, args, lock) \
|
||||
t _ ## f proto_args; \
|
||||
static inline t f proto_args \
|
||||
{ \
|
||||
t ret; \
|
||||
my_atomic_rwlock_wrlock(lock); \
|
||||
ret= _ ## f args; \
|
||||
my_atomic_rwlock_wrunlock(lock); \
|
||||
return ret; \
|
||||
}
|
||||
|
||||
#define lock_wrap_void(f, proto_args, args, lock) \
|
||||
void _ ## f proto_args; \
|
||||
static inline void f proto_args \
|
||||
{ \
|
||||
my_atomic_rwlock_wrlock(lock); \
|
||||
_ ## f args; \
|
||||
my_atomic_rwlock_wrunlock(lock); \
|
||||
}
|
||||
|
||||
#define nolock_wrap(f, t, proto_args, args) \
|
||||
t _ ## f proto_args; \
|
||||
static inline t f proto_args \
|
||||
{ \
|
||||
return _ ## f args; \
|
||||
}
|
||||
|
||||
#define nolock_wrap_void(f, proto_args, args) \
|
||||
void _ ## f proto_args; \
|
||||
static inline void f proto_args \
|
||||
{ \
|
||||
_ ## f args; \
|
||||
}
|
||||
|
||||
/*
|
||||
wait-free dynamic array, see lf_dynarray.c
|
||||
|
||||
4 levels of 256 elements each mean 4311810304 elements in an array - it
|
||||
should be enough for a while
|
||||
*/
|
||||
#define LF_DYNARRAY_LEVEL_LENGTH 256
|
||||
#define LF_DYNARRAY_LEVELS 4
|
||||
|
||||
typedef struct {
|
||||
void * volatile level[LF_DYNARRAY_LEVELS];
|
||||
uint size_of_element;
|
||||
my_atomic_rwlock_t lock;
|
||||
} LF_DYNARRAY;
|
||||
|
||||
typedef int (*lf_dynarray_func)(void *, void *);
|
||||
|
||||
void lf_dynarray_init(LF_DYNARRAY *array, uint element_size);
|
||||
void lf_dynarray_destroy(LF_DYNARRAY *array);
|
||||
|
||||
nolock_wrap(lf_dynarray_value, void *,
|
||||
(LF_DYNARRAY *array, uint idx),
|
||||
(array, idx))
|
||||
lock_wrap(lf_dynarray_lvalue, void *,
|
||||
(LF_DYNARRAY *array, uint idx),
|
||||
(array, idx),
|
||||
&array->lock)
|
||||
nolock_wrap(lf_dynarray_iterate, int,
|
||||
(LF_DYNARRAY *array, lf_dynarray_func func, void *arg),
|
||||
(array, func, arg))
|
||||
|
||||
/*
|
||||
pin manager for memory allocator, lf_alloc-pin.c
|
||||
*/
|
||||
|
||||
#define LF_PINBOX_PINS 4
|
||||
#define LF_PURGATORY_SIZE 10
|
||||
|
||||
typedef void lf_pinbox_free_func(void *, void *, void*);
|
||||
|
||||
typedef struct {
|
||||
LF_DYNARRAY pinarray;
|
||||
lf_pinbox_free_func *free_func;
|
||||
void *free_func_arg;
|
||||
uint free_ptr_offset;
|
||||
uint32 volatile pinstack_top_ver; /* this is a versioned pointer */
|
||||
uint32 volatile pins_in_array; /* number of elements in array */
|
||||
} LF_PINBOX;
|
||||
|
||||
typedef struct {
|
||||
void * volatile pin[LF_PINBOX_PINS];
|
||||
LF_PINBOX *pinbox;
|
||||
void **stack_ends_here;
|
||||
void *purgatory;
|
||||
uint32 purgatory_count;
|
||||
uint32 volatile link;
|
||||
/* we want sizeof(LF_PINS) to be 64 to avoid false sharing */
|
||||
#if SIZEOF_INT*2+SIZEOF_CHARP*(LF_PINBOX_PINS+3) != 64
|
||||
char pad[64-sizeof(uint32)*2-sizeof(void*)*(LF_PINBOX_PINS+3)];
|
||||
#endif
|
||||
} LF_PINS;
|
||||
|
||||
/*
|
||||
shortcut macros to do an atomic_wrlock on a structure that uses pins
|
||||
(e.g. lf_hash).
|
||||
*/
|
||||
#define lf_rwlock_by_pins(PINS) \
|
||||
my_atomic_rwlock_wrlock(&(PINS)->pinbox->pinarray.lock)
|
||||
#define lf_rwunlock_by_pins(PINS) \
|
||||
my_atomic_rwlock_wrunlock(&(PINS)->pinbox->pinarray.lock)
|
||||
|
||||
/*
|
||||
compile-time assert, to require "no less than N" pins
|
||||
it's enough if it'll fail on at least one compiler, so
|
||||
we'll enable it on GCC only, which supports zero-length arrays.
|
||||
*/
|
||||
#if defined(__GNUC__) && defined(MY_LF_EXTRA_DEBUG)
|
||||
#define LF_REQUIRE_PINS(N) \
|
||||
static const char require_pins[LF_PINBOX_PINS-N] \
|
||||
__attribute__ ((unused)); \
|
||||
static const int LF_NUM_PINS_IN_THIS_FILE= N;
|
||||
#define _lf_pin(PINS, PIN, ADDR) \
|
||||
( \
|
||||
assert(PIN < LF_NUM_PINS_IN_THIS_FILE), \
|
||||
my_atomic_storeptr(&(PINS)->pin[PIN], (ADDR)) \
|
||||
)
|
||||
#else
|
||||
#define LF_REQUIRE_PINS(N)
|
||||
#define _lf_pin(PINS, PIN, ADDR) my_atomic_storeptr(&(PINS)->pin[PIN], (ADDR))
|
||||
#endif
|
||||
|
||||
#define _lf_unpin(PINS, PIN) _lf_pin(PINS, PIN, NULL)
|
||||
#define lf_pin(PINS, PIN, ADDR) \
|
||||
do { \
|
||||
lf_rwlock_by_pins(PINS); \
|
||||
_lf_pin(PINS, PIN, ADDR); \
|
||||
lf_rwunlock_by_pins(PINS); \
|
||||
} while (0)
|
||||
#define lf_unpin(PINS, PIN) lf_pin(PINS, PIN, NULL)
|
||||
#define _lf_assert_pin(PINS, PIN) assert((PINS)->pin[PIN] != 0)
|
||||
#define _lf_assert_unpin(PINS, PIN) assert((PINS)->pin[PIN] == 0)
|
||||
|
||||
void lf_pinbox_init(LF_PINBOX *pinbox, uint free_ptr_offset,
|
||||
lf_pinbox_free_func *free_func, void * free_func_arg);
|
||||
void lf_pinbox_destroy(LF_PINBOX *pinbox);
|
||||
|
||||
lock_wrap(lf_pinbox_get_pins, LF_PINS *,
|
||||
(LF_PINBOX *pinbox),
|
||||
(pinbox),
|
||||
&pinbox->pinarray.lock)
|
||||
lock_wrap_void(lf_pinbox_put_pins,
|
||||
(LF_PINS *pins),
|
||||
(pins),
|
||||
&pins->pinbox->pinarray.lock)
|
||||
lock_wrap_void(lf_pinbox_free,
|
||||
(LF_PINS *pins, void *addr),
|
||||
(pins, addr),
|
||||
&pins->pinbox->pinarray.lock)
|
||||
|
||||
/*
|
||||
memory allocator, lf_alloc-pin.c
|
||||
*/
|
||||
|
||||
typedef struct st_lf_allocator {
|
||||
LF_PINBOX pinbox;
|
||||
uchar * volatile top;
|
||||
uint element_size;
|
||||
uint32 volatile mallocs;
|
||||
} LF_ALLOCATOR;
|
||||
|
||||
void lf_alloc_init(LF_ALLOCATOR *allocator, uint size, uint free_ptr_offset);
|
||||
void lf_alloc_destroy(LF_ALLOCATOR *allocator);
|
||||
uint lf_alloc_pool_count(LF_ALLOCATOR *allocator);
|
||||
/*
|
||||
shortcut macros to access underlying pinbox functions from an LF_ALLOCATOR
|
||||
see _lf_pinbox_get_pins() and _lf_pinbox_put_pins()
|
||||
*/
|
||||
#define _lf_alloc_free(PINS, PTR) _lf_pinbox_free((PINS), (PTR))
|
||||
#define lf_alloc_free(PINS, PTR) lf_pinbox_free((PINS), (PTR))
|
||||
#define _lf_alloc_get_pins(A) _lf_pinbox_get_pins(&(A)->pinbox)
|
||||
#define lf_alloc_get_pins(A) lf_pinbox_get_pins(&(A)->pinbox)
|
||||
#define _lf_alloc_put_pins(PINS) _lf_pinbox_put_pins(PINS)
|
||||
#define lf_alloc_put_pins(PINS) lf_pinbox_put_pins(PINS)
|
||||
#define lf_alloc_direct_free(ALLOC, ADDR) my_free((ADDR))
|
||||
|
||||
lock_wrap(lf_alloc_new, void *,
|
||||
(LF_PINS *pins),
|
||||
(pins),
|
||||
&pins->pinbox->pinarray.lock)
|
||||
|
||||
C_MODE_END
|
||||
|
||||
/*
|
||||
extendible hash, lf_hash.c
|
||||
*/
|
||||
#include <hash.h>
|
||||
|
||||
C_MODE_START
|
||||
|
||||
#define LF_HASH_UNIQUE 1
|
||||
|
||||
/* lf_hash overhead per element is sizeof(LF_SLIST). */
|
||||
|
||||
typedef struct {
|
||||
LF_DYNARRAY array; /* hash itself */
|
||||
LF_ALLOCATOR alloc; /* allocator for elements */
|
||||
my_hash_get_key get_key; /* see HASH */
|
||||
CHARSET_INFO *charset; /* see HASH */
|
||||
uint key_offset, key_length; /* see HASH */
|
||||
uint element_size; /* size of memcpy'ed area on insert */
|
||||
uint flags; /* LF_HASH_UNIQUE, etc */
|
||||
int32 volatile size; /* size of array */
|
||||
int32 volatile count; /* number of elements in the hash */
|
||||
} LF_HASH;
|
||||
|
||||
void lf_hash_init(LF_HASH *hash, uint element_size, uint flags,
|
||||
uint key_offset, uint key_length, my_hash_get_key get_key,
|
||||
CHARSET_INFO *charset);
|
||||
void lf_hash_destroy(LF_HASH *hash);
|
||||
int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data);
|
||||
void *lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen);
|
||||
int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen);
|
||||
/*
|
||||
shortcut macros to access underlying pinbox functions from an LF_HASH
|
||||
see _lf_pinbox_get_pins() and _lf_pinbox_put_pins()
|
||||
*/
|
||||
#define _lf_hash_get_pins(HASH) _lf_alloc_get_pins(&(HASH)->alloc)
|
||||
#define lf_hash_get_pins(HASH) lf_alloc_get_pins(&(HASH)->alloc)
|
||||
#define _lf_hash_put_pins(PINS) _lf_pinbox_put_pins(PINS)
|
||||
#define lf_hash_put_pins(PINS) lf_pinbox_put_pins(PINS)
|
||||
#define lf_hash_search_unpin(PINS) lf_unpin((PINS), 2)
|
||||
/*
|
||||
cleanup
|
||||
*/
|
||||
|
||||
#undef lock_wrap_void
|
||||
#undef lock_wrap
|
||||
#undef nolock_wrap_void
|
||||
#undef nolock_wrap
|
||||
|
||||
C_MODE_END
|
||||
|
||||
#endif
|
||||
|
||||
70
modules/dep/mysqllite/include/internal/my_aes.h
Normal file
70
modules/dep/mysqllite/include/internal/my_aes.h
Normal file
@@ -0,0 +1,70 @@
|
||||
#ifndef MY_AES_INCLUDED
|
||||
#define MY_AES_INCLUDED
|
||||
|
||||
/* Copyright (C) 2002 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 */
|
||||
|
||||
|
||||
/* Header file for my_aes.c */
|
||||
/* Wrapper to give simple interface for MySQL to AES standard encryption */
|
||||
|
||||
#include "rijndael.h"
|
||||
|
||||
C_MODE_START
|
||||
|
||||
#define AES_KEY_LENGTH 128 /* Must be 128 192 or 256 */
|
||||
|
||||
/*
|
||||
my_aes_encrypt - Crypt buffer with AES encryption algorithm.
|
||||
source - Pointer to data for encryption
|
||||
source_length - size of encryption data
|
||||
dest - buffer to place encrypted data (must be large enough)
|
||||
key - Key to be used for encryption
|
||||
kel_length - Length of the key. Will handle keys of any length
|
||||
|
||||
returns - size of encrypted data, or negative in case of error.
|
||||
*/
|
||||
|
||||
int my_aes_encrypt(const char *source, int source_length, char *dest,
|
||||
const char *key, int key_length);
|
||||
|
||||
/*
|
||||
my_aes_decrypt - DeCrypt buffer with AES encryption algorithm.
|
||||
source - Pointer to data for decryption
|
||||
source_length - size of encrypted data
|
||||
dest - buffer to place decrypted data (must be large enough)
|
||||
key - Key to be used for decryption
|
||||
kel_length - Length of the key. Will handle keys of any length
|
||||
|
||||
returns - size of original data, or negative in case of error.
|
||||
*/
|
||||
|
||||
|
||||
int my_aes_decrypt(const char *source, int source_length, char *dest,
|
||||
const char *key, int key_length);
|
||||
|
||||
/*
|
||||
my_aes_get_size - get size of buffer which will be large enough for encrypted
|
||||
data
|
||||
source_length - length of data to be encrypted
|
||||
|
||||
returns - size of buffer required to store encrypted data
|
||||
*/
|
||||
|
||||
int my_aes_get_size(int source_length);
|
||||
|
||||
C_MODE_END
|
||||
|
||||
#endif /* MY_AES_INCLUDED */
|
||||
58
modules/dep/mysqllite/include/internal/my_alarm.h
Normal file
58
modules/dep/mysqllite/include/internal/my_alarm.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* 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 */
|
||||
|
||||
/*
|
||||
File to include when we want to use alarm or a loop_counter to display
|
||||
some information when a program is running
|
||||
*/
|
||||
#ifndef _my_alarm_h
|
||||
#define _my_alarm_h
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int volatile my_have_got_alarm;
|
||||
extern ulong my_time_to_wait_for_lock;
|
||||
|
||||
#if defined(HAVE_ALARM) && !defined(NO_ALARM_LOOP)
|
||||
#include <signal.h>
|
||||
#define ALARM_VARIABLES uint alarm_old=0; \
|
||||
sig_return alarm_signal=0
|
||||
#define ALARM_INIT my_have_got_alarm=0 ; \
|
||||
alarm_old=(uint) alarm(MY_HOW_OFTEN_TO_ALARM); \
|
||||
alarm_signal=signal(SIGALRM,my_set_alarm_variable);
|
||||
#define ALARM_END (void) signal(SIGALRM,alarm_signal); \
|
||||
(void) alarm(alarm_old);
|
||||
#define ALARM_TEST my_have_got_alarm
|
||||
#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY
|
||||
#define ALARM_REINIT (void) alarm(MY_HOW_OFTEN_TO_ALARM); \
|
||||
(void) signal(SIGALRM,my_set_alarm_variable);\
|
||||
my_have_got_alarm=0;
|
||||
#else
|
||||
#define ALARM_REINIT (void) alarm((uint) MY_HOW_OFTEN_TO_ALARM); \
|
||||
my_have_got_alarm=0;
|
||||
#endif /* SIGNAL_HANDLER_RESET_ON_DELIVERY */
|
||||
#else
|
||||
#define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1
|
||||
#define ALARM_INIT
|
||||
#define ALARM_END
|
||||
#define ALARM_TEST (alarm_pos++ >= alarm_end_pos)
|
||||
#define ALARM_REINIT alarm_end_pos+=MY_HOW_OFTEN_TO_WRITE
|
||||
#endif /* HAVE_ALARM */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
287
modules/dep/mysqllite/include/internal/my_atomic.h
Normal file
287
modules/dep/mysqllite/include/internal/my_atomic.h
Normal file
@@ -0,0 +1,287 @@
|
||||
#ifndef MY_ATOMIC_INCLUDED
|
||||
#define MY_ATOMIC_INCLUDED
|
||||
|
||||
/* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/*
|
||||
This header defines five atomic operations:
|
||||
|
||||
my_atomic_add#(&var, what)
|
||||
'Fetch and Add'
|
||||
add 'what' to *var, and return the old value of *var
|
||||
|
||||
my_atomic_fas#(&var, what)
|
||||
'Fetch And Store'
|
||||
store 'what' in *var, and return the old value of *var
|
||||
|
||||
my_atomic_cas#(&var, &old, new)
|
||||
An odd variation of 'Compare And Set/Swap'
|
||||
if *var is equal to *old, then store 'new' in *var, and return TRUE
|
||||
otherwise store *var in *old, and return FALSE
|
||||
Usually, &old should not be accessed if the operation is successful.
|
||||
|
||||
my_atomic_load#(&var)
|
||||
return *var
|
||||
|
||||
my_atomic_store#(&var, what)
|
||||
store 'what' in *var
|
||||
|
||||
'#' is substituted by a size suffix - 8, 16, 32, 64, or ptr
|
||||
(e.g. my_atomic_add8, my_atomic_fas32, my_atomic_casptr).
|
||||
|
||||
NOTE This operations are not always atomic, so they always must be
|
||||
enclosed in my_atomic_rwlock_rdlock(lock)/my_atomic_rwlock_rdunlock(lock)
|
||||
or my_atomic_rwlock_wrlock(lock)/my_atomic_rwlock_wrunlock(lock).
|
||||
Hint: if a code block makes intensive use of atomic ops, it make sense
|
||||
to take/release rwlock once for the whole block, not for every statement.
|
||||
|
||||
On architectures where these operations are really atomic, rwlocks will
|
||||
be optimized away.
|
||||
8- and 16-bit atomics aren't implemented for windows (see generic-msvc.h),
|
||||
but can be added, if necessary.
|
||||
*/
|
||||
|
||||
#ifndef my_atomic_rwlock_init
|
||||
|
||||
#define intptr void *
|
||||
/**
|
||||
Currently we don't support 8-bit and 16-bit operations.
|
||||
It can be added later if needed.
|
||||
*/
|
||||
#undef MY_ATOMIC_HAS_8_16
|
||||
|
||||
#ifndef MY_ATOMIC_MODE_RWLOCKS
|
||||
/*
|
||||
* Attempt to do atomic ops without locks
|
||||
*/
|
||||
#include "atomic/nolock.h"
|
||||
#endif
|
||||
|
||||
#ifndef make_atomic_cas_body
|
||||
/* nolock.h was not able to generate even a CAS function, fall back */
|
||||
#include "atomic/rwlock.h"
|
||||
#endif
|
||||
|
||||
/* define missing functions by using the already generated ones */
|
||||
#ifndef make_atomic_add_body
|
||||
#define make_atomic_add_body(S) \
|
||||
int ## S tmp=*a; \
|
||||
while (!my_atomic_cas ## S(a, &tmp, tmp+v)) ; \
|
||||
v=tmp;
|
||||
#endif
|
||||
#ifndef make_atomic_fas_body
|
||||
#define make_atomic_fas_body(S) \
|
||||
int ## S tmp=*a; \
|
||||
while (!my_atomic_cas ## S(a, &tmp, v)) ; \
|
||||
v=tmp;
|
||||
#endif
|
||||
#ifndef make_atomic_load_body
|
||||
#define make_atomic_load_body(S) \
|
||||
ret= 0; /* avoid compiler warning */ \
|
||||
(void)(my_atomic_cas ## S(a, &ret, ret));
|
||||
#endif
|
||||
#ifndef make_atomic_store_body
|
||||
#define make_atomic_store_body(S) \
|
||||
(void)(my_atomic_fas ## S (a, v));
|
||||
#endif
|
||||
|
||||
/*
|
||||
transparent_union doesn't work in g++
|
||||
Bug ?
|
||||
|
||||
Darwin's gcc doesn't want to put pointers in a transparent_union
|
||||
when built with -arch ppc64. Complains:
|
||||
warning: 'transparent_union' attribute ignored
|
||||
*/
|
||||
#if defined(__GNUC__) && !defined(__cplusplus) && \
|
||||
! (defined(__APPLE__) && (defined(_ARCH_PPC64) ||defined (_ARCH_PPC)))
|
||||
/*
|
||||
we want to be able to use my_atomic_xxx functions with
|
||||
both signed and unsigned integers. But gcc will issue a warning
|
||||
"passing arg N of `my_atomic_XXX' as [un]signed due to prototype"
|
||||
if the signedness of the argument doesn't match the prototype, or
|
||||
"pointer targets in passing argument N of my_atomic_XXX differ in signedness"
|
||||
if int* is used where uint* is expected (or vice versa).
|
||||
Let's shut these warnings up
|
||||
*/
|
||||
#define make_transparent_unions(S) \
|
||||
typedef union { \
|
||||
int ## S i; \
|
||||
uint ## S u; \
|
||||
} U_ ## S __attribute__ ((transparent_union)); \
|
||||
typedef union { \
|
||||
int ## S volatile *i; \
|
||||
uint ## S volatile *u; \
|
||||
} Uv_ ## S __attribute__ ((transparent_union));
|
||||
#define uintptr intptr
|
||||
make_transparent_unions(8)
|
||||
make_transparent_unions(16)
|
||||
make_transparent_unions(32)
|
||||
make_transparent_unions(64)
|
||||
make_transparent_unions(ptr)
|
||||
#undef uintptr
|
||||
#undef make_transparent_unions
|
||||
#define a U_a.i
|
||||
#define cmp U_cmp.i
|
||||
#define v U_v.i
|
||||
#define set U_set.i
|
||||
#else
|
||||
#define U_8 int8
|
||||
#define U_16 int16
|
||||
#define U_32 int32
|
||||
#define U_64 int64
|
||||
#define U_ptr intptr
|
||||
#define Uv_8 int8
|
||||
#define Uv_16 int16
|
||||
#define Uv_32 int32
|
||||
#define Uv_64 int64
|
||||
#define Uv_ptr intptr
|
||||
#define U_a volatile *a
|
||||
#define U_cmp *cmp
|
||||
#define U_v v
|
||||
#define U_set set
|
||||
#endif /* __GCC__ transparent_union magic */
|
||||
|
||||
#define make_atomic_cas(S) \
|
||||
static inline int my_atomic_cas ## S(Uv_ ## S U_a, \
|
||||
Uv_ ## S U_cmp, U_ ## S U_set) \
|
||||
{ \
|
||||
int8 ret; \
|
||||
make_atomic_cas_body(S); \
|
||||
return ret; \
|
||||
}
|
||||
|
||||
#define make_atomic_add(S) \
|
||||
static inline int ## S my_atomic_add ## S( \
|
||||
Uv_ ## S U_a, U_ ## S U_v) \
|
||||
{ \
|
||||
make_atomic_add_body(S); \
|
||||
return v; \
|
||||
}
|
||||
|
||||
#define make_atomic_fas(S) \
|
||||
static inline int ## S my_atomic_fas ## S( \
|
||||
Uv_ ## S U_a, U_ ## S U_v) \
|
||||
{ \
|
||||
make_atomic_fas_body(S); \
|
||||
return v; \
|
||||
}
|
||||
|
||||
#define make_atomic_load(S) \
|
||||
static inline int ## S my_atomic_load ## S(Uv_ ## S U_a) \
|
||||
{ \
|
||||
int ## S ret; \
|
||||
make_atomic_load_body(S); \
|
||||
return ret; \
|
||||
}
|
||||
|
||||
#define make_atomic_store(S) \
|
||||
static inline void my_atomic_store ## S( \
|
||||
Uv_ ## S U_a, U_ ## S U_v) \
|
||||
{ \
|
||||
make_atomic_store_body(S); \
|
||||
}
|
||||
|
||||
#ifdef MY_ATOMIC_HAS_8_16
|
||||
make_atomic_cas(8)
|
||||
make_atomic_cas(16)
|
||||
#endif
|
||||
make_atomic_cas(32)
|
||||
make_atomic_cas(64)
|
||||
make_atomic_cas(ptr)
|
||||
|
||||
#ifdef MY_ATOMIC_HAS_8_16
|
||||
make_atomic_add(8)
|
||||
make_atomic_add(16)
|
||||
#endif
|
||||
make_atomic_add(32)
|
||||
make_atomic_add(64)
|
||||
|
||||
#ifdef MY_ATOMIC_HAS_8_16
|
||||
make_atomic_load(8)
|
||||
make_atomic_load(16)
|
||||
#endif
|
||||
make_atomic_load(32)
|
||||
make_atomic_load(64)
|
||||
make_atomic_load(ptr)
|
||||
|
||||
#ifdef MY_ATOMIC_HAS_8_16
|
||||
make_atomic_fas(8)
|
||||
make_atomic_fas(16)
|
||||
#endif
|
||||
make_atomic_fas(32)
|
||||
make_atomic_fas(64)
|
||||
make_atomic_fas(ptr)
|
||||
|
||||
#ifdef MY_ATOMIC_HAS_8_16
|
||||
make_atomic_store(8)
|
||||
make_atomic_store(16)
|
||||
#endif
|
||||
make_atomic_store(32)
|
||||
make_atomic_store(64)
|
||||
make_atomic_store(ptr)
|
||||
|
||||
#ifdef _atomic_h_cleanup_
|
||||
#include _atomic_h_cleanup_
|
||||
#undef _atomic_h_cleanup_
|
||||
#endif
|
||||
|
||||
#undef U_8
|
||||
#undef U_16
|
||||
#undef U_32
|
||||
#undef U_64
|
||||
#undef U_ptr
|
||||
#undef Uv_8
|
||||
#undef Uv_16
|
||||
#undef Uv_32
|
||||
#undef Uv_64
|
||||
#undef Uv_ptr
|
||||
#undef a
|
||||
#undef cmp
|
||||
#undef v
|
||||
#undef set
|
||||
#undef U_a
|
||||
#undef U_cmp
|
||||
#undef U_v
|
||||
#undef U_set
|
||||
#undef make_atomic_add
|
||||
#undef make_atomic_cas
|
||||
#undef make_atomic_load
|
||||
#undef make_atomic_store
|
||||
#undef make_atomic_fas
|
||||
#undef make_atomic_add_body
|
||||
#undef make_atomic_cas_body
|
||||
#undef make_atomic_load_body
|
||||
#undef make_atomic_store_body
|
||||
#undef make_atomic_fas_body
|
||||
#undef intptr
|
||||
|
||||
/*
|
||||
the macro below defines (as an expression) the code that
|
||||
will be run in spin-loops. Intel manuals recummend to have PAUSE there.
|
||||
It is expected to be defined in include/atomic/ *.h files
|
||||
*/
|
||||
#ifndef LF_BACKOFF
|
||||
#define LF_BACKOFF (1)
|
||||
#endif
|
||||
|
||||
#define MY_ATOMIC_OK 0
|
||||
#define MY_ATOMIC_NOT_1CPU 1
|
||||
extern int my_atomic_initialize();
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* MY_ATOMIC_INCLUDED */
|
||||
572
modules/dep/mysqllite/include/internal/my_base.h
Normal file
572
modules/dep/mysqllite/include/internal/my_base.h
Normal file
@@ -0,0 +1,572 @@
|
||||
/* Copyright (C) 2000, 2011, Oracle and/or its affiliates. All rights
|
||||
reserved
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/* This file includes constants used with all databases */
|
||||
|
||||
#ifndef _my_base_h
|
||||
#define _my_base_h
|
||||
|
||||
#ifndef stdin /* Included first in handler */
|
||||
#define CHSIZE_USED
|
||||
#include <my_global.h>
|
||||
#include <my_dir.h> /* This includes types */
|
||||
#include <my_sys.h>
|
||||
#include <m_string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef EOVERFLOW
|
||||
#define EOVERFLOW 84
|
||||
#endif
|
||||
|
||||
#endif /* stdin */
|
||||
#include <my_list.h>
|
||||
|
||||
/* The following is bits in the flag parameter to ha_open() */
|
||||
|
||||
#define HA_OPEN_ABORT_IF_LOCKED 0 /* default */
|
||||
#define HA_OPEN_WAIT_IF_LOCKED 1
|
||||
#define HA_OPEN_IGNORE_IF_LOCKED 2
|
||||
#define HA_OPEN_TMP_TABLE 4 /* Table is a temp table */
|
||||
#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 */
|
||||
|
||||
/*
|
||||
We define a complete-field prefix of a key value as a prefix where
|
||||
the last included field in the prefix contains the full field, not
|
||||
just some bytes from the start of the field. A partial-field prefix
|
||||
is allowed to contain only a few first bytes from the last included
|
||||
field.
|
||||
|
||||
Below HA_READ_KEY_EXACT, ..., HA_READ_BEFORE_KEY can take a
|
||||
complete-field prefix of a key value as the search
|
||||
key. HA_READ_PREFIX and HA_READ_PREFIX_LAST could also take a
|
||||
partial-field prefix, but currently (4.0.10) they are only used with
|
||||
complete-field prefixes. MySQL uses a padding trick to implement
|
||||
LIKE 'abc%' queries.
|
||||
|
||||
NOTE that in InnoDB HA_READ_PREFIX_LAST will NOT work with a
|
||||
partial-field prefix because InnoDB currently strips spaces from the
|
||||
end of varchar fields!
|
||||
*/
|
||||
|
||||
enum ha_rkey_function {
|
||||
HA_READ_KEY_EXACT, /* Find first record else error */
|
||||
HA_READ_KEY_OR_NEXT, /* Record or next record */
|
||||
HA_READ_KEY_OR_PREV, /* Record or previous */
|
||||
HA_READ_AFTER_KEY, /* Find next rec. after key-record */
|
||||
HA_READ_BEFORE_KEY, /* Find next rec. before key-record */
|
||||
HA_READ_PREFIX, /* Key which as same prefix */
|
||||
HA_READ_PREFIX_LAST, /* Last key with the same prefix */
|
||||
HA_READ_PREFIX_LAST_OR_PREV, /* Last or prev key with the same prefix */
|
||||
HA_READ_MBR_CONTAIN,
|
||||
HA_READ_MBR_INTERSECT,
|
||||
HA_READ_MBR_WITHIN,
|
||||
HA_READ_MBR_DISJOINT,
|
||||
HA_READ_MBR_EQUAL
|
||||
};
|
||||
|
||||
/* Key algorithm types */
|
||||
|
||||
enum ha_key_alg {
|
||||
HA_KEY_ALG_UNDEF= 0, /* Not specified (old file) */
|
||||
HA_KEY_ALG_BTREE= 1, /* B-tree, default one */
|
||||
HA_KEY_ALG_RTREE= 2, /* R-tree, for spatial searches */
|
||||
HA_KEY_ALG_HASH= 3, /* HASH keys (HEAP tables) */
|
||||
HA_KEY_ALG_FULLTEXT= 4 /* FULLTEXT (MyISAM tables) */
|
||||
};
|
||||
|
||||
/* Storage media types */
|
||||
|
||||
enum ha_storage_media {
|
||||
HA_SM_DEFAULT= 0, /* Not specified (engine default) */
|
||||
HA_SM_DISK= 1, /* DISK storage */
|
||||
HA_SM_MEMORY= 2 /* MAIN MEMORY storage */
|
||||
};
|
||||
|
||||
/* The following is parameter to ha_extra() */
|
||||
|
||||
enum ha_extra_function {
|
||||
HA_EXTRA_NORMAL=0, /* Optimize for space (def) */
|
||||
HA_EXTRA_QUICK=1, /* Optimize for speed */
|
||||
HA_EXTRA_NOT_USED=2,
|
||||
HA_EXTRA_CACHE=3, /* Cache record in HA_rrnd() */
|
||||
HA_EXTRA_NO_CACHE=4, /* End caching of records (def) */
|
||||
HA_EXTRA_NO_READCHECK=5, /* No readcheck on update */
|
||||
HA_EXTRA_READCHECK=6, /* Use readcheck (def) */
|
||||
HA_EXTRA_KEYREAD=7, /* Read only key to database */
|
||||
HA_EXTRA_NO_KEYREAD=8, /* Normal read of records (def) */
|
||||
HA_EXTRA_NO_USER_CHANGE=9, /* No user is allowed to write */
|
||||
HA_EXTRA_KEY_CACHE=10,
|
||||
HA_EXTRA_NO_KEY_CACHE=11,
|
||||
HA_EXTRA_WAIT_LOCK=12, /* Wait until file is avalably (def) */
|
||||
HA_EXTRA_NO_WAIT_LOCK=13, /* If file is locked, return quickly */
|
||||
HA_EXTRA_WRITE_CACHE=14, /* Use write cache in ha_write() */
|
||||
HA_EXTRA_FLUSH_CACHE=15, /* flush write_record_cache */
|
||||
HA_EXTRA_NO_KEYS=16, /* Remove all update of keys */
|
||||
HA_EXTRA_KEYREAD_CHANGE_POS=17, /* Keyread, but change pos */
|
||||
/* xxxxchk -r must be used */
|
||||
HA_EXTRA_REMEMBER_POS=18, /* Remember pos for next/prev */
|
||||
HA_EXTRA_RESTORE_POS=19,
|
||||
HA_EXTRA_REINIT_CACHE=20, /* init cache from current record */
|
||||
HA_EXTRA_FORCE_REOPEN=21, /* Datafile have changed on disk */
|
||||
HA_EXTRA_FLUSH, /* Flush tables to disk */
|
||||
HA_EXTRA_NO_ROWS, /* Don't write rows */
|
||||
HA_EXTRA_RESET_STATE, /* Reset positions */
|
||||
HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/
|
||||
HA_EXTRA_NO_IGNORE_DUP_KEY,
|
||||
HA_EXTRA_PREPARE_FOR_DROP,
|
||||
HA_EXTRA_PREPARE_FOR_UPDATE, /* Remove read cache if problems */
|
||||
HA_EXTRA_PRELOAD_BUFFER_SIZE, /* Set buffer size for preloading */
|
||||
/*
|
||||
On-the-fly switching between unique and non-unique key inserting.
|
||||
*/
|
||||
HA_EXTRA_CHANGE_KEY_TO_UNIQUE,
|
||||
HA_EXTRA_CHANGE_KEY_TO_DUP,
|
||||
/*
|
||||
When using HA_EXTRA_KEYREAD, overwrite only key member fields and keep
|
||||
other fields intact. When this is off (by default) InnoDB will use memcpy
|
||||
to overwrite entire row.
|
||||
*/
|
||||
HA_EXTRA_KEYREAD_PRESERVE_FIELDS,
|
||||
HA_EXTRA_MMAP,
|
||||
/*
|
||||
Ignore if the a tuple is not found, continue processing the
|
||||
transaction and ignore that 'row'. Needed for idempotency
|
||||
handling on the slave
|
||||
|
||||
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
|
||||
key can replace old row with new row instead of reporting error (basically
|
||||
it informs handler that we do REPLACE instead of simple INSERT).
|
||||
Off by default.
|
||||
*/
|
||||
HA_EXTRA_WRITE_CAN_REPLACE,
|
||||
HA_EXTRA_WRITE_CANNOT_REPLACE,
|
||||
/*
|
||||
Inform handler that delete_row()/update_row() cannot batch deletes/updates
|
||||
and should perform them immediately. This may be needed when table has
|
||||
AFTER DELETE/UPDATE triggers which access to subject table.
|
||||
These flags are reset by the handler::extra(HA_EXTRA_RESET) call.
|
||||
*/
|
||||
HA_EXTRA_DELETE_CANNOT_BATCH,
|
||||
HA_EXTRA_UPDATE_CANNOT_BATCH,
|
||||
/*
|
||||
Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be
|
||||
executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY.
|
||||
*/
|
||||
HA_EXTRA_INSERT_WITH_UPDATE,
|
||||
/* Inform handler that we will do a rename */
|
||||
HA_EXTRA_PREPARE_FOR_RENAME,
|
||||
/*
|
||||
Special actions for MERGE tables.
|
||||
*/
|
||||
HA_EXTRA_ADD_CHILDREN_LIST,
|
||||
HA_EXTRA_ATTACH_CHILDREN,
|
||||
HA_EXTRA_IS_ATTACHED_CHILDREN,
|
||||
HA_EXTRA_DETACH_CHILDREN
|
||||
};
|
||||
|
||||
/* Compatible option, to be deleted in 6.0 */
|
||||
#define HA_EXTRA_PREPARE_FOR_DELETE HA_EXTRA_PREPARE_FOR_DROP
|
||||
|
||||
/* The following is parameter to ha_panic() */
|
||||
|
||||
enum ha_panic_function {
|
||||
HA_PANIC_CLOSE, /* Close all databases */
|
||||
HA_PANIC_WRITE, /* Unlock and write status */
|
||||
HA_PANIC_READ /* Lock and read keyinfo */
|
||||
};
|
||||
|
||||
/* The following is parameter to ha_create(); keytypes */
|
||||
|
||||
enum ha_base_keytype {
|
||||
HA_KEYTYPE_END=0,
|
||||
HA_KEYTYPE_TEXT=1, /* Key is sorted as letters */
|
||||
HA_KEYTYPE_BINARY=2, /* Key is sorted as unsigned chars */
|
||||
HA_KEYTYPE_SHORT_INT=3,
|
||||
HA_KEYTYPE_LONG_INT=4,
|
||||
HA_KEYTYPE_FLOAT=5,
|
||||
HA_KEYTYPE_DOUBLE=6,
|
||||
HA_KEYTYPE_NUM=7, /* Not packed num with pre-space */
|
||||
HA_KEYTYPE_USHORT_INT=8,
|
||||
HA_KEYTYPE_ULONG_INT=9,
|
||||
HA_KEYTYPE_LONGLONG=10,
|
||||
HA_KEYTYPE_ULONGLONG=11,
|
||||
HA_KEYTYPE_INT24=12,
|
||||
HA_KEYTYPE_UINT24=13,
|
||||
HA_KEYTYPE_INT8=14,
|
||||
/* Varchar (0-255 bytes) with length packed with 1 byte */
|
||||
HA_KEYTYPE_VARTEXT1=15, /* Key is sorted as letters */
|
||||
HA_KEYTYPE_VARBINARY1=16, /* Key is sorted as unsigned chars */
|
||||
/* Varchar (0-65535 bytes) with length packed with 2 bytes */
|
||||
HA_KEYTYPE_VARTEXT2=17, /* Key is sorted as letters */
|
||||
HA_KEYTYPE_VARBINARY2=18, /* Key is sorted as unsigned chars */
|
||||
HA_KEYTYPE_BIT=19
|
||||
};
|
||||
|
||||
#define HA_MAX_KEYTYPE 31 /* Must be log2-1 */
|
||||
|
||||
/* These flags kan be OR:ed to key-flag */
|
||||
|
||||
#define HA_NOSAME 1 /* Set if not dupplicated records */
|
||||
#define HA_PACK_KEY 2 /* Pack string key to previous key */
|
||||
#define HA_AUTO_KEY 16
|
||||
#define HA_BINARY_PACK_KEY 32 /* Packing of all keys to prev key */
|
||||
#define HA_FULLTEXT 128 /* For full-text search */
|
||||
#define HA_UNIQUE_CHECK 256 /* Check the key for uniqueness */
|
||||
#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)
|
||||
|
||||
/*
|
||||
Key contains partial segments.
|
||||
|
||||
This flag is internal to the MySQL server by design. It is not supposed
|
||||
neither to be saved in FRM-files, nor to be passed to storage engines.
|
||||
It is intended to pass information into internal static sort_keys(KEY *,
|
||||
KEY *) function.
|
||||
|
||||
This flag can be calculated -- it's based on key lengths comparison.
|
||||
*/
|
||||
#define HA_KEY_HAS_PART_KEY_SEG 65536
|
||||
|
||||
/* Automatic bits in key-flag */
|
||||
|
||||
#define HA_SPACE_PACK_USED 4 /* Test for if SPACE_PACK used */
|
||||
#define HA_VAR_LENGTH_KEY 8
|
||||
#define HA_NULL_PART_KEY 64
|
||||
#define HA_USES_COMMENT 4096
|
||||
#define HA_USES_PARSER 16384 /* Fulltext index uses [pre]parser */
|
||||
#define HA_USES_BLOCK_SIZE ((uint) 32768)
|
||||
#define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */
|
||||
|
||||
/* These flags can be added to key-seg-flag */
|
||||
|
||||
#define HA_SPACE_PACK 1 /* Pack space in key-seg */
|
||||
#define HA_PART_KEY_SEG 4 /* Used by MySQL for part-key-cols */
|
||||
#define HA_VAR_LENGTH_PART 8
|
||||
#define HA_NULL_PART 16
|
||||
#define HA_BLOB_PART 32
|
||||
#define HA_SWAP_KEY 64
|
||||
#define HA_REVERSE_SORT 128 /* Sort key in reverse order */
|
||||
#define HA_NO_SORT 256 /* do not bother sorting on this keyseg */
|
||||
/*
|
||||
End space in unique/varchar are considered equal. (Like 'a' and 'a ')
|
||||
Only needed for internal temporary tables.
|
||||
*/
|
||||
#define HA_END_SPACE_ARE_EQUAL 512
|
||||
#define HA_BIT_PART 1024
|
||||
|
||||
/* optionbits for database */
|
||||
#define HA_OPTION_PACK_RECORD 1
|
||||
#define HA_OPTION_PACK_KEYS 2
|
||||
#define HA_OPTION_COMPRESS_RECORD 4
|
||||
#define HA_OPTION_LONG_BLOB_PTR 8 /* new ISAM format */
|
||||
#define HA_OPTION_TMP_TABLE 16
|
||||
#define HA_OPTION_CHECKSUM 32
|
||||
#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 */
|
||||
|
||||
/* Bits in flag to create() */
|
||||
|
||||
#define HA_DONT_TOUCH_DATA 1 /* Don't empty datafile (isamchk) */
|
||||
#define HA_PACK_RECORD 2 /* Request packed record format */
|
||||
#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.
|
||||
The method copies misc handler information out of the storage engine
|
||||
to data structures accessible from MySQL
|
||||
|
||||
Same flags are also passed down to mi_status, myrg_status, etc.
|
||||
*/
|
||||
|
||||
/* this one is not used */
|
||||
#define HA_STATUS_POS 1
|
||||
/*
|
||||
assuming the table keeps shared actual copy of the 'info' and
|
||||
local, possibly outdated copy, the following flag means that
|
||||
it should not try to get the actual data (locking the shared structure)
|
||||
slightly outdated version will suffice
|
||||
*/
|
||||
#define HA_STATUS_NO_LOCK 2
|
||||
/* update the time of the last modification (in handler::update_time) */
|
||||
#define HA_STATUS_TIME 4
|
||||
/*
|
||||
update the 'constant' part of the info:
|
||||
handler::max_data_file_length, max_index_file_length, create_time
|
||||
sortkey, ref_length, block_size, data_file_name, index_file_name.
|
||||
handler::table->s->keys_in_use, keys_for_keyread, rec_per_key
|
||||
*/
|
||||
#define HA_STATUS_CONST 8
|
||||
/*
|
||||
update the 'variable' part of the info:
|
||||
handler::records, deleted, data_file_length, index_file_length,
|
||||
check_time, mean_rec_length
|
||||
*/
|
||||
#define HA_STATUS_VARIABLE 16
|
||||
/*
|
||||
get the information about the key that caused last duplicate value error
|
||||
update handler::errkey and handler::dupp_ref
|
||||
see handler::get_dup_key()
|
||||
*/
|
||||
#define HA_STATUS_ERRKEY 32
|
||||
/*
|
||||
update handler::auto_increment_value
|
||||
*/
|
||||
#define HA_STATUS_AUTO 64
|
||||
/*
|
||||
Get also delete_length when HA_STATUS_VARIABLE is called. It's ok to set it also
|
||||
when only HA_STATUS_VARIABLE but it won't be used.
|
||||
*/
|
||||
#define HA_STATUS_VARIABLE_EXTRA 128
|
||||
|
||||
/*
|
||||
Errorcodes given by handler functions
|
||||
|
||||
opt_sum_query() assumes these codes are > 1
|
||||
Do not add error numbers before HA_ERR_FIRST.
|
||||
If necessary to add lower numbers, change HA_ERR_FIRST accordingly.
|
||||
*/
|
||||
#define HA_ERR_FIRST 120 /* Copy of first error nr.*/
|
||||
|
||||
#define HA_ERR_KEY_NOT_FOUND 120 /* Didn't find key on read or update */
|
||||
#define HA_ERR_FOUND_DUPP_KEY 121 /* Dupplicate key on write */
|
||||
#define HA_ERR_INTERNAL_ERROR 122 /* Internal error */
|
||||
#define HA_ERR_RECORD_CHANGED 123 /* Uppdate with is recoverable */
|
||||
#define HA_ERR_WRONG_INDEX 124 /* Wrong index given to function */
|
||||
#define HA_ERR_CRASHED 126 /* Indexfile is crashed */
|
||||
#define HA_ERR_WRONG_IN_RECORD 127 /* Record-file is crashed */
|
||||
#define HA_ERR_OUT_OF_MEM 128 /* Record-file is crashed */
|
||||
#define HA_ERR_NOT_A_TABLE 130 /* not a MYI file - no signature */
|
||||
#define HA_ERR_WRONG_COMMAND 131 /* Command not supported */
|
||||
#define HA_ERR_OLD_FILE 132 /* old databasfile */
|
||||
#define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */
|
||||
#define HA_ERR_RECORD_DELETED 134 /* A record is not there */
|
||||
#define HA_ERR_RECORD_FILE_FULL 135 /* No more room in file */
|
||||
#define HA_ERR_INDEX_FILE_FULL 136 /* No more room in file */
|
||||
#define HA_ERR_END_OF_FILE 137 /* end in next/prev/first/last */
|
||||
#define HA_ERR_UNSUPPORTED 138 /* unsupported extension used */
|
||||
#define HA_ERR_TO_BIG_ROW 139 /* Too big row */
|
||||
#define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */
|
||||
#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */
|
||||
#define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */
|
||||
#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting tables in MERGE */
|
||||
#define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */
|
||||
#define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */
|
||||
#define HA_ERR_LOCK_WAIT_TIMEOUT 146
|
||||
#define HA_ERR_LOCK_TABLE_FULL 147
|
||||
#define HA_ERR_READ_ONLY_TRANSACTION 148 /* Updates not allowed */
|
||||
#define HA_ERR_LOCK_DEADLOCK 149
|
||||
#define HA_ERR_CANNOT_ADD_FOREIGN 150 /* Cannot add a foreign key constr. */
|
||||
#define HA_ERR_NO_REFERENCED_ROW 151 /* Cannot add a child row */
|
||||
#define HA_ERR_ROW_IS_REFERENCED 152 /* Cannot delete a parent row */
|
||||
#define HA_ERR_NO_SAVEPOINT 153 /* No savepoint with that name */
|
||||
#define HA_ERR_NON_UNIQUE_BLOCK_SIZE 154 /* Non unique key block size */
|
||||
#define HA_ERR_NO_SUCH_TABLE 155 /* The table does not exist in engine */
|
||||
#define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */
|
||||
#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */
|
||||
/* NULLs are not supported in spatial index */
|
||||
#define HA_ERR_NULL_IN_SPATIAL 158
|
||||
#define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */
|
||||
/* There's no partition in table for given value */
|
||||
#define HA_ERR_NO_PARTITION_FOUND 160
|
||||
#define HA_ERR_RBR_LOGGING_FAILED 161 /* Row-based binlogging of row failed */
|
||||
#define HA_ERR_DROP_INDEX_FK 162 /* Index needed in foreign key constr */
|
||||
/*
|
||||
Upholding foreign key constraints would lead to a duplicate key error
|
||||
in some other table.
|
||||
*/
|
||||
#define HA_ERR_FOREIGN_DUPLICATE_KEY 163
|
||||
/* The table changed in storage engine */
|
||||
#define HA_ERR_TABLE_NEEDS_UPGRADE 164
|
||||
#define HA_ERR_TABLE_READONLY 165 /* The table is not writable */
|
||||
|
||||
#define HA_ERR_AUTOINC_READ_FAILED 166 /* Failed to get next autoinc value */
|
||||
#define HA_ERR_AUTOINC_ERANGE 167 /* Failed to set row autoinc value */
|
||||
#define HA_ERR_GENERIC 168 /* Generic error */
|
||||
/* row not actually updated: new values same as the old values */
|
||||
#define HA_ERR_RECORD_IS_THE_SAME 169
|
||||
/* 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. */
|
||||
|
||||
typedef ulong key_part_map;
|
||||
#define HA_WHOLE_KEY (~(key_part_map)0)
|
||||
|
||||
/* Intern constants in databases */
|
||||
|
||||
/* bits in _search */
|
||||
#define SEARCH_FIND 1
|
||||
#define SEARCH_NO_FIND 2
|
||||
#define SEARCH_SAME 4
|
||||
#define SEARCH_BIGGER 8
|
||||
#define SEARCH_SMALLER 16
|
||||
#define SEARCH_SAVE_BUFF 32
|
||||
#define SEARCH_UPDATE 64
|
||||
#define SEARCH_PREFIX 128
|
||||
#define SEARCH_LAST 256
|
||||
#define MBR_CONTAIN 512
|
||||
#define MBR_INTERSECT 1024
|
||||
#define MBR_WITHIN 2048
|
||||
#define MBR_DISJOINT 4096
|
||||
#define MBR_EQUAL 8192
|
||||
#define MBR_DATA 16384
|
||||
#define SEARCH_NULL_ARE_EQUAL 32768 /* NULL in keys are equal */
|
||||
#define SEARCH_NULL_ARE_NOT_EQUAL 65536 /* NULL in keys are not equal */
|
||||
|
||||
/* bits in opt_flag */
|
||||
#define QUICK_USED 1
|
||||
#define READ_CACHE_USED 2
|
||||
#define READ_CHECK_USED 4
|
||||
#define KEY_READ_USED 8
|
||||
#define WRITE_CACHE_USED 16
|
||||
#define OPT_NO_ROWS 32
|
||||
|
||||
/* bits in update */
|
||||
#define HA_STATE_CHANGED 1 /* Database has changed */
|
||||
#define HA_STATE_AKTIV 2 /* Has a current record */
|
||||
#define HA_STATE_WRITTEN 4 /* Record is written */
|
||||
#define HA_STATE_DELETED 8
|
||||
#define HA_STATE_NEXT_FOUND 16 /* Next found record (record before) */
|
||||
#define HA_STATE_PREV_FOUND 32 /* Prev found record (record after) */
|
||||
#define HA_STATE_NO_KEY 64 /* Last read didn't find record */
|
||||
#define HA_STATE_KEY_CHANGED 128
|
||||
#define HA_STATE_WRITE_AT_END 256 /* set in _ps_find_writepos */
|
||||
#define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */
|
||||
#define HA_STATE_ROW_CHANGED 1024 /* To invalide ROW cache */
|
||||
#define HA_STATE_EXTEND_BLOCK 2048
|
||||
#define HA_STATE_RNEXT_SAME 4096 /* rnext_same occupied lastkey2 */
|
||||
|
||||
/* myisampack expects no more than 32 field types. */
|
||||
enum en_fieldtype {
|
||||
FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE,
|
||||
FIELD_SKIP_ZERO,FIELD_BLOB,FIELD_CONSTANT,FIELD_INTERVALL,FIELD_ZERO,
|
||||
FIELD_VARCHAR,FIELD_CHECK,
|
||||
FIELD_enum_val_count
|
||||
};
|
||||
|
||||
enum data_file_type {
|
||||
STATIC_RECORD, DYNAMIC_RECORD, COMPRESSED_RECORD, BLOCK_RECORD
|
||||
};
|
||||
|
||||
/* For key ranges */
|
||||
|
||||
#define NO_MIN_RANGE 1
|
||||
#define NO_MAX_RANGE 2
|
||||
#define NEAR_MIN 4
|
||||
#define NEAR_MAX 8
|
||||
#define UNIQUE_RANGE 16
|
||||
#define EQ_RANGE 32
|
||||
#define NULL_RANGE 64
|
||||
#define GEOM_FLAG 128
|
||||
#define SKIP_RANGE 256
|
||||
|
||||
typedef struct st_key_range
|
||||
{
|
||||
const uchar *key;
|
||||
uint length;
|
||||
key_part_map keypart_map;
|
||||
enum ha_rkey_function flag;
|
||||
} key_range;
|
||||
|
||||
typedef struct st_key_multi_range
|
||||
{
|
||||
key_range start_key;
|
||||
key_range end_key;
|
||||
char *ptr; /* Free to use by caller (ptr to row etc) */
|
||||
uint range_flag; /* key range flags see above */
|
||||
} KEY_MULTI_RANGE;
|
||||
|
||||
|
||||
/* For number of records */
|
||||
#ifdef BIG_TABLES
|
||||
#define rows2double(A) ulonglong2double(A)
|
||||
typedef my_off_t ha_rows;
|
||||
#else
|
||||
#define rows2double(A) (double) (A)
|
||||
typedef ulong ha_rows;
|
||||
#endif
|
||||
|
||||
#define HA_POS_ERROR (~ (ha_rows) 0)
|
||||
#define HA_OFFSET_ERROR (~ (my_off_t) 0)
|
||||
|
||||
#if SYSTEM_SIZEOF_OFF_T == 4
|
||||
#define MAX_FILE_SIZE INT_MAX32
|
||||
#else
|
||||
#define MAX_FILE_SIZE LONGLONG_MAX
|
||||
#endif
|
||||
|
||||
#define HA_VARCHAR_PACKLENGTH(field_length) ((field_length) < 256 ? 1 :2)
|
||||
|
||||
/* invalidator function reference for Query Cache */
|
||||
C_MODE_START
|
||||
typedef void (* invalidator_by_filename)(const char * filename);
|
||||
C_MODE_END
|
||||
|
||||
#endif /* _my_base_h */
|
||||
105
modules/dep/mysqllite/include/internal/my_bit.h
Normal file
105
modules/dep/mysqllite/include/internal/my_bit.h
Normal file
@@ -0,0 +1,105 @@
|
||||
#ifndef MY_BIT_INCLUDED
|
||||
#define MY_BIT_INCLUDED
|
||||
|
||||
/*
|
||||
Some useful bit functions
|
||||
*/
|
||||
|
||||
C_MODE_START
|
||||
|
||||
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_ushort(ushort v)
|
||||
{
|
||||
return _my_bits_nbits[v];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
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) ];
|
||||
}
|
||||
|
||||
C_MODE_END
|
||||
|
||||
#endif /* MY_BIT_INCLUDED */
|
||||
142
modules/dep/mysqllite/include/internal/my_bitmap.h
Normal file
142
modules/dep/mysqllite/include/internal/my_bitmap.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/* Copyright (C) 2000 MySQL AB, 2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#ifndef _my_bitmap_h_
|
||||
#define _my_bitmap_h_
|
||||
|
||||
#define MY_BIT_NONE (~(uint) 0)
|
||||
|
||||
#include <m_string.h>
|
||||
|
||||
typedef uint32 my_bitmap_map;
|
||||
|
||||
typedef struct st_bitmap
|
||||
{
|
||||
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
|
||||
acquiring the mutex
|
||||
*/
|
||||
mysql_mutex_t *mutex;
|
||||
} MY_BITMAP;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
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_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_free(MY_BITMAP *map);
|
||||
extern void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit);
|
||||
extern void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size);
|
||||
extern void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2);
|
||||
extern void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2);
|
||||
extern void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2);
|
||||
extern void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2);
|
||||
extern void bitmap_invert(MY_BITMAP *map);
|
||||
extern void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2);
|
||||
|
||||
extern uint bitmap_lock_set_next(MY_BITMAP *map);
|
||||
extern void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit);
|
||||
/* Fast, not thread safe, bitmap functions */
|
||||
#define bitmap_buffer_size(bits) (((bits)+31)/32)*4
|
||||
#define no_bytes_in_map(map) (((map)->n_bits + 7)/8)
|
||||
#define no_words_in_map(map) (((map)->n_bits + 31)/32)
|
||||
#define bytes_word_aligned(bytes) (4*((bytes + 3)/4))
|
||||
#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)
|
||||
{
|
||||
*(map1)->last_word_ptr|= (map1)->last_word_mask;
|
||||
*(map2)->last_word_ptr|= (map2)->last_word_mask;
|
||||
return memcmp((map1)->bitmap, (map2)->bitmap, 4*no_words_in_map((map1)))==0;
|
||||
}
|
||||
|
||||
#define bitmap_clear_all(MAP) \
|
||||
{ memset((MAP)->bitmap, 0, 4*no_words_in_map((MAP))); }
|
||||
#define bitmap_set_all(MAP) \
|
||||
(memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP))))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _my_bitmap_h_ */
|
||||
130
modules/dep/mysqllite/include/internal/my_handler.h
Normal file
130
modules/dep/mysqllite/include/internal/my_handler.h
Normal file
@@ -0,0 +1,130 @@
|
||||
/* Copyright (C) 2002-2006 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; version 2
|
||||
of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA */
|
||||
|
||||
#ifndef _my_handler_h
|
||||
#define _my_handler_h
|
||||
|
||||
#include "myisampack.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "m_ctype.h" /* CHARSET_INFO */
|
||||
|
||||
/*
|
||||
There is a hard limit for the maximum number of keys as there are only
|
||||
8 bits in the index file header for the number of keys in a table.
|
||||
This means that 0..255 keys can exist for a table. The idea of
|
||||
HA_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on
|
||||
a MyISAM table for which one has more keys than MyISAM is normally
|
||||
compiled for. If you don't have this, you will get a core dump when
|
||||
running myisamchk compiled for 128 keys on a table with 255 keys.
|
||||
*/
|
||||
|
||||
#define HA_MAX_POSSIBLE_KEY 255 /* For myisamchk */
|
||||
/*
|
||||
The following defines can be increased if necessary.
|
||||
But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH.
|
||||
*/
|
||||
|
||||
#define HA_MAX_KEY_LENGTH 1000 /* Max length in bytes */
|
||||
#define HA_MAX_KEY_SEG 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)
|
||||
|
||||
typedef struct st_HA_KEYSEG /* Key-portion */
|
||||
{
|
||||
CHARSET_INFO *charset;
|
||||
uint32 start; /* Start of key in record */
|
||||
uint32 null_pos; /* position to NULL indicator */
|
||||
uint16 bit_pos; /* Position to bit part */
|
||||
uint16 flag;
|
||||
uint16 length; /* Keylength */
|
||||
uint16 language;
|
||||
uint8 type; /* Type of key (for sort) */
|
||||
uint8 null_bit; /* bitmask to test for NULL */
|
||||
uint8 bit_start,bit_end; /* if bit field */
|
||||
uint8 bit_length; /* Length of bit part */
|
||||
} HA_KEYSEG;
|
||||
|
||||
#define get_key_length(length,key) \
|
||||
{ if (*(uchar*) (key) != 255) \
|
||||
length= (uint) *(uchar*) ((key)++); \
|
||||
else \
|
||||
{ length= mi_uint2korr((key)+1); (key)+=3; } \
|
||||
}
|
||||
|
||||
#define get_key_length_rdonly(length,key) \
|
||||
{ if (*(uchar*) (key) != 255) \
|
||||
length= ((uint) *(uchar*) ((key))); \
|
||||
else \
|
||||
{ length= mi_uint2korr((key)+1); } \
|
||||
}
|
||||
|
||||
#define get_key_pack_length(length,length_pack,key) \
|
||||
{ if (*(uchar*) (key) != 255) \
|
||||
{ length= (uint) *(uchar*) ((key)++); length_pack= 1; }\
|
||||
else \
|
||||
{ length=mi_uint2korr((key)+1); (key)+= 3; length_pack= 3; } \
|
||||
}
|
||||
|
||||
#define store_key_length_inc(key,length) \
|
||||
{ if ((length) < 255) \
|
||||
{ *(key)++= (length); } \
|
||||
else \
|
||||
{ *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \
|
||||
}
|
||||
|
||||
#define size_to_store_key_length(length) ((length) < 255 ? 1 : 3)
|
||||
|
||||
#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \
|
||||
(((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \
|
||||
((1 << (bit_len)) - 1))
|
||||
|
||||
#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \
|
||||
{ \
|
||||
(bit_ptr)[0]= ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \
|
||||
((bits) << (bit_ofs)); \
|
||||
if ((bit_ofs) + (bit_len) > 8) \
|
||||
(bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \
|
||||
((bits) >> (8 - (bit_ofs))); \
|
||||
}
|
||||
|
||||
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
|
||||
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
|
||||
|
||||
extern int ha_compare_text(CHARSET_INFO *, 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,
|
||||
uint *diff_pos);
|
||||
|
||||
extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a);
|
||||
extern void my_handler_error_register(void);
|
||||
extern void my_handler_error_unregister(void);
|
||||
/*
|
||||
Inside an in-memory data record, memory pointers to pieces of the
|
||||
record (like BLOBs) are stored in their native byte order and in
|
||||
this amount of bytes.
|
||||
*/
|
||||
#define portable_sizeof_char_ptr 8
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _my_handler_h */
|
||||
31
modules/dep/mysqllite/include/internal/my_libwrap.h
Normal file
31
modules/dep/mysqllite/include/internal/my_libwrap.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef MY_LIBWRAP_INCLUDED
|
||||
#define MY_LIBWRAP_INCLUDED
|
||||
|
||||
/* 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 */
|
||||
|
||||
#ifdef HAVE_LIBWRAP
|
||||
#include <tcpd.h>
|
||||
#include <syslog.h>
|
||||
#ifdef NEED_SYS_SYSLOG_H
|
||||
#include <sys/syslog.h>
|
||||
#endif /* NEED_SYS_SYSLOG_H */
|
||||
|
||||
extern void my_fromhost(struct request_info *req);
|
||||
extern int my_hosts_access(struct request_info *req);
|
||||
extern char *my_eval_client(struct request_info *req);
|
||||
|
||||
#endif /* HAVE_LIBWRAP */
|
||||
#endif /* MY_LIBWRAP_INCLUDED */
|
||||
59
modules/dep/mysqllite/include/internal/my_md5.h
Normal file
59
modules/dep/mysqllite/include/internal/my_md5.h
Normal file
@@ -0,0 +1,59 @@
|
||||
#ifndef MY_MD5_INCLUDED
|
||||
#define MY_MD5_INCLUDED
|
||||
|
||||
/* 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 */
|
||||
|
||||
/* See md5.c for explanation and copyright information. */
|
||||
|
||||
/*
|
||||
* $FreeBSD: src/contrib/cvs/lib/md5.h,v 1.2 1999/12/11 15:10:02 peter Exp $
|
||||
*/
|
||||
|
||||
/* Unlike previous versions of this code, uint32 need not be exactly
|
||||
32 bits, merely 32 bits or more. Choosing a data type which is 32
|
||||
bits instead of 64 is not important; speed is considerably more
|
||||
important. ANSI guarantees that "unsigned long" will be big enough,
|
||||
and always using it seems to have few disadvantages. */
|
||||
typedef uint32 cvs_uint32;
|
||||
|
||||
typedef struct {
|
||||
cvs_uint32 buf[4];
|
||||
cvs_uint32 bits[2];
|
||||
unsigned char in[64];
|
||||
} my_MD5Context;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void my_MD5Init (my_MD5Context *context);
|
||||
void my_MD5Update (my_MD5Context *context,
|
||||
unsigned char const *buf, unsigned len);
|
||||
void my_MD5Final (unsigned char digest[16],
|
||||
my_MD5Context *context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define MY_MD5_HASH(digest,buf,len) \
|
||||
do { \
|
||||
my_MD5Context ctx; \
|
||||
my_MD5Init (&ctx); \
|
||||
my_MD5Update (&ctx, buf, len); \
|
||||
my_MD5Final (digest, &ctx); \
|
||||
} while (0)
|
||||
|
||||
#endif /* MY_MD__INCLUDED */
|
||||
52
modules/dep/mysqllite/include/internal/my_nosys.h
Normal file
52
modules/dep/mysqllite/include/internal/my_nosys.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* 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 */
|
||||
|
||||
/*
|
||||
Header to remove use of my_functions in functions where we need speed and
|
||||
where calls to posix functions should work
|
||||
*/
|
||||
#ifndef _my_nosys_h
|
||||
#define _my_nosys_h
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef __MY_NOSYS__
|
||||
#define __MY_NOSYS__
|
||||
|
||||
#ifndef HAVE_STDLIB_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#undef my_read
|
||||
#undef my_write
|
||||
#undef my_seek
|
||||
#define my_read(a,b,c,d) my_quick_read(a,b,c,d)
|
||||
#define my_write(a,b,c,d) my_quick_write(a,b,c)
|
||||
extern size_t my_quick_read(File Filedes,uchar *Buffer,size_t Count,
|
||||
myf myFlags);
|
||||
extern size_t my_quick_write(File Filedes,const uchar *Buffer,size_t Count);
|
||||
|
||||
#if defined(USE_HALLOC)
|
||||
#define my_malloc(a,b) halloc(a,1)
|
||||
#define my_no_flags_free(a) hfree(a)
|
||||
#endif
|
||||
|
||||
#endif /* __MY_NOSYS__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
129
modules/dep/mysqllite/include/internal/my_rdtsc.h
Normal file
129
modules/dep/mysqllite/include/internal/my_rdtsc.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/* Copyright (C) 2008, 2009 Sun Microsystems, Inc
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/*
|
||||
rdtsc3 -- multi-platform timer code
|
||||
pgulutzan@mysql.com, 2005-08-29
|
||||
modified 2008-11-02
|
||||
*/
|
||||
|
||||
#ifndef MY_RDTSC_H
|
||||
#define MY_RDTSC_H
|
||||
|
||||
/**
|
||||
Characteristics of a timer.
|
||||
*/
|
||||
struct my_timer_unit_info
|
||||
{
|
||||
/** Routine used for the timer. */
|
||||
ulonglong routine;
|
||||
/** Overhead of the timer. */
|
||||
ulonglong overhead;
|
||||
/** Frequency of the timer. */
|
||||
ulonglong frequency;
|
||||
/** Resolution of the timer. */
|
||||
ulonglong resolution;
|
||||
};
|
||||
|
||||
/**
|
||||
Characteristics of all the supported timers.
|
||||
@sa my_timer_init().
|
||||
*/
|
||||
struct my_timer_info
|
||||
{
|
||||
/** Characteristics of the cycle timer. */
|
||||
struct my_timer_unit_info cycles;
|
||||
/** Characteristics of the nanosecond timer. */
|
||||
struct my_timer_unit_info nanoseconds;
|
||||
/** Characteristics of the microsecond timer. */
|
||||
struct my_timer_unit_info microseconds;
|
||||
/** Characteristics of the millisecond timer. */
|
||||
struct my_timer_unit_info milliseconds;
|
||||
/** Characteristics of the tick timer. */
|
||||
struct my_timer_unit_info ticks;
|
||||
};
|
||||
|
||||
typedef struct my_timer_info MY_TIMER_INFO;
|
||||
|
||||
C_MODE_START
|
||||
|
||||
/**
|
||||
A cycle timer.
|
||||
@return the current timer value, in cycles.
|
||||
*/
|
||||
ulonglong my_timer_cycles(void);
|
||||
|
||||
/**
|
||||
A namoseconds timer.
|
||||
@return the current timer value, in nanoseconds.
|
||||
*/
|
||||
ulonglong my_timer_nanoseconds(void);
|
||||
|
||||
/**
|
||||
A microseconds timer.
|
||||
@return the current timer value, in microseconds.
|
||||
*/
|
||||
ulonglong my_timer_microseconds(void);
|
||||
|
||||
/**
|
||||
A millisecond timer.
|
||||
@return the current timer value, in milliseconds.
|
||||
*/
|
||||
ulonglong my_timer_milliseconds(void);
|
||||
|
||||
/**
|
||||
A ticks timer.
|
||||
@return the current timer value, in ticks.
|
||||
*/
|
||||
ulonglong my_timer_ticks(void);
|
||||
|
||||
/**
|
||||
Timer initialization function.
|
||||
@param [out] mti the timer characteristics.
|
||||
*/
|
||||
void my_timer_init(MY_TIMER_INFO *mti);
|
||||
|
||||
C_MODE_END
|
||||
|
||||
#define MY_TIMER_ROUTINE_ASM_X86 1
|
||||
#define MY_TIMER_ROUTINE_ASM_X86_64 2
|
||||
#define MY_TIMER_ROUTINE_RDTSCLL 3
|
||||
#define MY_TIMER_ROUTINE_ASM_X86_WIN 4
|
||||
#define MY_TIMER_ROUTINE_RDTSC 5
|
||||
#define MY_TIMER_ROUTINE_ASM_IA64 6
|
||||
#define MY_TIMER_ROUTINE_ASM_PPC 7
|
||||
#define MY_TIMER_ROUTINE_SGI_CYCLE 8
|
||||
#define MY_TIMER_ROUTINE_GETHRTIME 9
|
||||
#define MY_TIMER_ROUTINE_READ_REAL_TIME 10
|
||||
#define MY_TIMER_ROUTINE_CLOCK_GETTIME 11
|
||||
#define MY_TIMER_ROUTINE_NXGETTIME 12
|
||||
#define MY_TIMER_ROUTINE_GETTIMEOFDAY 13
|
||||
#define MY_TIMER_ROUTINE_QUERYPERFORMANCECOUNTER 14
|
||||
#define MY_TIMER_ROUTINE_GETTICKCOUNT 15
|
||||
#define MY_TIMER_ROUTINE_TIME 16
|
||||
#define MY_TIMER_ROUTINE_TIMES 17
|
||||
#define MY_TIMER_ROUTINE_FTIME 18
|
||||
#define MY_TIMER_ROUTINE_ASM_PPC64 19
|
||||
#define MY_TIMER_ROUTINE_ASM_SUNPRO_SPARC64 20
|
||||
#define MY_TIMER_ROUTINE_ASM_SUNPRO_SPARC32 21
|
||||
#define MY_TIMER_ROUTINE_ASM_SUNPRO_I386 22
|
||||
#define MY_TIMER_ROUTINE_ASM_GCC_SPARC64 23
|
||||
#define MY_TIMER_ROUTINE_ASM_GCC_SPARC32 24
|
||||
#define MY_TIMER_ROUTINE_MACH_ABSOLUTE_TIME 25
|
||||
#define MY_TIMER_ROUTINE_GETSYSTEMTIMEASFILETIME 26
|
||||
#define MY_TIMER_ROUTINE_ASM_SUNPRO_X86_64 27
|
||||
|
||||
#endif
|
||||
|
||||
64
modules/dep/mysqllite/include/internal/my_stacktrace.h
Normal file
64
modules/dep/mysqllite/include/internal/my_stacktrace.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* 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 */
|
||||
|
||||
#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
|
||||
|
||||
#define HAVE_WRITE_CORE
|
||||
|
||||
#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_ */
|
||||
170
modules/dep/mysqllite/include/internal/my_time.h
Normal file
170
modules/dep/mysqllite/include/internal/my_time.h
Normal file
@@ -0,0 +1,170 @@
|
||||
/* Copyright (C) 2004-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 */
|
||||
|
||||
/*
|
||||
This is a private header of sql-common library, containing
|
||||
declarations for my_time.c
|
||||
*/
|
||||
|
||||
#ifndef _my_time_h_
|
||||
#define _my_time_h_
|
||||
#include "my_global.h"
|
||||
#include "mysql_time.h"
|
||||
|
||||
C_MODE_START
|
||||
|
||||
extern ulonglong log_10_int[20];
|
||||
extern uchar days_in_month[];
|
||||
|
||||
/*
|
||||
Portable time_t replacement.
|
||||
Should be signed and hold seconds for 1902 -- 2038-01-19 range
|
||||
i.e at least a 32bit variable
|
||||
|
||||
Using the system built in time_t is not an option as
|
||||
we rely on the above requirements in the time functions
|
||||
*/
|
||||
typedef long my_time_t;
|
||||
|
||||
#define MY_TIME_T_MAX LONG_MAX
|
||||
#define MY_TIME_T_MIN LONG_MIN
|
||||
|
||||
/* Time handling defaults */
|
||||
#define TIMESTAMP_MAX_YEAR 2038
|
||||
#define TIMESTAMP_MIN_YEAR (1900 + YY_PART_YEAR - 1)
|
||||
#define TIMESTAMP_MAX_VALUE INT_MAX32
|
||||
#define TIMESTAMP_MIN_VALUE 1
|
||||
|
||||
/* two-digit years < this are 20..; >= this are 19.. */
|
||||
#define YY_PART_YEAR 70
|
||||
|
||||
/* Flags to str_to_datetime */
|
||||
#define TIME_FUZZY_DATE 1
|
||||
#define TIME_DATETIME_ONLY 2
|
||||
/* Must be same as MODE_NO_ZERO_IN_DATE */
|
||||
#define TIME_NO_ZERO_IN_DATE (65536L*2*2*2*2*2*2*2)
|
||||
/* Must be same as MODE_NO_ZERO_DATE */
|
||||
#define TIME_NO_ZERO_DATE (TIME_NO_ZERO_IN_DATE*2)
|
||||
#define TIME_INVALID_DATES (TIME_NO_ZERO_DATE*2)
|
||||
|
||||
#define MYSQL_TIME_WARN_TRUNCATED 1
|
||||
#define MYSQL_TIME_WARN_OUT_OF_RANGE 2
|
||||
|
||||
/* Limits for the TIME data type */
|
||||
#define TIME_MAX_HOUR 838
|
||||
#define TIME_MAX_MINUTE 59
|
||||
#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,
|
||||
ulonglong flags, int *was_cut);
|
||||
enum enum_mysql_timestamp_type
|
||||
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
ulonglong flags, int *was_cut);
|
||||
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
|
||||
ulonglong flags, int *was_cut);
|
||||
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *);
|
||||
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *);
|
||||
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *);
|
||||
ulonglong TIME_to_ulonglong(const MYSQL_TIME *);
|
||||
|
||||
|
||||
my_bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
|
||||
int *warning);
|
||||
|
||||
int check_time_range(struct st_mysql_time *, int *warning);
|
||||
|
||||
long calc_daynr(uint year,uint month,uint day);
|
||||
uint calc_days_in_year(uint year);
|
||||
uint year_2000_handling(uint year);
|
||||
|
||||
void my_init_time(void);
|
||||
|
||||
|
||||
/*
|
||||
Function to check sanity of a TIMESTAMP value
|
||||
|
||||
DESCRIPTION
|
||||
Check if a given MYSQL_TIME value fits in TIMESTAMP range.
|
||||
This function doesn't make precise check, but rather a rough
|
||||
estimate.
|
||||
|
||||
RETURN VALUES
|
||||
FALSE The value seems sane
|
||||
TRUE The MYSQL_TIME value is definitely out of range
|
||||
*/
|
||||
|
||||
static inline my_bool validate_timestamp_range(const MYSQL_TIME *t)
|
||||
{
|
||||
if ((t->year > TIMESTAMP_MAX_YEAR || t->year < TIMESTAMP_MIN_YEAR) ||
|
||||
(t->year == TIMESTAMP_MAX_YEAR && (t->month > 1 || t->day > 19)) ||
|
||||
(t->year == TIMESTAMP_MIN_YEAR && (t->month < 12 || t->day < 31)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
my_time_t
|
||||
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone,
|
||||
my_bool *in_dst_time_gap);
|
||||
|
||||
void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type);
|
||||
|
||||
/*
|
||||
Required buffer length for my_time_to_str, my_date_to_str,
|
||||
my_datetime_to_str and TIME_to_string functions. Note, that the
|
||||
caller is still responsible to check that given TIME structure
|
||||
has values in valid ranges, otherwise size of the buffer could
|
||||
be not enough. We also rely on the fact that even wrong values
|
||||
sent using binary protocol fit in this buffer.
|
||||
*/
|
||||
#define MAX_DATE_STRING_REP_LENGTH 30
|
||||
|
||||
int my_time_to_str(const MYSQL_TIME *l_time, char *to);
|
||||
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_ */
|
||||
96
modules/dep/mysqllite/include/internal/my_tree.h
Normal file
96
modules/dep/mysqllite/include/internal/my_tree.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/* 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 */
|
||||
|
||||
#ifndef _tree_h
|
||||
#define _tree_h
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "my_base.h" /* get 'enum ha_rkey_function' */
|
||||
#include "my_alloc.h" /* MEM_ROOT */
|
||||
|
||||
/* Worst case tree is half full. This gives use 2^(MAX_TREE_HEIGHT/2) leafs */
|
||||
#define MAX_TREE_HEIGHT 64
|
||||
|
||||
#define ELEMENT_KEY(tree,element)\
|
||||
(tree->offset_to_key ? (void*)((uchar*) element+tree->offset_to_key) :\
|
||||
*((void**) (element+1)))
|
||||
|
||||
#define tree_set_pointer(element,ptr) *((uchar **) (element+1))=((uchar*) (ptr))
|
||||
|
||||
#define TREE_NO_DUPS 1
|
||||
|
||||
typedef enum { left_root_right, right_root_left } TREE_WALK;
|
||||
typedef uint32 element_count;
|
||||
typedef int (*tree_walk_action)(void *,element_count,void *);
|
||||
|
||||
typedef enum { free_init, free_free, free_end } TREE_FREE;
|
||||
typedef void (*tree_element_free)(void*, TREE_FREE, void *);
|
||||
|
||||
typedef struct st_tree_element {
|
||||
struct st_tree_element *left,*right;
|
||||
uint32 count:31,
|
||||
colour:1; /* black is marked as 1 */
|
||||
} TREE_ELEMENT;
|
||||
|
||||
#define ELEMENT_CHILD(element, offs) (*(TREE_ELEMENT**)((char*)element + offs))
|
||||
|
||||
typedef struct st_tree {
|
||||
TREE_ELEMENT *root,null_element;
|
||||
TREE_ELEMENT **parents[MAX_TREE_HEIGHT];
|
||||
uint offset_to_key,elements_in_tree,size_of_element;
|
||||
ulong memory_limit, allocated;
|
||||
qsort_cmp2 compare;
|
||||
void *custom_arg;
|
||||
MEM_ROOT mem_root;
|
||||
my_bool with_delete;
|
||||
tree_element_free free;
|
||||
uint flag;
|
||||
} TREE;
|
||||
|
||||
/* Functions on whole tree */
|
||||
void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit,
|
||||
int size, qsort_cmp2 compare, my_bool with_delete,
|
||||
tree_element_free free_element, void *custom_arg);
|
||||
void delete_tree(TREE*);
|
||||
void reset_tree(TREE*);
|
||||
/* similar to delete tree, except we do not my_free() blocks in mem_root
|
||||
*/
|
||||
#define is_tree_inited(tree) ((tree)->root != 0)
|
||||
|
||||
/* Functions on leafs */
|
||||
TREE_ELEMENT *tree_insert(TREE *tree,void *key, uint key_size,
|
||||
void *custom_arg);
|
||||
void *tree_search(TREE *tree, void *key, void *custom_arg);
|
||||
int tree_walk(TREE *tree,tree_walk_action action,
|
||||
void *argument, TREE_WALK visit);
|
||||
int tree_delete(TREE *tree, void *key, uint key_size, void *custom_arg);
|
||||
void *tree_search_key(TREE *tree, const void *key,
|
||||
TREE_ELEMENT **parents, TREE_ELEMENT ***last_pos,
|
||||
enum ha_rkey_function flag, void *custom_arg);
|
||||
void *tree_search_edge(TREE *tree, TREE_ELEMENT **parents,
|
||||
TREE_ELEMENT ***last_pos, int child_offs);
|
||||
void *tree_search_next(TREE *tree, TREE_ELEMENT ***last_pos, int l_offs,
|
||||
int r_offs);
|
||||
ha_rows tree_record_pos(TREE *tree, const void *key,
|
||||
enum ha_rkey_function search_flag, void *custom_arg);
|
||||
|
||||
#define TREE_ELEMENT_EXTRA_SIZE (sizeof(TREE_ELEMENT) + sizeof(void*))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
1483
modules/dep/mysqllite/include/internal/my_uctype.h
Normal file
1483
modules/dep/mysqllite/include/internal/my_uctype.h
Normal file
File diff suppressed because it is too large
Load Diff
242
modules/dep/mysqllite/include/internal/myisampack.h
Normal file
242
modules/dep/mysqllite/include/internal/myisampack.h
Normal file
@@ -0,0 +1,242 @@
|
||||
#ifndef MYISAMPACK_INCLUDED
|
||||
#define MYISAMPACK_INCLUDED
|
||||
|
||||
/* 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 */
|
||||
|
||||
/*
|
||||
Storing of values in high byte first order.
|
||||
|
||||
integer keys and file pointers are stored with high byte first to get
|
||||
better compression
|
||||
*/
|
||||
|
||||
/* these two are for uniformity */
|
||||
#define mi_sint1korr(A) ((int8)(*A))
|
||||
#define mi_uint1korr(A) ((uint8)(*A))
|
||||
|
||||
#define mi_sint2korr(A) ((int16) (((int16) (((uchar*) (A))[1])) +\
|
||||
((int16) ((int16) ((char*) (A))[0]) << 8)))
|
||||
#define mi_sint3korr(A) ((int32) (((((uchar*) (A))[0]) & 128) ? \
|
||||
(((uint32) 255L << 24) | \
|
||||
(((uint32) ((uchar*) (A))[0]) << 16) |\
|
||||
(((uint32) ((uchar*) (A))[1]) << 8) | \
|
||||
((uint32) ((uchar*) (A))[2])) : \
|
||||
(((uint32) ((uchar*) (A))[0]) << 16) |\
|
||||
(((uint32) ((uchar*) (A))[1]) << 8) | \
|
||||
((uint32) ((uchar*) (A))[2])))
|
||||
#define mi_sint4korr(A) ((int32) (((int32) (((uchar*) (A))[3])) +\
|
||||
((int32) (((uchar*) (A))[2]) << 8) +\
|
||||
((int32) (((uchar*) (A))[1]) << 16) +\
|
||||
((int32) ((int16) ((char*) (A))[0]) << 24)))
|
||||
#define mi_sint8korr(A) ((longlong) mi_uint8korr(A))
|
||||
#define mi_uint2korr(A) ((uint16) (((uint16) (((uchar*) (A))[1])) +\
|
||||
((uint16) (((uchar*) (A))[0]) << 8)))
|
||||
#define mi_uint3korr(A) ((uint32) (((uint32) (((uchar*) (A))[2])) +\
|
||||
(((uint32) (((uchar*) (A))[1])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[0])) << 16)))
|
||||
#define mi_uint4korr(A) ((uint32) (((uint32) (((uchar*) (A))[3])) +\
|
||||
(((uint32) (((uchar*) (A))[2])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[1])) << 16) +\
|
||||
(((uint32) (((uchar*) (A))[0])) << 24)))
|
||||
#define mi_uint5korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[4])) +\
|
||||
(((uint32) (((uchar*) (A))[3])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[2])) << 16) +\
|
||||
(((uint32) (((uchar*) (A))[1])) << 24)) +\
|
||||
(((ulonglong) (((uchar*) (A))[0])) << 32))
|
||||
#define mi_uint6korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[5])) +\
|
||||
(((uint32) (((uchar*) (A))[4])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[3])) << 16) +\
|
||||
(((uint32) (((uchar*) (A))[2])) << 24)) +\
|
||||
(((ulonglong) (((uint32) (((uchar*) (A))[1])) +\
|
||||
(((uint32) (((uchar*) (A))[0]) << 8)))) <<\
|
||||
32))
|
||||
#define mi_uint7korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[6])) +\
|
||||
(((uint32) (((uchar*) (A))[5])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[4])) << 16) +\
|
||||
(((uint32) (((uchar*) (A))[3])) << 24)) +\
|
||||
(((ulonglong) (((uint32) (((uchar*) (A))[2])) +\
|
||||
(((uint32) (((uchar*) (A))[1])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[0])) << 16))) <<\
|
||||
32))
|
||||
#define mi_uint8korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[7])) +\
|
||||
(((uint32) (((uchar*) (A))[6])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[5])) << 16) +\
|
||||
(((uint32) (((uchar*) (A))[4])) << 24)) +\
|
||||
(((ulonglong) (((uint32) (((uchar*) (A))[3])) +\
|
||||
(((uint32) (((uchar*) (A))[2])) << 8) +\
|
||||
(((uint32) (((uchar*) (A))[1])) << 16) +\
|
||||
(((uint32) (((uchar*) (A))[0])) << 24))) <<\
|
||||
32))
|
||||
|
||||
/* This one is for uniformity */
|
||||
#define mi_int1store(T,A) *((uchar*)(T))= (uchar) (A)
|
||||
|
||||
#define mi_int2store(T,A) { uint def_temp= (uint) (A) ;\
|
||||
((uchar*) (T))[1]= (uchar) (def_temp);\
|
||||
((uchar*) (T))[0]= (uchar) (def_temp >> 8); }
|
||||
#define mi_int3store(T,A) { /*lint -save -e734 */\
|
||||
ulong def_temp= (ulong) (A);\
|
||||
((uchar*) (T))[2]= (uchar) (def_temp);\
|
||||
((uchar*) (T))[1]= (uchar) (def_temp >> 8);\
|
||||
((uchar*) (T))[0]= (uchar) (def_temp >> 16);\
|
||||
/*lint -restore */}
|
||||
#define mi_int4store(T,A) { ulong def_temp= (ulong) (A);\
|
||||
((uchar*) (T))[3]= (uchar) (def_temp);\
|
||||
((uchar*) (T))[2]= (uchar) (def_temp >> 8);\
|
||||
((uchar*) (T))[1]= (uchar) (def_temp >> 16);\
|
||||
((uchar*) (T))[0]= (uchar) (def_temp >> 24); }
|
||||
#define mi_int5store(T,A) { ulong def_temp= (ulong) (A),\
|
||||
def_temp2= (ulong) ((A) >> 32);\
|
||||
((uchar*) (T))[4]= (uchar) (def_temp);\
|
||||
((uchar*) (T))[3]= (uchar) (def_temp >> 8);\
|
||||
((uchar*) (T))[2]= (uchar) (def_temp >> 16);\
|
||||
((uchar*) (T))[1]= (uchar) (def_temp >> 24);\
|
||||
((uchar*) (T))[0]= (uchar) (def_temp2); }
|
||||
#define mi_int6store(T,A) { ulong def_temp= (ulong) (A),\
|
||||
def_temp2= (ulong) ((A) >> 32);\
|
||||
((uchar*) (T))[5]= (uchar) (def_temp);\
|
||||
((uchar*) (T))[4]= (uchar) (def_temp >> 8);\
|
||||
((uchar*) (T))[3]= (uchar) (def_temp >> 16);\
|
||||
((uchar*) (T))[2]= (uchar) (def_temp >> 24);\
|
||||
((uchar*) (T))[1]= (uchar) (def_temp2);\
|
||||
((uchar*) (T))[0]= (uchar) (def_temp2 >> 8); }
|
||||
#define mi_int7store(T,A) { ulong def_temp= (ulong) (A),\
|
||||
def_temp2= (ulong) ((A) >> 32);\
|
||||
((uchar*) (T))[6]= (uchar) (def_temp);\
|
||||
((uchar*) (T))[5]= (uchar) (def_temp >> 8);\
|
||||
((uchar*) (T))[4]= (uchar) (def_temp >> 16);\
|
||||
((uchar*) (T))[3]= (uchar) (def_temp >> 24);\
|
||||
((uchar*) (T))[2]= (uchar) (def_temp2);\
|
||||
((uchar*) (T))[1]= (uchar) (def_temp2 >> 8);\
|
||||
((uchar*) (T))[0]= (uchar) (def_temp2 >> 16); }
|
||||
#define mi_int8store(T,A) { ulong def_temp3= (ulong) (A),\
|
||||
def_temp4= (ulong) ((A) >> 32);\
|
||||
mi_int4store((uchar*) (T) + 0, def_temp4);\
|
||||
mi_int4store((uchar*) (T) + 4, def_temp3); }
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
|
||||
#define mi_float4store(T,A) { ((uchar*) (T))[0]= ((uchar*) &A)[0];\
|
||||
((uchar*) (T))[1]= ((uchar*) &A)[1];\
|
||||
((uchar*) (T))[2]= ((uchar*) &A)[2];\
|
||||
((uchar*) (T))[3]= ((uchar*) &A)[3]; }
|
||||
|
||||
#define mi_float4get(V,M) { float def_temp;\
|
||||
((uchar*) &def_temp)[0]= ((uchar*) (M))[0];\
|
||||
((uchar*) &def_temp)[1]= ((uchar*) (M))[1];\
|
||||
((uchar*) &def_temp)[2]= ((uchar*) (M))[2];\
|
||||
((uchar*) &def_temp)[3]= ((uchar*) (M))[3];\
|
||||
(V)= def_temp; }
|
||||
|
||||
#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((uchar*) &V)[0];\
|
||||
((uchar*) (T))[1]= ((uchar*) &V)[1];\
|
||||
((uchar*) (T))[2]= ((uchar*) &V)[2];\
|
||||
((uchar*) (T))[3]= ((uchar*) &V)[3];\
|
||||
((uchar*) (T))[4]= ((uchar*) &V)[4];\
|
||||
((uchar*) (T))[5]= ((uchar*) &V)[5];\
|
||||
((uchar*) (T))[6]= ((uchar*) &V)[6];\
|
||||
((uchar*) (T))[7]= ((uchar*) &V)[7]; }
|
||||
|
||||
#define mi_float8get(V,M) { double def_temp;\
|
||||
((uchar*) &def_temp)[0]= ((uchar*) (M))[0];\
|
||||
((uchar*) &def_temp)[1]= ((uchar*) (M))[1];\
|
||||
((uchar*) &def_temp)[2]= ((uchar*) (M))[2];\
|
||||
((uchar*) &def_temp)[3]= ((uchar*) (M))[3];\
|
||||
((uchar*) &def_temp)[4]= ((uchar*) (M))[4];\
|
||||
((uchar*) &def_temp)[5]= ((uchar*) (M))[5];\
|
||||
((uchar*) &def_temp)[6]= ((uchar*) (M))[6];\
|
||||
((uchar*) &def_temp)[7]= ((uchar*) (M))[7]; \
|
||||
(V)= def_temp; }
|
||||
#else
|
||||
|
||||
#define mi_float4store(T,A) { ((uchar*) (T))[0]= ((uchar*) &A)[3];\
|
||||
((uchar*) (T))[1]= ((uchar*) &A)[2];\
|
||||
((uchar*) (T))[2]= ((uchar*) &A)[1];\
|
||||
((uchar*) (T))[3]= ((uchar*) &A)[0]; }
|
||||
|
||||
#define mi_float4get(V,M) { float def_temp;\
|
||||
((uchar*) &def_temp)[0]= ((uchar*) (M))[3];\
|
||||
((uchar*) &def_temp)[1]= ((uchar*) (M))[2];\
|
||||
((uchar*) &def_temp)[2]= ((uchar*) (M))[1];\
|
||||
((uchar*) &def_temp)[3]= ((uchar*) (M))[0];\
|
||||
(V)= def_temp; }
|
||||
|
||||
#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
|
||||
#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((uchar*) &V)[3];\
|
||||
((uchar*) (T))[1]= ((uchar*) &V)[2];\
|
||||
((uchar*) (T))[2]= ((uchar*) &V)[1];\
|
||||
((uchar*) (T))[3]= ((uchar*) &V)[0];\
|
||||
((uchar*) (T))[4]= ((uchar*) &V)[7];\
|
||||
((uchar*) (T))[5]= ((uchar*) &V)[6];\
|
||||
((uchar*) (T))[6]= ((uchar*) &V)[5];\
|
||||
((uchar*) (T))[7]= ((uchar*) &V)[4];}
|
||||
|
||||
#define mi_float8get(V,M) { double def_temp;\
|
||||
((uchar*) &def_temp)[0]= ((uchar*) (M))[3];\
|
||||
((uchar*) &def_temp)[1]= ((uchar*) (M))[2];\
|
||||
((uchar*) &def_temp)[2]= ((uchar*) (M))[1];\
|
||||
((uchar*) &def_temp)[3]= ((uchar*) (M))[0];\
|
||||
((uchar*) &def_temp)[4]= ((uchar*) (M))[7];\
|
||||
((uchar*) &def_temp)[5]= ((uchar*) (M))[6];\
|
||||
((uchar*) &def_temp)[6]= ((uchar*) (M))[5];\
|
||||
((uchar*) &def_temp)[7]= ((uchar*) (M))[4];\
|
||||
(V)= def_temp; }
|
||||
|
||||
#else
|
||||
#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((uchar*) &V)[7];\
|
||||
((uchar*) (T))[1]= ((uchar*) &V)[6];\
|
||||
((uchar*) (T))[2]= ((uchar*) &V)[5];\
|
||||
((uchar*) (T))[3]= ((uchar*) &V)[4];\
|
||||
((uchar*) (T))[4]= ((uchar*) &V)[3];\
|
||||
((uchar*) (T))[5]= ((uchar*) &V)[2];\
|
||||
((uchar*) (T))[6]= ((uchar*) &V)[1];\
|
||||
((uchar*) (T))[7]= ((uchar*) &V)[0];}
|
||||
|
||||
#define mi_float8get(V,M) { double def_temp;\
|
||||
((uchar*) &def_temp)[0]= ((uchar*) (M))[7];\
|
||||
((uchar*) &def_temp)[1]= ((uchar*) (M))[6];\
|
||||
((uchar*) &def_temp)[2]= ((uchar*) (M))[5];\
|
||||
((uchar*) &def_temp)[3]= ((uchar*) (M))[4];\
|
||||
((uchar*) &def_temp)[4]= ((uchar*) (M))[3];\
|
||||
((uchar*) &def_temp)[5]= ((uchar*) (M))[2];\
|
||||
((uchar*) &def_temp)[6]= ((uchar*) (M))[1];\
|
||||
((uchar*) &def_temp)[7]= ((uchar*) (M))[0];\
|
||||
(V)= def_temp; }
|
||||
#endif /* __FLOAT_WORD_ORDER */
|
||||
#endif /* WORDS_BIGENDIAN */
|
||||
|
||||
/* Fix to avoid warnings when sizeof(ha_rows) == sizeof(long) */
|
||||
|
||||
#ifdef BIG_TABLES
|
||||
#define mi_rowstore(T,A) mi_int8store(T, A)
|
||||
#define mi_rowkorr(T) mi_uint8korr(T)
|
||||
#else
|
||||
#define mi_rowstore(T,A) { mi_int4store(T, 0);\
|
||||
mi_int4store(((uchar*) (T) + 4), A); }
|
||||
#define mi_rowkorr(T) mi_uint4korr((uchar*) (T) + 4)
|
||||
#endif
|
||||
|
||||
#if SIZEOF_OFF_T > 4
|
||||
#define mi_sizestore(T,A) mi_int8store(T, A)
|
||||
#define mi_sizekorr(T) mi_uint8korr(T)
|
||||
#else
|
||||
#define mi_sizestore(T,A) { if ((A) == HA_OFFSET_ERROR)\
|
||||
bfill((char*) (T), 8, 255);\
|
||||
else { mi_int4store((T), 0);\
|
||||
mi_int4store(((T) + 4), A); }}
|
||||
#define mi_sizekorr(T) mi_uint4korr((uchar*) (T) + 4)
|
||||
#endif
|
||||
#endif /* MYISAMPACK_INCLUDED */
|
||||
30
modules/dep/mysqllite/include/internal/mysql_version.h.in
Normal file
30
modules/dep/mysqllite/include/internal/mysql_version.h.in
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Copyright Abandoned 1996, 1999, 2001 MySQL AB
|
||||
This file is public domain and comes with NO WARRANTY of any kind */
|
||||
|
||||
/* Version numbers for protocol & mysqld */
|
||||
|
||||
#ifndef _mysql_version_h
|
||||
#define _mysql_version_h
|
||||
#ifdef _CUSTOMCONFIG_
|
||||
#include <custom_conf.h>
|
||||
#else
|
||||
#define PROTOCOL_VERSION @PROTOCOL_VERSION@
|
||||
#define MYSQL_SERVER_VERSION "@VERSION@"
|
||||
#define MYSQL_BASE_VERSION "mysqld-@MYSQL_BASE_VERSION@"
|
||||
#define MYSQL_SERVER_SUFFIX_DEF "@MYSQL_SERVER_SUFFIX@"
|
||||
#define FRM_VER @DOT_FRM_VERSION@
|
||||
#define MYSQL_VERSION_ID @MYSQL_VERSION_ID@
|
||||
#define MYSQL_PORT @MYSQL_TCP_PORT@
|
||||
#define MYSQL_PORT_DEFAULT @MYSQL_TCP_PORT_DEFAULT@
|
||||
#define MYSQL_UNIX_ADDR "@MYSQL_UNIX_ADDR@"
|
||||
#define MYSQL_CONFIG_NAME "my"
|
||||
#define MYSQL_COMPILATION_COMMENT "@COMPILATION_COMMENT@"
|
||||
|
||||
/* mysqld compile time options */
|
||||
#endif /* _CUSTOMCONFIG_ */
|
||||
|
||||
#ifndef LICENSE
|
||||
#define LICENSE GPL
|
||||
#endif /* LICENSE */
|
||||
|
||||
#endif /* _mysql_version_h */
|
||||
93
modules/dep/mysqllite/include/internal/mysys_err.h
Normal file
93
modules/dep/mysqllite/include/internal/mysys_err.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/* 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 */
|
||||
|
||||
#ifndef _mysys_err_h
|
||||
#define _mysys_err_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GLOBERRS (EE_ERROR_LAST - EE_ERROR_FIRST + 1) /* Nr of global errors */
|
||||
#define EE(X) (globerrs[(X) - EE_ERROR_FIRST])
|
||||
|
||||
extern const char *globerrs[]; /* my_error_messages is here */
|
||||
|
||||
/* Error message numbers in global map */
|
||||
/*
|
||||
Do not add error numbers before EE_ERROR_FIRST.
|
||||
If necessary to add lower numbers, change EE_ERROR_FIRST accordingly.
|
||||
|
||||
We start with error 1 to not confuse peoples with 'error 0'
|
||||
*/
|
||||
|
||||
#define EE_ERROR_FIRST 1 /*Copy first error nr.*/
|
||||
#define EE_CANTCREATEFILE 1
|
||||
#define EE_READ 2
|
||||
#define EE_WRITE 3
|
||||
#define EE_BADCLOSE 4
|
||||
#define EE_OUTOFMEMORY 5
|
||||
#define EE_DELETE 6
|
||||
#define EE_LINK 7
|
||||
#define EE_EOFERR 9
|
||||
#define EE_CANTLOCK 10
|
||||
#define EE_CANTUNLOCK 11
|
||||
#define EE_DIR 12
|
||||
#define EE_STAT 13
|
||||
#define EE_CANT_CHSIZE 14
|
||||
#define EE_CANT_OPEN_STREAM 15
|
||||
#define EE_GETWD 16
|
||||
#define EE_SETWD 17
|
||||
#define EE_LINK_WARNING 18
|
||||
#define EE_OPEN_WARNING 19
|
||||
#define EE_DISK_FULL 20
|
||||
#define EE_CANT_MKDIR 21
|
||||
#define EE_UNKNOWN_CHARSET 22
|
||||
#define EE_OUT_OF_FILERESOURCES 23
|
||||
#define EE_CANT_READLINK 24
|
||||
#define EE_CANT_SYMLINK 25
|
||||
#define EE_REALPATH 26
|
||||
#define EE_SYNC 27
|
||||
#define EE_UNKNOWN_COLLATION 28
|
||||
#define EE_FILENOTFOUND 29
|
||||
#define EE_FILE_NOT_CLOSED 30
|
||||
#define EE_CHANGE_OWNERSHIP 31
|
||||
#define EE_CHANGE_PERMISSIONS 32
|
||||
#define EE_CANT_SEEK 33
|
||||
#define EE_ERROR_LAST 33 /* Copy last error nr */
|
||||
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
|
||||
|
||||
/* exit codes for all MySQL programs */
|
||||
|
||||
#define EXIT_UNSPECIFIED_ERROR 1
|
||||
#define EXIT_UNKNOWN_OPTION 2
|
||||
#define EXIT_AMBIGUOUS_OPTION 3
|
||||
#define EXIT_NO_ARGUMENT_ALLOWED 4
|
||||
#define EXIT_ARGUMENT_REQUIRED 5
|
||||
#define EXIT_VAR_PREFIX_NOT_UNIQUE 6
|
||||
#define EXIT_UNKNOWN_VARIABLE 7
|
||||
#define EXIT_OUT_OF_MEMORY 8
|
||||
#define EXIT_UNKNOWN_SUFFIX 9
|
||||
#define EXIT_NO_PTR_TO_VARIABLE 10
|
||||
#define EXIT_CANNOT_CONNECT_TO_SERVICE 11
|
||||
#define EXIT_OPTION_DISABLED 12
|
||||
#define EXIT_ARGUMENT_INVALID 13
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
32
modules/dep/mysqllite/include/internal/password.h
Normal file
32
modules/dep/mysqllite/include/internal/password.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Copyright 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
#ifndef PASSWORD_INCLUDED
|
||||
#define PASSWORD_INCLUDED
|
||||
|
||||
#include "my_global.h"
|
||||
|
||||
C_MODE_START
|
||||
|
||||
void my_make_scrambled_password_323(char *to, const char *password,
|
||||
size_t pass_len);
|
||||
void my_make_scrambled_password(char *to, const char *password,
|
||||
size_t pass_len);
|
||||
|
||||
void hash_password(ulong *result, const char *password, uint password_len);
|
||||
|
||||
C_MODE_END
|
||||
|
||||
#endif /* PASSWORD_INCLUDED */
|
||||
13
modules/dep/mysqllite/include/internal/probes_mysql.h
Normal file
13
modules/dep/mysqllite/include/internal/probes_mysql.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef PROBES_MYSQL_H
|
||||
|
||||
#define PROBES_MYSQL_H
|
||||
|
||||
#include <my_global.h>
|
||||
|
||||
#if defined(HAVE_DTRACE) && !defined(DISABLE_DTRACE)
|
||||
#include "probes_mysql_dtrace.h"
|
||||
#else
|
||||
#include "probes_mysql_nodtrace.h"
|
||||
#endif
|
||||
|
||||
#endif /* PROBES_MYSQL_H */
|
||||
129
modules/dep/mysqllite/include/internal/probes_mysql_nodtrace.h
Normal file
129
modules/dep/mysqllite/include/internal/probes_mysql_nodtrace.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Generated by dheadgen(1).
|
||||
*/
|
||||
|
||||
#ifndef _PROBES_MYSQL_D
|
||||
#define _PROBES_MYSQL_D
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MYSQL_CONNECTION_START(arg0, arg1, arg2)
|
||||
#define MYSQL_CONNECTION_START_ENABLED() (0)
|
||||
#define MYSQL_CONNECTION_DONE(arg0, arg1)
|
||||
#define MYSQL_CONNECTION_DONE_ENABLED() (0)
|
||||
#define MYSQL_COMMAND_START(arg0, arg1, arg2, arg3)
|
||||
#define MYSQL_COMMAND_START_ENABLED() (0)
|
||||
#define MYSQL_COMMAND_DONE(arg0)
|
||||
#define MYSQL_COMMAND_DONE_ENABLED() (0)
|
||||
#define MYSQL_QUERY_START(arg0, arg1, arg2, arg3, arg4)
|
||||
#define MYSQL_QUERY_START_ENABLED() (0)
|
||||
#define MYSQL_QUERY_DONE(arg0)
|
||||
#define MYSQL_QUERY_DONE_ENABLED() (0)
|
||||
#define MYSQL_QUERY_PARSE_START(arg0)
|
||||
#define MYSQL_QUERY_PARSE_START_ENABLED() (0)
|
||||
#define MYSQL_QUERY_PARSE_DONE(arg0)
|
||||
#define MYSQL_QUERY_PARSE_DONE_ENABLED() (0)
|
||||
#define MYSQL_QUERY_CACHE_HIT(arg0, arg1)
|
||||
#define MYSQL_QUERY_CACHE_HIT_ENABLED() (0)
|
||||
#define MYSQL_QUERY_CACHE_MISS(arg0)
|
||||
#define MYSQL_QUERY_CACHE_MISS_ENABLED() (0)
|
||||
#define MYSQL_QUERY_EXEC_START(arg0, arg1, arg2, arg3, arg4, arg5)
|
||||
#define MYSQL_QUERY_EXEC_START_ENABLED() (0)
|
||||
#define MYSQL_QUERY_EXEC_DONE(arg0)
|
||||
#define MYSQL_QUERY_EXEC_DONE_ENABLED() (0)
|
||||
#define MYSQL_INSERT_ROW_START(arg0, arg1)
|
||||
#define MYSQL_INSERT_ROW_START_ENABLED() (0)
|
||||
#define MYSQL_INSERT_ROW_DONE(arg0)
|
||||
#define MYSQL_INSERT_ROW_DONE_ENABLED() (0)
|
||||
#define MYSQL_UPDATE_ROW_START(arg0, arg1)
|
||||
#define MYSQL_UPDATE_ROW_START_ENABLED() (0)
|
||||
#define MYSQL_UPDATE_ROW_DONE(arg0)
|
||||
#define MYSQL_UPDATE_ROW_DONE_ENABLED() (0)
|
||||
#define MYSQL_DELETE_ROW_START(arg0, arg1)
|
||||
#define MYSQL_DELETE_ROW_START_ENABLED() (0)
|
||||
#define MYSQL_DELETE_ROW_DONE(arg0)
|
||||
#define MYSQL_DELETE_ROW_DONE_ENABLED() (0)
|
||||
#define MYSQL_READ_ROW_START(arg0, arg1, arg2)
|
||||
#define MYSQL_READ_ROW_START_ENABLED() (0)
|
||||
#define MYSQL_READ_ROW_DONE(arg0)
|
||||
#define MYSQL_READ_ROW_DONE_ENABLED() (0)
|
||||
#define MYSQL_INDEX_READ_ROW_START(arg0, arg1)
|
||||
#define MYSQL_INDEX_READ_ROW_START_ENABLED() (0)
|
||||
#define MYSQL_INDEX_READ_ROW_DONE(arg0)
|
||||
#define MYSQL_INDEX_READ_ROW_DONE_ENABLED() (0)
|
||||
#define MYSQL_HANDLER_RDLOCK_START(arg0, arg1)
|
||||
#define MYSQL_HANDLER_RDLOCK_START_ENABLED() (0)
|
||||
#define MYSQL_HANDLER_WRLOCK_START(arg0, arg1)
|
||||
#define MYSQL_HANDLER_WRLOCK_START_ENABLED() (0)
|
||||
#define MYSQL_HANDLER_UNLOCK_START(arg0, arg1)
|
||||
#define MYSQL_HANDLER_UNLOCK_START_ENABLED() (0)
|
||||
#define MYSQL_HANDLER_RDLOCK_DONE(arg0)
|
||||
#define MYSQL_HANDLER_RDLOCK_DONE_ENABLED() (0)
|
||||
#define MYSQL_HANDLER_WRLOCK_DONE(arg0)
|
||||
#define MYSQL_HANDLER_WRLOCK_DONE_ENABLED() (0)
|
||||
#define MYSQL_HANDLER_UNLOCK_DONE(arg0)
|
||||
#define MYSQL_HANDLER_UNLOCK_DONE_ENABLED() (0)
|
||||
#define MYSQL_FILESORT_START(arg0, arg1)
|
||||
#define MYSQL_FILESORT_START_ENABLED() (0)
|
||||
#define MYSQL_FILESORT_DONE(arg0, arg1)
|
||||
#define MYSQL_FILESORT_DONE_ENABLED() (0)
|
||||
#define MYSQL_SELECT_START(arg0)
|
||||
#define MYSQL_SELECT_START_ENABLED() (0)
|
||||
#define MYSQL_SELECT_DONE(arg0, arg1)
|
||||
#define MYSQL_SELECT_DONE_ENABLED() (0)
|
||||
#define MYSQL_INSERT_START(arg0)
|
||||
#define MYSQL_INSERT_START_ENABLED() (0)
|
||||
#define MYSQL_INSERT_DONE(arg0, arg1)
|
||||
#define MYSQL_INSERT_DONE_ENABLED() (0)
|
||||
#define MYSQL_INSERT_SELECT_START(arg0)
|
||||
#define MYSQL_INSERT_SELECT_START_ENABLED() (0)
|
||||
#define MYSQL_INSERT_SELECT_DONE(arg0, arg1)
|
||||
#define MYSQL_INSERT_SELECT_DONE_ENABLED() (0)
|
||||
#define MYSQL_UPDATE_START(arg0)
|
||||
#define MYSQL_UPDATE_START_ENABLED() (0)
|
||||
#define MYSQL_UPDATE_DONE(arg0, arg1, arg2)
|
||||
#define MYSQL_UPDATE_DONE_ENABLED() (0)
|
||||
#define MYSQL_MULTI_UPDATE_START(arg0)
|
||||
#define MYSQL_MULTI_UPDATE_START_ENABLED() (0)
|
||||
#define MYSQL_MULTI_UPDATE_DONE(arg0, arg1, arg2)
|
||||
#define MYSQL_MULTI_UPDATE_DONE_ENABLED() (0)
|
||||
#define MYSQL_DELETE_START(arg0)
|
||||
#define MYSQL_DELETE_START_ENABLED() (0)
|
||||
#define MYSQL_DELETE_DONE(arg0, arg1)
|
||||
#define MYSQL_DELETE_DONE_ENABLED() (0)
|
||||
#define MYSQL_MULTI_DELETE_START(arg0)
|
||||
#define MYSQL_MULTI_DELETE_START_ENABLED() (0)
|
||||
#define MYSQL_MULTI_DELETE_DONE(arg0, arg1)
|
||||
#define MYSQL_MULTI_DELETE_DONE_ENABLED() (0)
|
||||
#define MYSQL_NET_READ_START()
|
||||
#define MYSQL_NET_READ_START_ENABLED() (0)
|
||||
#define MYSQL_NET_READ_DONE(arg0, arg1)
|
||||
#define MYSQL_NET_READ_DONE_ENABLED() (0)
|
||||
#define MYSQL_NET_WRITE_START(arg0)
|
||||
#define MYSQL_NET_WRITE_START_ENABLED() (0)
|
||||
#define MYSQL_NET_WRITE_DONE(arg0)
|
||||
#define MYSQL_NET_WRITE_DONE_ENABLED() (0)
|
||||
#define MYSQL_KEYCACHE_READ_START(arg0, arg1, arg2, arg3)
|
||||
#define MYSQL_KEYCACHE_READ_START_ENABLED() (0)
|
||||
#define MYSQL_KEYCACHE_READ_BLOCK(arg0)
|
||||
#define MYSQL_KEYCACHE_READ_BLOCK_ENABLED() (0)
|
||||
#define MYSQL_KEYCACHE_READ_HIT()
|
||||
#define MYSQL_KEYCACHE_READ_HIT_ENABLED() (0)
|
||||
#define MYSQL_KEYCACHE_READ_MISS()
|
||||
#define MYSQL_KEYCACHE_READ_MISS_ENABLED() (0)
|
||||
#define MYSQL_KEYCACHE_READ_DONE(arg0, arg1)
|
||||
#define MYSQL_KEYCACHE_READ_DONE_ENABLED() (0)
|
||||
#define MYSQL_KEYCACHE_WRITE_START(arg0, arg1, arg2, arg3)
|
||||
#define MYSQL_KEYCACHE_WRITE_START_ENABLED() (0)
|
||||
#define MYSQL_KEYCACHE_WRITE_BLOCK(arg0)
|
||||
#define MYSQL_KEYCACHE_WRITE_BLOCK_ENABLED() (0)
|
||||
#define MYSQL_KEYCACHE_WRITE_DONE(arg0, arg1)
|
||||
#define MYSQL_KEYCACHE_WRITE_DONE_ENABLED() (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _PROBES_MYSQL_D */
|
||||
75
modules/dep/mysqllite/include/internal/queues.h
Normal file
75
modules/dep/mysqllite/include/internal/queues.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* 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 */
|
||||
|
||||
/*
|
||||
Code for generell handling of priority Queues.
|
||||
Implemention of queues from "Algoritms in C" by Robert Sedgewick.
|
||||
Copyright Monty Program KB.
|
||||
By monty.
|
||||
*/
|
||||
|
||||
#ifndef _queues_h
|
||||
#define _queues_h
|
||||
|
||||
#include "my_global.h" /* uchar */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct st_queue {
|
||||
uchar **root;
|
||||
void *first_cmp_arg;
|
||||
uint elements;
|
||||
uint max_elements;
|
||||
uint offset_to_key; /* compare is done on element+offset */
|
||||
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)
|
||||
#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,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)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
46
modules/dep/mysqllite/include/internal/rijndael.h
Normal file
46
modules/dep/mysqllite/include/internal/rijndael.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef RIJNDAEL_INCLUDED
|
||||
#define RIJNDAEL_INCLUDED
|
||||
|
||||
/* Copyright (C) 2002 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 */
|
||||
|
||||
|
||||
/*
|
||||
rijndael-alg-fst.h
|
||||
|
||||
@version 3.0 (December 2000)
|
||||
Optimised ANSI C code for the Rijndael cipher (now AES)
|
||||
@author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
|
||||
@author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
|
||||
@author Paulo Barreto <paulo.barreto@terra.com.br>
|
||||
|
||||
This code is hereby placed in the public domain.
|
||||
Modified by Peter Zaitsev to fit MySQL coding style.
|
||||
*/
|
||||
|
||||
#define AES_MAXKC (256/32)
|
||||
#define AES_MAXKB (256/8)
|
||||
#define AES_MAXNR 14
|
||||
|
||||
int rijndaelKeySetupEnc(uint32 rk[/*4*(Nr + 1)*/], const uint8 cipherKey[],
|
||||
int keyBits);
|
||||
int rijndaelKeySetupDec(uint32 rk[/*4*(Nr + 1)*/], const uint8 cipherKey[],
|
||||
int keyBits);
|
||||
void rijndaelEncrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr,
|
||||
const uint8 pt[16], uint8 ct[16]);
|
||||
void rijndaelDecrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr,
|
||||
const uint8 ct[16], uint8 pt[16]);
|
||||
|
||||
#endif /* RIJNDAEL_INCLUDED */
|
||||
104
modules/dep/mysqllite/include/internal/sha1.h
Normal file
104
modules/dep/mysqllite/include/internal/sha1.h
Normal file
@@ -0,0 +1,104 @@
|
||||
#ifndef SHA1_INCLUDED
|
||||
#define SHA1_INCLUDED
|
||||
|
||||
/* Copyright (C) 2002, 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
This is the header file for code which implements the Secure
|
||||
Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
|
||||
April 17, 1995.
|
||||
|
||||
Many of the variable names in this code, especially the
|
||||
single character names, were used because those were the names
|
||||
used in the publication.
|
||||
|
||||
Please read the file sha1.c for more information.
|
||||
|
||||
Modified 2002 by Peter Zaitsev to better follow MySQL standards
|
||||
|
||||
Original Source from: http://www.faqs.org/rfcs/rfc3174.html
|
||||
|
||||
Copyright (C) The Internet Society (2001). All Rights Reserved.
|
||||
|
||||
This document and translations of it may be copied and furnished to
|
||||
others, and derivative works that comment on or otherwise explain it
|
||||
or assist in its implementation may be prepared, copied, published
|
||||
and distributed, in whole or in part, without restriction of any
|
||||
kind, provided that the above copyright notice and this paragraph are
|
||||
included on all such copies and derivative works. However, this
|
||||
document itself may not be modified in any way, such as by removing
|
||||
the copyright notice or references to the Internet Society or other
|
||||
Internet organizations, except as needed for the purpose of
|
||||
developing Internet standards in which case the procedures for
|
||||
copyrights defined in the Internet Standards process must be
|
||||
followed, or as required to translate it into languages other than
|
||||
English.
|
||||
|
||||
The limited permissions granted above are perpetual and will not be
|
||||
revoked by the Internet Society or its successors or assigns.
|
||||
|
||||
This document and the information contained herein is provided on an
|
||||
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
|
||||
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
|
||||
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Acknowledgement
|
||||
Funding for the RFC Editor function is currently provided by the
|
||||
Internet Society.
|
||||
*/
|
||||
|
||||
|
||||
enum sha_result_codes
|
||||
{
|
||||
SHA_SUCCESS = 0,
|
||||
SHA_NULL, /* Null pointer parameter */
|
||||
SHA_INPUT_TOO_LONG, /* input data too long */
|
||||
SHA_STATE_ERROR /* called Input after Result */
|
||||
};
|
||||
|
||||
#define SHA1_HASH_SIZE 20 /* Hash size in bytes */
|
||||
|
||||
/*
|
||||
This structure will hold context information for the SHA-1
|
||||
hashing operation
|
||||
*/
|
||||
|
||||
typedef struct SHA1_CONTEXT
|
||||
{
|
||||
ulonglong Length; /* Message length in bits */
|
||||
uint32 Intermediate_Hash[SHA1_HASH_SIZE/4]; /* Message Digest */
|
||||
int Computed; /* Is the digest computed? */
|
||||
int Corrupted; /* Is the message digest corrupted? */
|
||||
int16 Message_Block_Index; /* Index into message block array */
|
||||
uint8 Message_Block[64]; /* 512-bit message blocks */
|
||||
} SHA1_CONTEXT;
|
||||
|
||||
/*
|
||||
Function Prototypes
|
||||
*/
|
||||
|
||||
C_MODE_START
|
||||
|
||||
int mysql_sha1_reset(SHA1_CONTEXT*);
|
||||
int mysql_sha1_input(SHA1_CONTEXT*, const uint8 *, unsigned int);
|
||||
int mysql_sha1_result(SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE]);
|
||||
|
||||
C_MODE_END
|
||||
|
||||
#endif /* SHA__INCLUDED */
|
||||
254
modules/dep/mysqllite/include/internal/t_ctype.h
Normal file
254
modules/dep/mysqllite/include/internal/t_ctype.h
Normal file
@@ -0,0 +1,254 @@
|
||||
/* 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 */
|
||||
|
||||
/*
|
||||
Copyright (C) 1998, 1999 by Pruet Boonma, all rights reserved.
|
||||
Copyright (C) 1998 by Theppitak Karoonboonyanan, all rights reserved.
|
||||
Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee,
|
||||
provided that the above copyright notice appear in all copies.
|
||||
Smaphan Raruenrom and Pruet Boonma makes no representations about
|
||||
the suitability of this software for any purpose. It is provided
|
||||
"as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
/* LC_COLLATE category + Level information */
|
||||
|
||||
#ifndef _t_ctype_h
|
||||
#define _t_ctype_h
|
||||
|
||||
#define TOT_LEVELS 5
|
||||
#define LAST_LEVEL 4 /* TOT_LEVELS - 1 */
|
||||
|
||||
#define IGNORE 0
|
||||
|
||||
|
||||
/* level 1 symbols & order */
|
||||
enum l1_symbols {
|
||||
L1_08 = TOT_LEVELS,
|
||||
L1_18,
|
||||
L1_28,
|
||||
L1_38,
|
||||
L1_48,
|
||||
L1_58,
|
||||
L1_68,
|
||||
L1_78,
|
||||
L1_88,
|
||||
L1_98,
|
||||
L1_A8,
|
||||
L1_B8,
|
||||
L1_C8,
|
||||
L1_D8,
|
||||
L1_E8,
|
||||
L1_F8,
|
||||
L1_G8,
|
||||
L1_H8,
|
||||
L1_I8,
|
||||
L1_J8,
|
||||
L1_K8,
|
||||
L1_L8,
|
||||
L1_M8,
|
||||
L1_N8,
|
||||
L1_O8,
|
||||
L1_P8,
|
||||
L1_Q8,
|
||||
L1_R8,
|
||||
L1_S8,
|
||||
L1_T8,
|
||||
L1_U8,
|
||||
L1_V8,
|
||||
L1_W8,
|
||||
L1_X8,
|
||||
L1_Y8,
|
||||
L1_Z8,
|
||||
L1_KO_KAI,
|
||||
L1_KHO_KHAI,
|
||||
L1_KHO_KHUAT,
|
||||
L1_KHO_KHWAI,
|
||||
L1_KHO_KHON,
|
||||
L1_KHO_RAKHANG,
|
||||
L1_NGO_NGU,
|
||||
L1_CHO_CHAN,
|
||||
L1_CHO_CHING,
|
||||
L1_CHO_CHANG,
|
||||
L1_SO_SO,
|
||||
L1_CHO_CHOE,
|
||||
L1_YO_YING,
|
||||
L1_DO_CHADA,
|
||||
L1_TO_PATAK,
|
||||
L1_THO_THAN,
|
||||
L1_THO_NANGMONTHO,
|
||||
L1_THO_PHUTHAO,
|
||||
L1_NO_NEN,
|
||||
L1_DO_DEK,
|
||||
L1_TO_TAO,
|
||||
L1_THO_THUNG,
|
||||
L1_THO_THAHAN,
|
||||
L1_THO_THONG,
|
||||
L1_NO_NU,
|
||||
L1_BO_BAIMAI,
|
||||
L1_PO_PLA,
|
||||
L1_PHO_PHUNG,
|
||||
L1_FO_FA,
|
||||
L1_PHO_PHAN,
|
||||
L1_FO_FAN,
|
||||
L1_PHO_SAMPHAO,
|
||||
L1_MO_MA,
|
||||
L1_YO_YAK,
|
||||
L1_RO_RUA,
|
||||
L1_RU,
|
||||
L1_LO_LING,
|
||||
L1_LU,
|
||||
L1_WO_WAEN,
|
||||
L1_SO_SALA,
|
||||
L1_SO_RUSI,
|
||||
L1_SO_SUA,
|
||||
L1_HO_HIP,
|
||||
L1_LO_CHULA,
|
||||
L1_O_ANG,
|
||||
L1_HO_NOKHUK,
|
||||
L1_NKHIT,
|
||||
L1_SARA_A,
|
||||
L1_MAI_HAN_AKAT,
|
||||
L1_SARA_AA,
|
||||
L1_SARA_AM,
|
||||
L1_SARA_I,
|
||||
L1_SARA_II,
|
||||
L1_SARA_UE,
|
||||
L1_SARA_UEE,
|
||||
L1_SARA_U,
|
||||
L1_SARA_UU,
|
||||
L1_SARA_E,
|
||||
L1_SARA_AE,
|
||||
L1_SARA_O,
|
||||
L1_SARA_AI_MAIMUAN,
|
||||
L1_SARA_AI_MAIMALAI
|
||||
};
|
||||
|
||||
/* level 2 symbols & order */
|
||||
enum l2_symbols {
|
||||
L2_BLANK = TOT_LEVELS,
|
||||
L2_THAII,
|
||||
L2_YAMAK,
|
||||
L2_PINTHU,
|
||||
L2_GARAN,
|
||||
L2_TYKHU,
|
||||
L2_TONE1,
|
||||
L2_TONE2,
|
||||
L2_TONE3,
|
||||
L2_TONE4
|
||||
};
|
||||
|
||||
/* level 3 symbols & order */
|
||||
enum l3_symbols {
|
||||
L3_BLANK = TOT_LEVELS,
|
||||
L3_SPACE,
|
||||
L3_NB_SACE,
|
||||
L3_LOW_LINE,
|
||||
L3_HYPHEN,
|
||||
L3_COMMA,
|
||||
L3_SEMICOLON,
|
||||
L3_COLON,
|
||||
L3_EXCLAMATION,
|
||||
L3_QUESTION,
|
||||
L3_SOLIDUS,
|
||||
L3_FULL_STOP,
|
||||
L3_PAIYAN_NOI,
|
||||
L3_MAI_YAMOK,
|
||||
L3_GRAVE,
|
||||
L3_CIRCUMFLEX,
|
||||
L3_TILDE,
|
||||
L3_APOSTROPHE,
|
||||
L3_QUOTATION,
|
||||
L3_L_PARANTHESIS,
|
||||
L3_L_BRACKET,
|
||||
L3_L_BRACE,
|
||||
L3_R_BRACE,
|
||||
L3_R_BRACKET,
|
||||
L3_R_PARENTHESIS,
|
||||
L3_AT,
|
||||
L3_BAHT,
|
||||
L3_DOLLAR,
|
||||
L3_FONGMAN,
|
||||
L3_ANGKHANKHU,
|
||||
L3_KHOMUT,
|
||||
L3_ASTERISK,
|
||||
L3_BK_SOLIDUS,
|
||||
L3_AMPERSAND,
|
||||
L3_NUMBER,
|
||||
L3_PERCENT,
|
||||
L3_PLUS,
|
||||
L3_LESS_THAN,
|
||||
L3_EQUAL,
|
||||
L3_GREATER_THAN,
|
||||
L3_V_LINE
|
||||
};
|
||||
|
||||
/* level 4 symbols & order */
|
||||
enum l4_symbols {
|
||||
L4_BLANK = TOT_LEVELS,
|
||||
L4_MIN,
|
||||
L4_CAP,
|
||||
L4_EXT
|
||||
};
|
||||
|
||||
enum level_symbols {
|
||||
L_UPRUPR = TOT_LEVELS,
|
||||
L_UPPER,
|
||||
L_MIDDLE,
|
||||
L_LOWER
|
||||
};
|
||||
|
||||
#define _is(c) (t_ctype[(c)][LAST_LEVEL])
|
||||
#define _level 8
|
||||
#define _consnt 16
|
||||
#define _ldvowel 32
|
||||
#define _fllwvowel 64
|
||||
#define _uprvowel 128
|
||||
#define _lwrvowel 256
|
||||
#define _tone 512
|
||||
#define _diacrt1 1024
|
||||
#define _diacrt2 2048
|
||||
#define _combine 4096
|
||||
#define _stone 8192
|
||||
#define _tdig 16384
|
||||
#define _rearvowel (_fllwvowel | _uprvowel | _lwrvowel)
|
||||
#define _diacrt (_diacrt1 | _diacrt2)
|
||||
#define levelof(c) ( _is(c) & _level )
|
||||
#define isthai(c) ( (c) >= 128 )
|
||||
#define istalpha(c) ( _is(c) & (_consnt|_ldvowel|_rearvowel|\
|
||||
_tone|_diacrt1|_diacrt2) )
|
||||
#define isconsnt(c) ( _is(c) & _consnt )
|
||||
#define isldvowel(c) ( _is(c) & _ldvowel )
|
||||
#define isfllwvowel(c) ( _is(c) & _fllwvowel )
|
||||
#define ismidvowel(c) ( _is(c) & (_ldvowel|_fllwvowel) )
|
||||
#define isuprvowel(c) ( _is(c) & _uprvowel )
|
||||
#define islwrvowel(c) ( _is(c) & _lwrvowel )
|
||||
#define isuprlwrvowel(c) ( _is(c) & (_lwrvowel | _uprvowel))
|
||||
#define isrearvowel(c) ( _is(c) & _rearvowel )
|
||||
#define isvowel(c) ( _is(c) & (_ldvowel|_rearvowel) )
|
||||
#define istone(c) ( _is(c) & _tone )
|
||||
#define isunldable(c) ( _is(c) & (_rearvowel|_tone|_diacrt1|_diacrt2) )
|
||||
#define iscombinable(c) ( _is(c) & _combine )
|
||||
#define istdigit(c) ( _is(c) & _tdig )
|
||||
#define isstone(c) ( _is(c) & _stone )
|
||||
#define isdiacrt1(c) ( _is(c) & _diacrt1)
|
||||
#define isdiacrt2(c) ( _is(c) & _diacrt2)
|
||||
#define isdiacrt(c) ( _is(c) & _diacrt)
|
||||
|
||||
/* Function prototype called by sql/field.cc */
|
||||
void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length);
|
||||
|
||||
#endif
|
||||
110
modules/dep/mysqllite/include/internal/thr_alarm.h
Normal file
110
modules/dep/mysqllite/include/internal/thr_alarm.h
Normal file
@@ -0,0 +1,110 @@
|
||||
/* 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 */
|
||||
|
||||
/* Prototypes when using thr_alarm library functions */
|
||||
|
||||
#ifndef _thr_alarm_h
|
||||
#define _thr_alarm_h
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef USE_ALARM_THREAD
|
||||
#define USE_ONE_SIGNAL_HAND /* One must call process_alarm */
|
||||
#endif
|
||||
#ifdef HAVE_rts_threads
|
||||
#undef USE_ONE_SIGNAL_HAND
|
||||
#define USE_ALARM_THREAD
|
||||
#define THR_SERVER_ALARM SIGUSR1
|
||||
#else
|
||||
#define THR_SERVER_ALARM SIGALRM
|
||||
#endif
|
||||
|
||||
typedef struct st_alarm_info
|
||||
{
|
||||
ulong next_alarm_time;
|
||||
uint active_alarms;
|
||||
uint max_used_alarms;
|
||||
} ALARM_INFO;
|
||||
|
||||
void thr_alarm_info(ALARM_INFO *info);
|
||||
|
||||
#if defined(DONT_USE_THR_ALARM)
|
||||
|
||||
#define USE_ALARM_THREAD
|
||||
#undef USE_ONE_SIGNAL_HAND
|
||||
|
||||
typedef my_bool thr_alarm_t;
|
||||
typedef my_bool ALARM;
|
||||
|
||||
#define thr_alarm_init(A) (*(A))=0
|
||||
#define thr_alarm_in_use(A) (*(A) != 0)
|
||||
#define thr_end_alarm(A)
|
||||
#define thr_alarm(A,B,C) ((*(A)=1)-1)
|
||||
/* The following should maybe be (*(A)) */
|
||||
#define thr_got_alarm(A) 0
|
||||
#define init_thr_alarm(A)
|
||||
#define thr_alarm_kill(A)
|
||||
#define resize_thr_alarm(N)
|
||||
#define end_thr_alarm(A)
|
||||
|
||||
#else
|
||||
#if defined(__WIN__)
|
||||
typedef struct st_thr_alarm_entry
|
||||
{
|
||||
UINT_PTR crono;
|
||||
} thr_alarm_entry;
|
||||
|
||||
#else /* System with posix threads */
|
||||
|
||||
typedef int thr_alarm_entry;
|
||||
|
||||
#define thr_got_alarm(thr_alarm) (**(thr_alarm))
|
||||
|
||||
#endif /* __WIN__ */
|
||||
|
||||
typedef thr_alarm_entry* thr_alarm_t;
|
||||
|
||||
typedef struct st_alarm {
|
||||
ulong expire_time;
|
||||
thr_alarm_entry alarmed; /* set when alarm is due */
|
||||
pthread_t thread;
|
||||
my_thread_id thread_id;
|
||||
my_bool malloced;
|
||||
} ALARM;
|
||||
|
||||
extern uint thr_client_alarm;
|
||||
extern pthread_t alarm_thread;
|
||||
|
||||
#define thr_alarm_init(A) (*(A))=0
|
||||
#define thr_alarm_in_use(A) (*(A)!= 0)
|
||||
void init_thr_alarm(uint max_alarm);
|
||||
void resize_thr_alarm(uint max_alarms);
|
||||
my_bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
|
||||
void thr_alarm_kill(my_thread_id thread_id);
|
||||
void thr_end_alarm(thr_alarm_t *alarmed);
|
||||
void end_thr_alarm(my_bool free_structures);
|
||||
sig_handler process_alarm(int);
|
||||
#ifndef thr_got_alarm
|
||||
my_bool thr_got_alarm(thr_alarm_t *alrm);
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* DONT_USE_THR_ALARM */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* _thr_alarm_h */
|
||||
163
modules/dep/mysqllite/include/internal/thr_lock.h
Normal file
163
modules/dep/mysqllite/include/internal/thr_lock.h
Normal file
@@ -0,0 +1,163 @@
|
||||
/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/* For use with thr_lock:s */
|
||||
|
||||
#ifndef _thr_lock_h
|
||||
#define _thr_lock_h
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <my_pthread.h>
|
||||
#include <my_list.h>
|
||||
|
||||
struct st_thr_lock;
|
||||
extern ulong locks_immediate,locks_waited ;
|
||||
|
||||
/*
|
||||
Important: if a new lock type is added, a matching lock description
|
||||
must be added to sql_test.cc's lock_descriptions array.
|
||||
*/
|
||||
enum thr_lock_type { TL_IGNORE=-1,
|
||||
TL_UNLOCK, /* UNLOCK ANY LOCK */
|
||||
/*
|
||||
Parser only! At open_tables() becomes TL_READ or
|
||||
TL_READ_NO_INSERT depending on the binary log format
|
||||
(SBR/RBR) and on the table category (log table).
|
||||
Used for tables that are read by statements which
|
||||
modify tables.
|
||||
*/
|
||||
TL_READ_DEFAULT,
|
||||
TL_READ, /* Read lock */
|
||||
TL_READ_WITH_SHARED_LOCKS,
|
||||
/* High prior. than TL_WRITE. Allow concurrent insert */
|
||||
TL_READ_HIGH_PRIORITY,
|
||||
/* READ, Don't allow concurrent insert */
|
||||
TL_READ_NO_INSERT,
|
||||
/*
|
||||
Write lock, but allow other threads to read / write.
|
||||
Used by BDB tables in MySQL to mark that someone is
|
||||
reading/writing to the table.
|
||||
*/
|
||||
TL_WRITE_ALLOW_WRITE,
|
||||
/*
|
||||
WRITE lock used by concurrent insert. Will allow
|
||||
READ, if one could use concurrent insert on table.
|
||||
*/
|
||||
TL_WRITE_CONCURRENT_INSERT,
|
||||
/* Write used by INSERT DELAYED. Allows READ locks */
|
||||
TL_WRITE_DELAYED,
|
||||
/*
|
||||
parser only! Late bound low_priority flag.
|
||||
At open_tables() becomes thd->update_lock_default.
|
||||
*/
|
||||
TL_WRITE_DEFAULT,
|
||||
/* WRITE lock that has lower priority than TL_READ */
|
||||
TL_WRITE_LOW_PRIORITY,
|
||||
/* Normal WRITE lock */
|
||||
TL_WRITE,
|
||||
/* Abort new lock request with an error */
|
||||
TL_WRITE_ONLY};
|
||||
|
||||
enum enum_thr_lock_result { THR_LOCK_SUCCESS= 0, THR_LOCK_ABORTED= 1,
|
||||
THR_LOCK_WAIT_TIMEOUT= 2, THR_LOCK_DEADLOCK= 3 };
|
||||
|
||||
|
||||
extern ulong max_write_lock_count;
|
||||
extern my_bool thr_lock_inited;
|
||||
extern enum thr_lock_type thr_upgraded_concurrent_insert_lock;
|
||||
|
||||
/*
|
||||
A description of the thread which owns the lock. The address
|
||||
of an instance of this structure is used to uniquely identify the thread.
|
||||
*/
|
||||
|
||||
typedef struct st_thr_lock_info
|
||||
{
|
||||
pthread_t thread;
|
||||
my_thread_id thread_id;
|
||||
} THR_LOCK_INFO;
|
||||
|
||||
|
||||
typedef struct st_thr_lock_data {
|
||||
THR_LOCK_INFO *owner;
|
||||
struct st_thr_lock_data *next,**prev;
|
||||
struct st_thr_lock *lock;
|
||||
mysql_cond_t *cond;
|
||||
enum thr_lock_type type;
|
||||
void *status_param; /* Param to status functions */
|
||||
void *debug_print_param;
|
||||
struct PSI_table *m_psi;
|
||||
} THR_LOCK_DATA;
|
||||
|
||||
struct st_lock_list {
|
||||
THR_LOCK_DATA *data,**last;
|
||||
};
|
||||
|
||||
typedef struct st_thr_lock {
|
||||
LIST list;
|
||||
mysql_mutex_t mutex;
|
||||
struct st_lock_list read_wait;
|
||||
struct st_lock_list read;
|
||||
struct st_lock_list write_wait;
|
||||
struct st_lock_list write;
|
||||
/* write_lock_count is incremented for write locks and reset on read locks */
|
||||
ulong write_lock_count;
|
||||
uint read_no_write_count;
|
||||
void (*get_status)(void*, int); /* When one gets a lock */
|
||||
void (*copy_status)(void*,void*);
|
||||
void (*update_status)(void*); /* Before release of write */
|
||||
void (*restore_status)(void*); /* Before release of read */
|
||||
my_bool (*check_status)(void *);
|
||||
} THR_LOCK;
|
||||
|
||||
|
||||
extern LIST *thr_lock_thread_list;
|
||||
extern mysql_mutex_t THR_LOCK_lock;
|
||||
|
||||
my_bool init_thr_lock(void); /* Must be called once/thread */
|
||||
void thr_lock_info_init(THR_LOCK_INFO *info);
|
||||
void thr_lock_init(THR_LOCK *lock);
|
||||
void thr_lock_delete(THR_LOCK *lock);
|
||||
void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data,
|
||||
void *status_param);
|
||||
enum enum_thr_lock_result thr_lock(THR_LOCK_DATA *data,
|
||||
THR_LOCK_INFO *owner,
|
||||
enum thr_lock_type lock_type,
|
||||
ulong lock_wait_timeout);
|
||||
void thr_unlock(THR_LOCK_DATA *data);
|
||||
enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data,
|
||||
uint count, THR_LOCK_INFO *owner,
|
||||
ulong lock_wait_timeout);
|
||||
void thr_multi_unlock(THR_LOCK_DATA **data,uint count);
|
||||
void
|
||||
thr_lock_merge_status(THR_LOCK_DATA **data, uint count);
|
||||
void thr_abort_locks(THR_LOCK *lock, my_bool upgrade_lock);
|
||||
my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread);
|
||||
void thr_print_locks(void); /* For debugging */
|
||||
my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data,
|
||||
enum thr_lock_type new_lock_type,
|
||||
ulong lock_wait_timeout);
|
||||
void thr_downgrade_write_lock(THR_LOCK_DATA *data,
|
||||
enum thr_lock_type new_lock_type);
|
||||
my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data,
|
||||
ulong lock_wait_timeout);
|
||||
void thr_set_lock_wait_callback(void (*before_wait)(void),
|
||||
void (*after_wait)(void));
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _thr_lock_h */
|
||||
241
modules/dep/mysqllite/include/internal/violite.h
Normal file
241
modules/dep/mysqllite/include/internal/violite.h
Normal file
@@ -0,0 +1,241 @@
|
||||
/* 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 */
|
||||
|
||||
/*
|
||||
* Vio Lite.
|
||||
* Purpose: include file for Vio that will work with C and C++
|
||||
*/
|
||||
|
||||
#ifndef vio_violite_h_
|
||||
#define vio_violite_h_
|
||||
|
||||
#include "my_net.h" /* needed because of struct in_addr */
|
||||
|
||||
|
||||
/* Simple vio interface in C; The functions are implemented in violite.c */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef struct st_vio Vio;
|
||||
#endif /* __cplusplus */
|
||||
|
||||
enum enum_vio_type
|
||||
{
|
||||
VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, VIO_TYPE_NAMEDPIPE,
|
||||
VIO_TYPE_SSL, VIO_TYPE_SHARED_MEMORY
|
||||
};
|
||||
|
||||
|
||||
#define VIO_LOCALHOST 1 /* a localhost connection */
|
||||
#define VIO_BUFFERED_READ 2 /* use buffered read */
|
||||
#define VIO_READ_BUFFER_SIZE 16384 /* size of read buffer */
|
||||
|
||||
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(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);
|
||||
#else
|
||||
#define HANDLE void *
|
||||
#endif /* __WIN__ */
|
||||
|
||||
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);
|
||||
size_t vio_read(Vio *vio, uchar * buf, size_t size);
|
||||
size_t vio_read_buff(Vio *vio, uchar * buf, size_t size);
|
||||
size_t vio_write(Vio *vio, const uchar * buf, size_t size);
|
||||
int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode);
|
||||
my_bool vio_is_blocking(Vio *vio);
|
||||
/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */
|
||||
int vio_fastsend(Vio *vio);
|
||||
/* setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible */
|
||||
int vio_keepalive(Vio *vio, my_bool onoff);
|
||||
/* Whenever we should retry the last read/write operation. */
|
||||
my_bool vio_should_retry(Vio *vio);
|
||||
/* Check that operation was timed out */
|
||||
my_bool vio_was_interrupted(Vio *vio);
|
||||
/* Short text description of the socket for those, who are curious.. */
|
||||
const char* vio_description(Vio *vio);
|
||||
/* Return the type of the connection */
|
||||
enum enum_vio_type vio_type(Vio* vio);
|
||||
/* Return last error number */
|
||||
int vio_errno(Vio*vio);
|
||||
/* Get socket number */
|
||||
my_socket vio_fd(Vio*vio);
|
||||
/* Remote peer's address and name in text form */
|
||||
my_bool vio_peer_addr(Vio *vio, char *buf, uint16 *port, size_t buflen);
|
||||
my_bool vio_poll_read(Vio *vio, uint timeout);
|
||||
my_bool vio_is_connected(Vio *vio);
|
||||
ssize_t vio_pending(Vio *vio);
|
||||
|
||||
my_bool vio_get_normalized_ip_string(const struct sockaddr *addr, int addr_length,
|
||||
char *ip_string, size_t ip_string_size);
|
||||
|
||||
int vio_getnameinfo(const struct sockaddr *sa,
|
||||
char *hostname, size_t hostname_size,
|
||||
char *port, size_t port_size,
|
||||
int flags);
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
#include <openssl/opensslv.h>
|
||||
#if OPENSSL_VERSION_NUMBER < 0x0090700f
|
||||
#define DES_cblock des_cblock
|
||||
#define DES_key_schedule des_key_schedule
|
||||
#define DES_set_key_unchecked(k,ks) des_set_key_unchecked((k),*(ks))
|
||||
#define DES_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e) des_ede3_cbc_encrypt((i),(o),(l),*(k1),*(k2),*(k3),(iv),(e))
|
||||
#endif
|
||||
|
||||
#define HEADER_DES_LOCL_H dummy_something
|
||||
#define YASSL_MYSQL_COMPATIBLE
|
||||
#ifndef YASSL_PREFIX
|
||||
#define YASSL_PREFIX
|
||||
#endif
|
||||
/* Set yaSSL to use same type as MySQL do for socket handles */
|
||||
typedef my_socket YASSL_SOCKET_T;
|
||||
#define YASSL_SOCKET_T_DEFINED
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
enum enum_ssl_init_error
|
||||
{
|
||||
SSL_INITERR_NOERROR= 0, SSL_INITERR_CERT, SSL_INITERR_KEY,
|
||||
SSL_INITERR_NOMATCH, SSL_INITERR_BAD_PATHS, SSL_INITERR_CIPHERS,
|
||||
SSL_INITERR_MEMFAIL, SSL_INITERR_LASTERR
|
||||
};
|
||||
const char* sslGetErrString(enum enum_ssl_init_error err);
|
||||
|
||||
struct st_VioSSLFd
|
||||
{
|
||||
SSL_CTX *ssl_context;
|
||||
};
|
||||
|
||||
int sslaccept(struct st_VioSSLFd*, Vio *, long timeout);
|
||||
int sslconnect(struct st_VioSSLFd*, Vio *, long timeout);
|
||||
|
||||
struct st_VioSSLFd
|
||||
*new_VioSSLConnectorFd(const char *key_file, const char *cert_file,
|
||||
const char *ca_file, const char *ca_path,
|
||||
const char *cipher);
|
||||
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 /* ! EMBEDDED_LIBRARY */
|
||||
#endif /* HAVE_OPENSSL */
|
||||
|
||||
void vio_end(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(DONT_MAP_VIO)
|
||||
#define vio_delete(vio) (vio)->viodelete(vio)
|
||||
#define vio_errno(vio) (vio)->vioerrno(vio)
|
||||
#define vio_read(vio, buf, size) ((vio)->read)(vio,buf,size)
|
||||
#define vio_write(vio, buf, size) ((vio)->write)(vio, buf, size)
|
||||
#define vio_blocking(vio, set_blocking_mode, old_mode)\
|
||||
(vio)->vioblocking(vio, set_blocking_mode, old_mode)
|
||||
#define vio_is_blocking(vio) (vio)->is_blocking(vio)
|
||||
#define vio_fastsend(vio) (vio)->fastsend(vio)
|
||||
#define vio_keepalive(vio, set_keep_alive) (vio)->viokeepalive(vio, set_keep_alive)
|
||||
#define vio_should_retry(vio) (vio)->should_retry(vio)
|
||||
#define vio_was_interrupted(vio) (vio)->was_interrupted(vio)
|
||||
#define vio_close(vio) ((vio)->vioclose)(vio)
|
||||
#define vio_peer_addr(vio, buf, prt, buflen) (vio)->peer_addr(vio, buf, prt, buflen)
|
||||
#define vio_timeout(vio, which, seconds) (vio)->timeout(vio, which, seconds)
|
||||
#define vio_poll_read(vio, timeout) (vio)->poll_read(vio, timeout)
|
||||
#define vio_is_connected(vio) (vio)->is_connected(vio)
|
||||
#endif /* !defined(DONT_MAP_VIO) */
|
||||
|
||||
/* This enumerator is used in parser - should be always visible */
|
||||
enum SSL_type
|
||||
{
|
||||
SSL_TYPE_NOT_SPECIFIED= -1,
|
||||
SSL_TYPE_NONE,
|
||||
SSL_TYPE_ANY,
|
||||
SSL_TYPE_X509,
|
||||
SSL_TYPE_SPECIFIED
|
||||
};
|
||||
|
||||
|
||||
/* HFTODO - hide this if we don't want client in embedded server */
|
||||
/* This structure is for every connection on both sides */
|
||||
struct st_vio
|
||||
{
|
||||
my_socket sd; /* my_socket - real or imaginary */
|
||||
HANDLE hPipe;
|
||||
my_bool localhost; /* Are we from localhost? */
|
||||
int fcntl_mode; /* Buffered fcntl(sd,F_GETFL) */
|
||||
struct sockaddr_storage local; /* Local internet address */
|
||||
struct sockaddr_storage remote; /* Remote internet address */
|
||||
int addrLen; /* Length of remote address */
|
||||
enum enum_vio_type type; /* Type of connection */
|
||||
char desc[30]; /* String description */
|
||||
char *read_buffer; /* buffer for vio_read_buff */
|
||||
char *read_pos; /* start of unfetched data in the
|
||||
read buffer */
|
||||
char *read_end; /* end of unfetched data */
|
||||
/* function pointers. They are similar for socket/SSL/whatever */
|
||||
void (*viodelete)(Vio*);
|
||||
int (*vioerrno)(Vio*);
|
||||
size_t (*read)(Vio*, uchar *, size_t);
|
||||
size_t (*write)(Vio*, const uchar *, size_t);
|
||||
int (*vioblocking)(Vio*, my_bool, my_bool *);
|
||||
my_bool (*is_blocking)(Vio*);
|
||||
int (*viokeepalive)(Vio*, my_bool);
|
||||
int (*fastsend)(Vio*);
|
||||
my_bool (*peer_addr)(Vio*, char *, uint16*, size_t);
|
||||
void (*in_addr)(Vio*, struct sockaddr_storage*);
|
||||
my_bool (*should_retry)(Vio*);
|
||||
my_bool (*was_interrupted)(Vio*);
|
||||
int (*vioclose)(Vio*);
|
||||
void (*timeout)(Vio*, unsigned int which, unsigned int timeout);
|
||||
my_bool (*poll_read)(Vio *vio, uint timeout);
|
||||
my_bool (*is_connected)(Vio*);
|
||||
my_bool (*has_data) (Vio*);
|
||||
#ifdef HAVE_OPENSSL
|
||||
void *ssl_arg;
|
||||
#endif
|
||||
#ifdef HAVE_SMEM
|
||||
HANDLE handle_file_map;
|
||||
char *handle_map;
|
||||
HANDLE event_server_wrote;
|
||||
HANDLE event_server_read;
|
||||
HANDLE event_client_wrote;
|
||||
HANDLE event_client_read;
|
||||
HANDLE event_conn_closed;
|
||||
size_t shared_memory_remain;
|
||||
char *shared_memory_pos;
|
||||
#endif /* HAVE_SMEM */
|
||||
#ifdef _WIN32
|
||||
OVERLAPPED pipe_overlapped;
|
||||
DWORD read_timeout_ms;
|
||||
DWORD write_timeout_ms;
|
||||
#endif
|
||||
};
|
||||
#endif /* vio_violite_h_ */
|
||||
Reference in New Issue
Block a user