home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 March (DVD) / PCWorld_2008-03_DVD.iso / komunikace / mysql / mysql-essential-5.0.45-win32.msi / product.cab / fili320 < prev    next >
Encoding:
Text File  |  2007-07-06  |  12.9 KB  |  460 lines

  1. /* Copyright (C) 2000 MySQL AB
  2.  
  3.    This program is free software; you can redistribute it and/or modify
  4.    it under the terms of the GNU General Public License as published by
  5.    the Free Software Foundation; version 2 of the License.
  6.  
  7.    This program is distributed in the hope that it will be useful,
  8.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  9.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10.    GNU General Public License for more details.
  11.  
  12.    You should have received a copy of the GNU General Public License
  13.    along with this program; if not, write to the Free Software
  14.    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
  15.  
  16. /* Defines for Win32 to make it compatible for MySQL */
  17.  
  18. #ifdef __WIN2000__
  19. /* We have to do this define before including windows.h to get the AWE API
  20. functions */
  21. #define _WIN32_WINNT     0x0500
  22. #endif
  23.  
  24. #if defined(_MSC_VER) && _MSC_VER >= 1400
  25. /* Avoid endless warnings about sprintf() etc. being unsafe. */
  26. #define _CRT_SECURE_NO_DEPRECATE 1
  27. #endif
  28.  
  29. #include <sys/locking.h>
  30. #include <windows.h>
  31. #include <math.h>            /* Because of rint() */
  32. #include <fcntl.h>
  33. #include <io.h>
  34. #include <malloc.h>
  35.  
  36. #define HAVE_SMEM 1
  37.  
  38. #if defined(_WIN64) || defined(WIN64) 
  39. #define SYSTEM_TYPE    "Win64" 
  40. #elif defined(_WIN32) || defined(WIN32) 
  41. #define SYSTEM_TYPE    "Win32" 
  42. #else
  43. #define SYSTEM_TYPE    "Windows"
  44. #endif
  45.  
  46. #if defined(_M_IA64) 
  47. #define MACHINE_TYPE    "ia64" 
  48. #elif defined(_M_IX86) 
  49. #define MACHINE_TYPE    "ia32" 
  50. #elif defined(_M_ALPHA) 
  51. #define MACHINE_TYPE    "axp" 
  52. #else
  53. #define MACHINE_TYPE    "unknown"    /* Define to machine type name */
  54. #endif 
  55.  
  56. #if !(defined(_WIN64) || defined(WIN64)) 
  57. #ifndef _WIN32
  58. #define _WIN32                /* Compatible with old source */
  59. #endif
  60. #ifndef __WIN32__
  61. #define __WIN32__
  62. #endif
  63. #endif /* _WIN64 */
  64. #ifndef __WIN__
  65. #define __WIN__                  /* To make it easier in VC++ */
  66. #endif
  67.  
  68. #ifndef MAX_INDEXES
  69. #define MAX_INDEXES 64
  70. #endif
  71.  
  72. /* File and lock constants */
  73. #define O_SHARE        0x1000        /* Open file in sharing mode */
  74. #ifdef __BORLANDC__
  75. #define F_RDLCK        LK_NBLCK    /* read lock */
  76. #define F_WRLCK        LK_NBRLCK    /* write lock */
  77. #define F_UNLCK        LK_UNLCK    /* remove lock(s) */
  78. #else
  79. #define F_RDLCK        _LK_NBLCK    /* read lock */
  80. #define F_WRLCK        _LK_NBRLCK    /* write lock */
  81. #define F_UNLCK        _LK_UNLCK    /* remove lock(s) */
  82. #endif
  83.  
  84. #define F_EXCLUSIVE    1        /* We have only exclusive locking */
  85. #define F_TO_EOF    (INT_MAX32/2)    /* size for lock of all file */
  86. #define F_OK        0        /* parameter to access() */
  87. #define W_OK        2
  88.  
  89. #define S_IROTH        S_IREAD        /* for my_lib */
  90.  
  91. #ifdef __BORLANDC__
  92. #define FILE_BINARY    O_BINARY    /* my_fopen in binary mode */
  93. #define O_TEMPORARY    0
  94. #define O_SHORT_LIVED    0
  95. #define SH_DENYNO    _SH_DENYNO
  96. #else
  97. #define O_BINARY    _O_BINARY    /* compability with MSDOS */
  98. #define FILE_BINARY    _O_BINARY    /* my_fopen in binary mode */
  99. #define O_TEMPORARY    _O_TEMPORARY
  100. #define O_SHORT_LIVED    _O_SHORT_LIVED
  101. #define SH_DENYNO    _SH_DENYNO
  102. #endif
  103. #define NO_OPEN_3            /* For my_create() */
  104.  
  105. #define SIGQUIT        SIGTERM        /* No SIGQUIT */
  106.  
  107. #undef _REENTRANT            /* Crashes something for win32 */
  108. #undef SAFE_MUTEX            /* Can't be used on windows */
  109.  
  110. #if defined(_MSC_VER) && _MSC_VER >= 1310
  111. #define LL(A)           A##ll
  112. #define ULL(A)          A##ull
  113. #else
  114. #define LL(A)           ((__int64) A)
  115. #define ULL(A)          ((unsigned __int64) A)
  116. #endif
  117.  
  118. #define LONGLONG_MIN    LL(0x8000000000000000)
  119. #define LONGLONG_MAX    LL(0x7FFFFFFFFFFFFFFF)
  120. #define ULONGLONG_MAX    ULL(0xFFFFFFFFFFFFFFFF)
  121.  
  122. /* Type information */
  123.  
  124. #if defined(__EMX__) || !defined(HAVE_UINT)
  125. #undef HAVE_UINT
  126. #define HAVE_UINT
  127. typedef unsigned short    ushort;
  128. typedef unsigned int    uint;
  129. #endif /* defined(__EMX__) || !defined(HAVE_UINT) */
  130.  
  131. typedef unsigned __int64 ulonglong;    /* Microsofts 64 bit types */
  132. typedef __int64 longlong;
  133. #ifndef HAVE_SIGSET_T
  134. typedef int sigset_t;
  135. #endif
  136. #define longlong_defined
  137. /*
  138.   off_t should not be __int64 because of conflicts in header files;
  139.   Use my_off_t or os_off_t instead
  140. */
  141. #ifndef HAVE_OFF_T
  142. typedef long off_t;
  143. #endif
  144. typedef __int64 os_off_t;
  145. #ifdef _WIN64
  146. typedef UINT_PTR rf_SetTimer;
  147. #else
  148. #ifndef HAVE_SIZE_T
  149. typedef unsigned int size_t;
  150. #endif
  151. typedef uint rf_SetTimer;
  152. #endif
  153.  
  154. #define Socket_defined
  155. #define my_socket SOCKET
  156. #define bool BOOL
  157. #define SIGPIPE SIGINT
  158. #define RETQSORTTYPE void
  159. #define QSORT_TYPE_IS_VOID
  160. #define RETSIGTYPE void
  161. #define SOCKET_SIZE_TYPE int
  162. #define my_socket_defined
  163. #define bool_defined
  164. #define byte_defined
  165. #define HUGE_PTR
  166. #define STDCALL __stdcall        /* Used by libmysql.dll */
  167. #define isnan(X) _isnan(X)
  168. #define finite(X) _finite(X)
  169.  
  170. #ifndef UNDEF_THREAD_HACK
  171. #define THREAD
  172. #endif
  173. #define VOID_SIGHANDLER
  174. #define SIZEOF_CHAR        1
  175. #define SIZEOF_LONG        4
  176. #define SIZEOF_LONG_LONG    8
  177. #define SIZEOF_OFF_T        8
  178. #ifdef _WIN64
  179. #define SIZEOF_CHARP        8
  180. #else
  181. #define SIZEOF_CHARP        4
  182. #endif
  183. #define HAVE_BROKEN_NETINET_INCLUDES
  184. #ifdef __NT__
  185. #define HAVE_NAMED_PIPE            /* We can only create pipes on NT */
  186. #endif
  187.  
  188. /* ERROR is defined in wingdi.h */
  189. #undef ERROR
  190.  
  191. /* We need to close files to break connections on shutdown */
  192. #ifndef SIGNAL_WITH_VIO_CLOSE
  193. #define SIGNAL_WITH_VIO_CLOSE
  194. #endif
  195.  
  196. /* Use all character sets in MySQL */
  197. #define USE_MB 1
  198. #define USE_MB_IDENT 1
  199. #define USE_STRCOLL 1
  200.  
  201. /* All windows servers should support .sym files */
  202. #undef USE_SYMDIR
  203. #define USE_SYMDIR
  204.  
  205. /* If LOAD DATA LOCAL INFILE should be enabled by default */
  206. #define ENABLED_LOCAL_INFILE 1
  207.  
  208. /* If query profiling should be enabled by default */
  209. #define ENABLED_PROFILING 1
  210.  
  211. /* Convert some simple functions to Posix */
  212.  
  213. #define my_sigset(A,B) signal((A),(B))
  214. #define finite(A) _finite(A)
  215. #define sleep(A)  Sleep((A)*1000)
  216. #define popen(A,B) _popen((A),(B))
  217. #define pclose(A) _pclose(A)
  218.  
  219. #ifndef __BORLANDC__
  220. #define access(A,B) _access(A,B)
  221. #endif
  222.  
  223. #if !defined(__cplusplus)
  224. #define inline __inline
  225. #endif /* __cplusplus */
  226.  
  227. inline double rint(double nr)
  228. {
  229.   double f = floor(nr);
  230.   double c = ceil(nr);
  231.   return (((c-nr) >= (nr-f)) ? f :c);
  232. }
  233.  
  234. #ifdef _WIN64
  235. #define ulonglong2double(A) ((double) (ulonglong) (A))
  236. #define my_off_t2double(A)  ((double) (my_off_t) (A))
  237.  
  238. #else
  239. inline double ulonglong2double(ulonglong value)
  240. {
  241.   longlong nr=(longlong) value;
  242.   if (nr >= 0)
  243.     return (double) nr;
  244.   return (18446744073709551616.0 + (double) nr);
  245. }
  246. #define my_off_t2double(A) ulonglong2double(A)
  247. #endif /* _WIN64 */
  248.  
  249. #if SIZEOF_OFF_T > 4
  250. #define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C))
  251. #define tell(A) _telli64(A)
  252. #endif
  253.  
  254.  
  255. #define STACK_DIRECTION -1
  256.  
  257. /* Optimized store functions for Intel x86 */
  258.  
  259. #ifndef _WIN64
  260. #define sint2korr(A)    (*((int16 *) (A)))
  261. #define sint3korr(A)    ((int32) ((((uchar) (A)[2]) & 128) ? \
  262.                   (((uint32) 255L << 24) | \
  263.                    (((uint32) (uchar) (A)[2]) << 16) |\
  264.                    (((uint32) (uchar) (A)[1]) << 8) | \
  265.                    ((uint32) (uchar) (A)[0])) : \
  266.                   (((uint32) (uchar) (A)[2]) << 16) |\
  267.                   (((uint32) (uchar) (A)[1]) << 8) | \
  268.                   ((uint32) (uchar) (A)[0])))
  269. #define sint4korr(A)    (*((long *) (A)))
  270. #define uint2korr(A)    (*((uint16 *) (A)))
  271. /*
  272.    ATTENTION !
  273.    
  274.     Please, note, uint3korr reads 4 bytes (not 3) !
  275.     It means, that you have to provide enough allocated space !
  276. */
  277. #define uint3korr(A)    (long) (*((unsigned int *) (A)) & 0xFFFFFF)
  278. #define uint4korr(A)    (*((unsigned long *) (A)))
  279. #define uint5korr(A)    ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
  280.                     (((uint32) ((uchar) (A)[1])) << 8) +\
  281.                     (((uint32) ((uchar) (A)[2])) << 16) +\
  282.                     (((uint32) ((uchar) (A)[3])) << 24)) +\
  283.                     (((ulonglong) ((uchar) (A)[4])) << 32))
  284. #define uint8korr(A)    (*((ulonglong *) (A)))
  285. #define sint8korr(A)    (*((longlong *) (A)))
  286. #define int2store(T,A)    *((uint16*) (T))= (uint16) (A)
  287. #define int3store(T,A)        { *(T)=  (uchar) ((A));\
  288.                   *(T+1)=(uchar) (((uint) (A) >> 8));\
  289.                   *(T+2)=(uchar) (((A) >> 16)); }
  290. #define int4store(T,A)    *((long *) (T))= (long) (A)
  291. #define int5store(T,A)    { *(T)= (uchar)((A));\
  292.               *((T)+1)=(uchar) (((A) >> 8));\
  293.               *((T)+2)=(uchar) (((A) >> 16));\
  294.               *((T)+3)=(uchar) (((A) >> 24)); \
  295.               *((T)+4)=(uchar) (((A) >> 32)); }
  296. #define int8store(T,A)    *((ulonglong *) (T))= (ulonglong) (A)
  297.  
  298. #define doubleget(V,M)    do { *((long *) &V) = *((long*) M); \
  299.                 *(((long *) &V)+1) = *(((long*) M)+1); } while(0)
  300. #define doublestore(T,V) do { *((long *) T) = *((long*) &V); \
  301.                   *(((long *) T)+1) = *(((long*) &V)+1); } while(0)
  302. #define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
  303. #define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V), sizeof(float))
  304. #define floatget(V,M)   memcpy((byte*)(&V), (byte*)(M), sizeof(float))
  305. #define float8get(V,M) doubleget((V),(M))
  306. #define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
  307. #define float8store(V,M) doublestore((V),(M))
  308. #endif /* _WIN64 */
  309.  
  310. #define HAVE_PERROR
  311. #define HAVE_VFPRINT
  312. #define HAVE_RENAME        /* Have rename() as function */
  313. #define HAVE_BINARY_STREAMS    /* Have "b" flag in streams */
  314. #define HAVE_LONG_JMP        /* Have long jump function */
  315. #define HAVE_LOCKING        /* have locking() call */
  316. #define HAVE_ERRNO_AS_DEFINE    /* errno is a define */
  317. #define HAVE_STDLIB        /* everything is include in this file */
  318. #define HAVE_MEMCPY
  319. #define HAVE_MEMMOVE
  320. #define HAVE_GETCWD
  321. #define HAVE_TELL
  322. #define HAVE_TZNAME
  323. #define HAVE_PUTENV
  324. #define HAVE_SELECT
  325. #define HAVE_SETLOCALE
  326. #define HAVE_SOCKET        /* Giangi */
  327. #define HAVE_FLOAT_H
  328. #define HAVE_LIMITS_H
  329. #define HAVE_STDDEF_H
  330. #define HAVE_RINT        /* defined in this file */
  331. #define NO_FCNTL_NONBLOCK    /* No FCNTL */
  332. #define HAVE_ALLOCA
  333. #define HAVE_STRPBRK
  334. #define HAVE_STRSTR
  335. #define HAVE_COMPRESS
  336. #define HAVE_CREATESEMAPHORE
  337. #define HAVE_ISNAN
  338. #define HAVE_FINITE
  339. #define HAVE_QUERY_CACHE
  340. #define SPRINTF_RETURNS_INT
  341. #define HAVE_SETFILEPOINTER
  342. #define HAVE_VIO_READ_BUFF
  343. #define HAVE_STRNLEN
  344.  
  345. #ifndef __NT__
  346. #undef FILE_SHARE_DELETE
  347. #define FILE_SHARE_DELETE 0     /* Not implemented on Win 98/ME */
  348. #endif
  349.  
  350. #ifdef NOT_USED
  351. #define HAVE_SNPRINTF        /* Gave link error */
  352. #define _snprintf snprintf
  353. #endif
  354.  
  355. #ifdef _MSC_VER
  356. #define HAVE_LDIV        /* The optimizer breaks in zortech for ldiv */
  357. #define HAVE_ANSI_INCLUDE
  358. #define HAVE_SYS_UTIME_H
  359. #define HAVE_STRTOUL
  360. #endif
  361. #define my_reinterpret_cast(A) reinterpret_cast <A>
  362. #define my_const_cast(A) const_cast<A>
  363.  
  364.  
  365. /* MYSQL OPTIONS */
  366.  
  367. #ifdef _CUSTOMCONFIG_
  368. #include <custom_conf.h>
  369. #else
  370. #define DEFAULT_MYSQL_HOME    "c:\\mysql"
  371. #define DATADIR             "c:\\mysql\\data"
  372. #define PACKAGE            "mysql"
  373. #define DEFAULT_BASEDIR        "C:\\"
  374. #define SHAREDIR        "share"
  375. #define DEFAULT_CHARSET_HOME    "C:/mysql/"
  376. #endif
  377. #ifndef DEFAULT_HOME_ENV
  378. #define DEFAULT_HOME_ENV MYSQL_HOME
  379. #endif
  380. #ifndef DEFAULT_GROUP_SUFFIX_ENV
  381. #define DEFAULT_GROUP_SUFFIX_ENV MYSQL_GROUP_SUFFIX
  382. #endif
  383.  
  384. /* File name handling */
  385.  
  386. #define FN_LIBCHAR    '\\'
  387. #define FN_ROOTDIR    "\\"
  388. #define FN_DEVCHAR    ':'
  389. #define FN_NETWORK_DRIVES    /* Uses \\ to indicate network drives */
  390. #define FN_NO_CASE_SENCE    /* Files are not case-sensitive */
  391. #define OS_FILE_LIMIT    2048
  392.  
  393. #define DO_NOT_REMOVE_THREAD_WRAPPERS
  394. #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
  395. #define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V))
  396. /* The following is only used for statistics, so it should be good enough */
  397. #ifdef __NT__  /* This should also work on Win98 but .. */
  398. #define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
  399. #define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C))
  400. #define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
  401. #else
  402. #define thread_safe_add(V,C,L) \
  403.     pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
  404. #define thread_safe_sub(V,C,L) \
  405.     pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
  406. #define statistic_add(V,C,L)     (V)+=(C)
  407. #endif
  408. #define statistic_increment(V,L) thread_safe_increment((V),(L))
  409. #define statistic_decrement(V,L) thread_safe_decrement((V),(L))
  410.  
  411. #define shared_memory_buffer_length 16000
  412. #define default_shared_memory_base_name "MYSQL"
  413.  
  414. #define MYSQL_DEFAULT_CHARSET_NAME "latin1"
  415. #define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
  416.  
  417. #define HAVE_SPATIAL 1
  418. #define HAVE_RTREE_KEYS 1
  419.  
  420. #define HAVE_OPENSSL 1
  421. #define HAVE_YASSL 1
  422.  
  423. /* Define charsets you want */
  424. /* #undef HAVE_CHARSET_armscii8 */
  425. /* #undef HAVE_CHARSET_ascii */
  426. #define HAVE_CHARSET_big5 1
  427. #define HAVE_CHARSET_cp1250 1
  428. /* #undef HAVE_CHARSET_cp1251 */
  429. /* #undef HAVE_CHARSET_cp1256 */
  430. /* #undef HAVE_CHARSET_cp1257 */
  431. /* #undef HAVE_CHARSET_cp850 */
  432. /* #undef HAVE_CHARSET_cp852 */
  433. /* #undef HAVE_CHARSET_cp866 */
  434. #define HAVE_CHARSET_cp932 1
  435. /* #undef HAVE_CHARSET_dec8 */
  436. #define HAVE_CHARSET_eucjpms 1
  437. #define HAVE_CHARSET_euckr 1
  438. #define HAVE_CHARSET_gb2312 1
  439. #define HAVE_CHARSET_gbk 1
  440. /* #undef HAVE_CHARSET_greek */
  441. /* #undef HAVE_CHARSET_hebrew */
  442. /* #undef HAVE_CHARSET_hp8 */
  443. /* #undef HAVE_CHARSET_keybcs2 */
  444. /* #undef HAVE_CHARSET_koi8r */
  445. /* #undef HAVE_CHARSET_koi8u */
  446. #define HAVE_CHARSET_latin1 1
  447. #define HAVE_CHARSET_latin2 1
  448. /* #undef HAVE_CHARSET_latin5 */
  449. /* #undef HAVE_CHARSET_latin7 */
  450. /* #undef HAVE_CHARSET_macce */
  451. /* #undef HAVE_CHARSET_macroman */
  452. #define HAVE_CHARSET_sjis 1
  453. /* #undef HAVE_CHARSET_swe7 */
  454. #define HAVE_CHARSET_tis620 1
  455. #define HAVE_CHARSET_ucs2 1
  456. #define HAVE_CHARSET_ujis 1
  457. #define HAVE_CHARSET_utf8 1
  458. #define HAVE_UCA_COLLATIONS 1
  459.  
  460.