⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 my_global.h

📁 vc连接mysql的封装类
💻 H
📖 第 1 页 / 共 3 页
字号:
#define swap_variables(t, a, b) { register t dummy; dummy= a; a= b; b= dummy; }#define test(a)		((a) ? 1 : 0)#define set_if_bigger(a,b)  do { if ((a) < (b)) (a)=(b); } while(0)#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)#define test_all_bits(a,b) (((a) & (b)) == (b))#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))#ifndef HAVE_RINT#define rint(A) floor((A)+(((A) < 0)? -0.5 : 0.5))#endif/* Define some general constants */#ifndef TRUE#define TRUE		(1)	/* Logical true */#define FALSE		(0)	/* Logical false */#endif#if defined(__GNUC__)#define function_volatile	volatile#define my_reinterpret_cast(A) reinterpret_cast<A>#define my_const_cast(A) const_cast<A>#elif !defined(my_reinterpret_cast)#define my_reinterpret_cast(A) (A)#define my_const_cast(A) (A)#endif#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__)  || __GNUC__ == 2 && __GNUC_MINOR__ < 8)#define __attribute__(A)#endif/*  Wen using the embedded library, users might run into link problems,  dupicate declaration of __cxa_pure_virtual, solved by declaring it a  weak symbol.*/#ifdef USE_MYSYS_NEWC_MODE_STARTint __cxa_pure_virtual () __attribute__ ((weak));C_MODE_END#endif/* From old s-system.h *//*  Support macros for non ansi & other old compilers. Since such  things are no longer supported we do nothing. We keep then since  some of our code may still be needed to upgrade old customers.*/#define _VARARGS(X) X#define _STATIC_VARARGS(X) X#define _PC(X)	X#if defined(DBUG_ON) && defined(DBUG_OFF)#undef DBUG_OFF#endif#if defined(_lint) && !defined(DBUG_OFF)#define DBUG_OFF#endif#include <my_dbug.h>#define MIN_ARRAY_SIZE	0	/* Zero or One. Gcc allows zero*/#define ASCII_BITS_USED 8	/* Bit char used */#define NEAR_F			/* No near function handling *//* Some types that is different between systems */typedef int	File;		/* File descriptor */#ifndef Socket_definedtypedef int	my_socket;	/* File descriptor for sockets */#define INVALID_SOCKET -1#endif/* Type for fuctions that handles signals */#define sig_handler RETSIGTYPEC_MODE_STARTtypedef void	(*sig_return)();/* Returns type from signal */C_MODE_END#if defined(__GNUC__) && !defined(_lint)typedef char	pchar;		/* Mixed prototypes can take char */typedef char	puchar;		/* Mixed prototypes can take char */typedef char	pbool;		/* Mixed prototypes can take char */typedef short	pshort;		/* Mixed prototypes can take short int */typedef float	pfloat;		/* Mixed prototypes can take float */#elsetypedef int	pchar;		/* Mixed prototypes can't take char */typedef uint	puchar;		/* Mixed prototypes can't take char */typedef int	pbool;		/* Mixed prototypes can't take char */typedef int	pshort;		/* Mixed prototypes can't take short int */typedef double	pfloat;		/* Mixed prototypes can't take float */#endifC_MODE_STARTtypedef int	(*qsort_cmp)(const void *,const void *);typedef int	(*qsort_cmp2)(void*, const void *,const void *);C_MODE_END#ifdef HAVE_mit_thread#define qsort_t void#undef QSORT_TYPE_IS_VOID#define QSORT_TYPE_IS_VOID#else#define qsort_t RETQSORTTYPE	/* Broken GCC cant handle typedef !!!! */#endif#ifdef HAVE_mit_thread#define size_socket socklen_t	/* Type of last arg to accept */#else#ifdef HAVE_SYS_SOCKET_H#include <sys/socket.h>#endiftypedef SOCKET_SIZE_TYPE size_socket;#endif#ifndef SOCKOPT_OPTLEN_TYPE#define SOCKOPT_OPTLEN_TYPE size_socket#endif/* file create flags */#ifndef O_SHARE			/* Probably not windows */#define O_SHARE		0	/* Flag to my_open for shared files */#ifndef O_BINARY#define O_BINARY	0	/* Flag to my_open for binary files */#endif#ifndef FILE_BINARY#define FILE_BINARY	O_BINARY /* Flag to my_fopen for binary streams */#endif#ifdef HAVE_FCNTL#define HAVE_FCNTL_LOCK#define F_TO_EOF	0L	/* Param to lockf() to lock rest of file */#endif#endif /* O_SHARE */#ifndef O_TEMPORARY#define O_TEMPORARY	0#endif#ifndef O_SHORT_LIVED#define O_SHORT_LIVED	0#endif#ifndef O_NOFOLLOW#define O_NOFOLLOW      0#endif/* additional file share flags for win32 */#ifdef __WIN__#define _SH_DENYRWD     0x110    /* deny read/write mode & delete */#define _SH_DENYWRD     0x120    /* deny write mode & delete      */#define _SH_DENYRDD     0x130    /* deny read mode & delete       */#define _SH_DENYDEL     0x140    /* deny delete only              */#endif /* __WIN__ *//* #define USE_RECORD_LOCK	*/	/* Unsigned types supported by the compiler */#define UNSINT8			/* unsigned int8 (char) */#define UNSINT16		/* unsigned int16 */#define UNSINT32		/* unsigned int32 */	/* General constants */#define SC_MAXWIDTH	256	/* Max width of screen (for error messages) */#define FN_LEN		256	/* Max file name len */#define FN_HEADLEN	253	/* Max length of filepart of file name */#define FN_EXTLEN	20	/* Max length of extension (part of FN_LEN) */#define FN_REFLEN	512	/* Max length of full path-name */#define FN_EXTCHAR	'.'#define FN_HOMELIB	'~'	/* ~/ is used as abbrev for home dir */#define FN_CURLIB	'.'	/* ./ is used as abbrev for current dir */#define FN_PARENTDIR	".."	/* Parent directory; Must be a string */#define FN_DEVCHAR	':'#ifndef FN_LIBCHAR#ifdef __EMX__#define FN_LIBCHAR	'\\'#define FN_ROOTDIR	"\\"#else#define FN_LIBCHAR	'/'#define FN_ROOTDIR	"/"#endif#endif#define MY_NFILE	64	/* This is only used to save filenames */#ifndef OS_FILE_LIMIT#define OS_FILE_LIMIT	65535#endif/* #define EXT_IN_LIBNAME     *//* #define FN_NO_CASE_SENCE   *//* #define FN_UPPER_CASE TRUE *//*  Io buffer size; Must be a power of 2 and a multiple of 512. May be  smaller what the disk page size. This influences the speed of the  isam btree library. eg to big to slow.*/#define IO_SIZE			4096/*  How much overhead does malloc have. The code often allocates  something like 1024-MALLOC_OVERHEAD bytes*/#ifdef SAFEMALLOC#define MALLOC_OVERHEAD (8+24+4)#else#define MALLOC_OVERHEAD 8#endif	/* get memory in huncs */#define ONCE_ALLOC_INIT		(uint) (4096-MALLOC_OVERHEAD)	/* Typical record cash */#define RECORD_CACHE_SIZE	(uint) (64*1024-MALLOC_OVERHEAD)	/* Typical key cash */#define KEY_CACHE_SIZE		(uint) (8*1024*1024-MALLOC_OVERHEAD)	/* Default size of a key cache block  */#define KEY_CACHE_BLOCK_SIZE	(uint) 1024	/* Some things that this system doesn't have */#define NO_HASH			/* Not needed anymore */#ifdef __WIN__#define NO_DIR_LIBRARY		/* Not standar dir-library */#define USE_MY_STAT_STRUCT	/* For my_lib */#endif/* Some defines of functions for portability */#undef remove		/* Crashes MySQL on SCO 5.0.0 */#ifndef __WIN__#ifdef OS2#define closesocket(A)	soclose(A)#else#define closesocket(A)	close(A)#endif#ifndef ulonglong2double#define ulonglong2double(A) ((double) (ulonglong) (A))#define my_off_t2double(A)  ((double) (my_off_t) (A))#endif#endif#ifndef offsetof#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)#endif#define ulong_to_double(X) ((double) (ulong) (X))#define SET_STACK_SIZE(X)	/* Not needed on real machines */#if !defined(HAVE_mit_thread) && !defined(HAVE_STRTOK_R)#define strtok_r(A,B,C) strtok((A),(B))#endif/* Remove some things that mit_thread break or doesn't support */#if defined(HAVE_mit_thread) && defined(THREAD)#undef HAVE_PREAD#undef HAVE_REALPATH#undef HAVE_MLOCK#undef HAVE_TEMPNAM				/* Use ours */#undef HAVE_PTHREAD_SETPRIO#undef HAVE_FTRUNCATE#undef HAVE_READLINK#endif/* This is from the old m-machine.h file */#if SIZEOF_LONG_LONG > 4#define HAVE_LONG_LONG 1#endif/*  Some pre-ANSI-C99 systems like AIX 5.1 and Linux/GCC 2.95 define  ULONGLONG_MAX, LONGLONG_MIN, LONGLONG_MAX; we use them if they're defined.  Also on Windows we define these constants by hand in config-win.h.*/#if defined(HAVE_LONG_LONG) && !defined(LONGLONG_MIN)#define LONGLONG_MIN	((long long) 0x8000000000000000LL)#define LONGLONG_MAX	((long long) 0x7FFFFFFFFFFFFFFFLL)#endif#if defined(HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)/* First check for ANSI C99 definition: */#ifdef ULLONG_MAX#define ULONGLONG_MAX  ULLONG_MAX#else#define ULONGLONG_MAX ((unsigned long long)(~0ULL))#endif#endif /* defined (HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)*/#define INT_MIN32       (~0x7FFFFFFFL)#define INT_MAX32       0x7FFFFFFFL#define UINT_MAX32      0xFFFFFFFFL#define INT_MIN24       (~0x007FFFFF)#define INT_MAX24       0x007FFFFF#define UINT_MAX24      0x00FFFFFF#define INT_MIN16       (~0x7FFF)#define INT_MAX16       0x7FFF#define UINT_MAX16      0xFFFF#define INT_MIN8        (~0x7F)#define INT_MAX8        0x7F#define UINT_MAX8       0xFF/* From limits.h instead */#ifndef DBL_MIN#define DBL_MIN		4.94065645841246544e-324#define FLT_MIN		((float)1.40129846432481707e-45)#endif#ifndef DBL_MAX#define DBL_MAX		1.79769313486231470e+308#define FLT_MAX		((float)3.40282346638528860e+38)#endif#if !defined(HAVE_ISINF) && !defined(isinf)#define isinf(X)    0#endif/* Define missing math constants. */#ifndef M_PI#define M_PI 3.14159265358979323846#endif#ifndef M_E#define M_E 2.7182818284590452354#endif#ifndef M_LN2#define M_LN2 0.69314718055994530942#endif/*  Max size that must be added to a so that we know Size to make  adressable obj.*/#if SIZEOF_CHARP == 4typedef long		my_ptrdiff_t;#elsetypedef long long	my_ptrdiff_t;#endif#define MY_ALIGN(A,L)	(((A) + (L) - 1) & ~((L) - 1))#define ALIGN_SIZE(A)	MY_ALIGN((A),sizeof(double))/* Size to make adressable obj. */#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t)))			 /* Offset of field f in structure t */#define OFFSET(t, f)	((size_t)(char *)&((t *)0)->f)#define ADD_TO_PTR(ptr,size,type) (type) ((byte*) (ptr)+size)#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((byte*) (A) - (byte*) (B))#define NullS		(char *) 0/* Nowdays we do not support MessyDos */#ifndef NEAR#define NEAR				/* Who needs segments ? */#define FAR				/* On a good machine */#ifndef HUGE_PTR#define HUGE_PTR#endif#endif#if defined(__IBMC__) || defined(__IBMCPP__)/* This was  _System _Export but caused a lot of warnings on _AIX43 */#define STDCALL#elif !defined( STDCALL)#define STDCALL#endif/* Typdefs for easyier portability */#if defined(VOIDTYPE)typedef void	*gptr;		/* Generic pointer */#elsetypedef char	*gptr;		/* Generic pointer */#endif#ifndef HAVE_INT_8_16_32typedef signed char int8;       /* Signed integer >= 8  bits */typedef short	int16;		/* Signed integer >= 16 bits */#endif#ifndef HAVE_UCHARtypedef unsigned char	uchar;	/* Short for unsigned char */#endiftypedef unsigned char	uint8;	/* Short for unsigned integer >= 8  bits */typedef unsigned short	uint16; /* Short for unsigned integer >= 16 bits */#if SIZEOF_INT == 4#ifndef HAVE_INT_8_16_32typedef int		int32;#endiftypedef unsigned int	uint32; /* Short for unsigned integer >= 32 bits */#elif SIZEOF_LONG == 4#ifndef HAVE_INT_8_16_32typedef long		int32;#endiftypedef unsigned long	uint32; /* Short for unsigned integer >= 32 bits */#else#error "Neither int or long is of 4 bytes width"#endif#if !defined(HAVE_ULONG) && !defined(TARGET_OS_LINUX) && !defined(__USE_MISC)typedef unsigned long	ulong;		  /* Short for unsigned long */#endif#ifndef longlong_defined#if defined(HAVE_LONG_LONG) && SIZEOF_LONG != 8typedef unsigned long long int ulonglong; /* ulong or unsigned long long */typedef long long int	longlong;#elsetypedef unsigned long	ulonglong;	  /* ulong or unsigned long long */typedef long		longlong;#endif#endif#if defined(NO_CLIENT_LONG_LONG)typedef unsigned long my_ulonglong;#elif defined (__WIN__)typedef unsigned __int64 my_ulonglong;#elsetypedef unsigned long long my_ulonglong;#endif#ifdef USE_RAID/*  The following is done with a if to not get problems with pre-processors  with late define evaluation*/#if SIZEOF_OFF_T == 4#define SYSTEM_SIZEOF_OFF_T 4#else#define SYSTEM_SIZEOF_OFF_T 8#endif#undef  SIZEOF_OFF_T#define SIZEOF_OFF_T	    8#else#define SYSTEM_SIZEOF_OFF_T SIZEOF_OFF_T#endif /* USE_RAID */#if SIZEOF_OFF_T > 4typedef ulonglong my_off_t;#elsetypedef unsigned long my_off_t;#endif#define MY_FILEPOS_ERROR	(~(my_off_t) 0)#if !defined(__WIN__) && !defined(OS2)typedef off_t os_off_t;#endif#if defined(__WIN__)#define socket_errno	WSAGetLastError()#define SOCKET_EINTR	WSAEINTR

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -