~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/definitions.h

  • Committer: Padraig O'Sullivan
  • Date: 2009-09-13 01:03:01 UTC
  • mto: (1126.9.2 captain-20090915-01)
  • mto: This revision was merged to the branch mainline in revision 1133.
  • Revision ID: osullivan.padraig@gmail.com-20090913010301-tcvvezipx1124acy
Added calls to the dtrace delete begin/end probes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 * Mostly constants and some macros/functions used by the server
24
24
 */
25
25
 
26
 
#ifndef DRIZZLED_DEFINITIONS_H
27
 
#define DRIZZLED_DEFINITIONS_H
 
26
#ifndef DRIZZLE_SERVER_DEFINITIONS_H
 
27
#define DRIZZLE_SERVER_DEFINITIONS_H
28
28
 
29
29
#include <drizzled/enum.h>
30
30
 
31
31
#include <stdint.h>
32
32
 
33
 
namespace drizzled
34
 
{
35
 
 
36
33
/* These paths are converted to other systems (WIN95) before use */
37
34
 
38
35
#define LANGUAGE        "english/"
39
36
#define TEMP_PREFIX     "MY"
40
37
#define LOG_PREFIX      "ML"
41
 
 
42
 
#define ER(X) ::drizzled::error_message((X))
43
 
 
 
38
#define PROGDIR         "bin/"
 
39
 
 
40
#define ER(X) error_message((X))
 
41
 
 
42
#define LIBLEN FN_REFLEN-FN_LEN                 /* Max l{ngd p} dev */
44
43
/* extra 4+4 bytes for slave tmp tables */
45
44
#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
46
45
#define MAX_ALIAS_NAME 256
47
46
#define MAX_FIELD_NAME 34                       /* Max colum name length +2 */
48
47
#define MAX_SYS_VAR_LENGTH 32
49
 
#define MAX_INDEXES 64
50
48
#define MAX_KEY MAX_INDEXES                     /* Max used keys */
51
49
#define MAX_REF_PARTS 16                        /* Max parts used as ref */
52
50
#define MAX_KEY_LENGTH 4096                     /* max possible key */
74
72
#define RAND_TABLE_BIT  (((table_map) 1) << (sizeof(table_map)*8-1))
75
73
#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
76
74
                           RAND_TABLE_BIT)
77
 
#define MAX_FIELDS      4096      /* Historical limit from MySQL FRM. */
 
75
#define MAX_FIELDS      4096                    /* Limit in the .frm file */
78
76
 
79
77
#define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
80
78
 
81
79
#define MAX_SORT_MEMORY (2048*1024-MALLOC_OVERHEAD)
82
80
#define MIN_SORT_MEMORY (32*1024-MALLOC_OVERHEAD)
83
81
 
 
82
/* Memory allocated when parsing a statement / saving a statement */
 
83
#define MEM_ROOT_BLOCK_SIZE       8192
 
84
#define MEM_ROOT_PREALLOC         8192
 
85
#define TRANS_MEM_ROOT_BLOCK_SIZE 4096
 
86
#define TRANS_MEM_ROOT_PREALLOC   4096
 
87
 
84
88
#define DEFAULT_ERROR_COUNT     64
85
89
#define EXTRA_RECORDS   10                      /* Extra records in sort */
 
90
#define SCROLL_EXTRA    5                       /* Extra scroll-rows. */
 
91
#define FIELD_NAME_USED ((uint32_t) 32768)              /* Bit set if fieldname used */
 
92
#define FIELD_NR_MASK   16383                   /* To get fieldnumber */
 
93
#define FERR            -1                      /* Error from my_functions */
 
94
#define CREATE_MODE     0                       /* Default mode on new files */
86
95
#define NAMES_SEP_CHAR  '\377'                  /* Char to sep. names */
87
96
 
88
97
#define READ_RECORD_BUFFER      (uint32_t) (IO_SIZE*8) /* Pointer_buffer_size */
89
98
#define DISK_BUFFER_SIZE        (uint32_t) (IO_SIZE*16) /* Size of diskbuffer */
90
99
 
 
100
#define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH)
91
101
#define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH)
92
102
#define MYF_RW MYF(MY_WME+MY_NABP)              /* Vid my_read & my_write */
93
103
 
 
104
        /* Defines for use with openfrm, openprt and openfrd */
 
105
 
 
106
#define READ_ALL                1       /* openfrm: Read all parameters */
 
107
#define CHANGE_FRM              2       /* openfrm: open .frm as O_RDWR */
 
108
#define EXTRA_RECORD            8       /* Reservera plats f|r extra record */
 
109
#define DONT_GIVE_ERROR         256     /* Don't do frm_error on openfrm  */
 
110
#define DELAYED_OPEN            4096    /* Open table later */
 
111
/**
 
112
  This flag is used in function get_all_tables() which fills
 
113
  I_S tables with data which are retrieved from frm files and storage engine
 
114
  The flag means that we need to open FRM file only to get necessary data.
 
115
*/
 
116
#define OPEN_FRM_FILE_ONLY     32768
 
117
/**
 
118
  This flag is used in function get_all_tables() which fills
 
119
  I_S tables with data which are retrieved from frm files and storage engine
 
120
  The flag means that we need to process tables only to get necessary data.
 
121
  Views are not processed.
 
122
*/
 
123
#define OPEN_TABLE_ONLY        OPEN_FRM_FILE_ONLY*2
 
124
/**
 
125
  This flag is used in function get_all_tables() which fills
 
126
  I_S tables with data which are retrieved from frm files and storage engine.
 
127
  The flag means that I_S table uses optimization algorithm.
 
128
*/
 
129
#define OPTIMIZE_I_S_TABLE     OPEN_TABLE_ONLY*2
 
130
 
94
131
/*
95
132
  Minimum length pattern before Turbo Boyer-Moore is used
96
133
  for SELECT "text" LIKE "%pattern%", excluding the two
106
143
 
107
144
#define BIN_LOG_HEADER_SIZE    4
108
145
 
 
146
#define DEFAULT_KEY_CACHE_NAME "default"
 
147
 
 
148
#define STORAGE_TYPE_MASK 7
 
149
#define COLUMN_FORMAT_MASK 7
 
150
#define COLUMN_FORMAT_SHIFT 3
 
151
 
109
152
/* Below are #defines that used to be in mysql_priv.h */
110
153
/***************************************************************************
111
154
  Configuration parameters
112
155
****************************************************************************/
 
156
#define MAX_PASSWORD_LENGTH     32
 
157
#define MAX_ACCEPT_RETRY        10      // Test accept this many times
113
158
#define MAX_FIELDS_BEFORE_HASH  32
114
159
#define USER_VARS_HASH_SIZE     16
115
160
#define TABLE_OPEN_CACHE_MIN    64
129
174
#define STACK_MIN_SIZE_FOR_OPEN 1024*80
130
175
#define STACK_BUFF_ALLOC        352     ///< For stack overrun checks
131
176
 
 
177
#define TEMP_POOL_SIZE          128
 
178
 
132
179
#define QUERY_ALLOC_BLOCK_SIZE          8192
133
180
#define QUERY_ALLOC_PREALLOC_SIZE       8192
 
181
#define TRANS_ALLOC_BLOCK_SIZE          4096
 
182
#define TRANS_ALLOC_PREALLOC_SIZE       4096
134
183
#define RANGE_ALLOC_BLOCK_SIZE          4096
 
184
#define UDF_ALLOC_BLOCK_SIZE            1024
135
185
#define TABLE_ALLOC_BLOCK_SIZE          1024
136
186
#define WARN_ALLOC_BLOCK_SIZE           2048
137
187
#define WARN_ALLOC_PREALLOC_SIZE        1024
 
188
#define PROFILE_ALLOC_BLOCK_SIZE  2048
 
189
#define PROFILE_ALLOC_PREALLOC_SIZE 1024
138
190
 
139
191
/*
140
192
  The following parameters is to decide when to use an extra cache to
142
194
*/
143
195
#define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (10L*1024*1024)
144
196
#define MIN_ROWS_TO_USE_TABLE_CACHE      100
 
197
#define MIN_ROWS_TO_USE_BULK_INSERT      100
145
198
 
146
199
/**
147
200
  The following is used to decide if MySQL should use table scanning
217
270
#define MODE_NO_ZERO_DATE               (2)
218
271
#define MODE_INVALID_DATES              (MODE_NO_ZERO_DATE*2)
219
272
 
 
273
/* @@optimizer_switch flags */
 
274
#define OPTIMIZER_SWITCH_NO_MATERIALIZATION 1
 
275
#define OPTIMIZER_SWITCH_NO_SEMIJOIN 2
 
276
 
220
277
#define MY_CHARSET_BIN_MB_MAXLEN 1
221
278
 
222
279
// uncachable cause
233
290
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
234
291
#define UNDEF_POS (-1)
235
292
 
 
293
/* sql_show.cc:show_log_files() */
 
294
#define SHOW_LOG_STATUS_FREE "FREE"
 
295
#define SHOW_LOG_STATUS_INUSE "IN USE"
 
296
 
236
297
/* Options to add_table_to_list() */
237
298
#define TL_OPTION_UPDATING      1
238
299
#define TL_OPTION_FORCE_INDEX   2
257
318
 
258
319
#define STRING_BUFFER_USUAL_SIZE 80
259
320
 
 
321
/*
 
322
  Some defines for exit codes for ::is_equal class functions.
 
323
*/
 
324
#define IS_EQUAL_NO 0
 
325
#define IS_EQUAL_YES 1
 
326
#define IS_EQUAL_PACK_LENGTH 2
 
327
 
 
328
 
 
329
typedef uint64_t query_id_t;
260
330
typedef void *range_seq_t;
261
331
 
262
 
enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX };
263
332
// the following is for checking tables
264
333
 
265
334
#define HA_ADMIN_ALREADY_DONE     1
270
339
#define HA_ADMIN_INTERNAL_ERROR  -4
271
340
#define HA_ADMIN_INVALID         -5
272
341
#define HA_ADMIN_REJECT          -6
 
342
#define HA_ADMIN_TRY_ALTER       -7
 
343
#define HA_ADMIN_NEEDS_UPGRADE  -10
 
344
#define HA_ADMIN_NEEDS_ALTER    -11
 
345
#define HA_ADMIN_NEEDS_CHECK    -12
 
346
 
 
347
 
 
348
/* Remember to increase HA_MAX_ALTER_FLAGS when adding more flags! */
 
349
 
 
350
/* Return values for check_if_supported_alter */
 
351
 
 
352
#define HA_ALTER_ERROR               -1
 
353
#define HA_ALTER_SUPPORTED_WAIT_LOCK  0
 
354
#define HA_ALTER_SUPPORTED_NO_LOCK    1
 
355
#define HA_ALTER_NOT_SUPPORTED        2
 
356
 
 
357
/* Bits in table_flags() to show what database can do */
 
358
 
 
359
#define HA_NO_TRANSACTIONS     (1 << 0) /* Doesn't support transactions */
 
360
#define HA_PARTIAL_COLUMN_READ (1 << 1) /* read may not return all columns */
 
361
#define HA_TABLE_SCAN_ON_INDEX (1 << 2) /* No separate data/index file */
 
362
/*
 
363
  The following should be set if the following is not true when scanning
 
364
  a table with rnd_next()
 
365
  - We will see all rows (including deleted ones)
 
366
  - Row positions are 'table->s->db_record_offset' apart
 
367
  If this flag is not set, filesort will do a postion() call for each matched
 
368
  row to be able to find the row later.
 
369
*/
 
370
#define HA_REC_NOT_IN_SEQ      (1 << 3)
 
371
 
 
372
/*
 
373
  Reading keys in random order is as fast as reading keys in sort order
 
374
  (Used in records.cc to decide if we should use a record cache and by
 
375
  filesort to decide if we should sort key + data or key + pointer-to-row
 
376
*/
 
377
#define HA_FAST_KEY_READ       (1 << 5)
 
378
/*
 
379
  Set the following flag if we on delete should force all key to be read
 
380
  and on update read all keys that changes
 
381
*/
 
382
#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE (1 << 6)
 
383
#define HA_NULL_IN_KEY         (1 << 7) /* One can have keys with NULL */
 
384
#define HA_DUPLICATE_POS       (1 << 8)    /* ha_position() gives dup row */
 
385
#define HA_NO_BLOBS            (1 << 9) /* Doesn't support blobs */
 
386
#define HA_CAN_INDEX_BLOBS     (1 << 10)
 
387
#define HA_AUTO_PART_KEY       (1 << 11) /* auto-increment in multi-part key */
 
388
#define HA_REQUIRE_PRIMARY_KEY (1 << 12) /* .. and can't create a hidden one */
 
389
#define HA_STATS_RECORDS_IS_EXACT (1 << 13) /* stats.records is exact */
 
390
/*
 
391
  If we get the primary key columns for free when we do an index read
 
392
  It also implies that we have to retrive the primary key when using
 
393
  position() and rnd_pos().
 
394
*/
 
395
#define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
 
396
/*
 
397
  If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position()
 
398
  uses a primary key. Without primary key, we can't call position().
 
399
*/
 
400
#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16)
 
401
#define HA_NOT_DELETE_WITH_CACHE (1 << 18)
 
402
/*
 
403
  The following is we need to a primary key to delete (and update) a row.
 
404
  If there is no primary key, all columns needs to be read on update and delete
 
405
*/
 
406
#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE (1 << 19)
 
407
#define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
 
408
#define HA_NO_AUTO_INCREMENT   (1 << 23)
 
409
#define HA_HAS_CHECKSUM        (1 << 24)
 
410
#define HA_NEED_READ_RANGE_BUFFER (1 << 29) /* for read_multi_range */
 
411
#define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30)
 
412
#define HA_HAS_RECORDS         (INT64_C(1) << 32) /* records() gives exact count*/
 
413
#define HA_MRR_CANT_SORT       (INT64_C(1) << 34)
273
414
 
274
415
/* bits in index_flags(index_number) for what you can do with index */
275
416
#define HA_READ_NEXT            1       /* TODO really use this flag */
283
424
  set for unordered (e.g. HASH) indexes.
284
425
*/
285
426
#define HA_KEY_SCAN_NOT_ROR     128
 
427
#define HA_DO_INDEX_COND_PUSHDOWN  256 /* Supports Index Condition Pushdown */
286
428
 
287
429
/* operations for disable/enable indexes */
288
430
#define HA_KEY_SWITCH_NONUNIQ      0
324
466
#define HA_KEY_NULL_LENGTH      1
325
467
#define HA_KEY_BLOB_LENGTH      2
326
468
 
 
469
#define HA_LEX_CREATE_TMP_TABLE 1
 
470
#define HA_LEX_CREATE_IF_NOT_EXISTS 2
 
471
#define HA_LEX_CREATE_TABLE_LIKE 4
 
472
#define HA_OPTION_NO_CHECKSUM   (1L << 17)
327
473
#define HA_MAX_REC_LENGTH       65535
328
474
 
329
475
/* Options of START TRANSACTION statement (and later of SET TRANSACTION stmt) */
330
 
enum start_transaction_option_t
331
 
{
332
 
  START_TRANS_NO_OPTIONS,
333
 
  START_TRANS_OPT_WITH_CONS_SNAPSHOT
334
 
};
 
476
#define DRIZZLE_START_TRANS_OPT_WITH_CONS_SNAPSHOT 1
335
477
 
336
478
/* Flags for method is_fatal_error */
337
479
#define HA_CHECK_DUP_KEY 1
343
485
#define HA_CREATE_USED_AUTO             (1L << 0)
344
486
#define HA_CREATE_USED_CHARSET          (1L << 8)
345
487
#define HA_CREATE_USED_DEFAULT_CHARSET  (1L << 9)
 
488
#define HA_CREATE_USED_ENGINE           (1L << 12)
346
489
#define HA_CREATE_USED_ROW_FORMAT       (1L << 15)
 
490
#define HA_CREATE_USED_COMMENT          (1L << 16)
347
491
#define HA_CREATE_USED_KEY_BLOCK_SIZE   (1L << 19)
348
492
#define HA_CREATE_USED_BLOCK_SIZE       (1L << 22)
349
493
 
 
494
#define MAXGTRIDSIZE 64
 
495
#define MAXBQUALSIZE 64
 
496
 
350
497
/*
351
498
  The below two are not used (and not handled) in this milestone of this WL
352
499
  entry because there seems to be no use for them at this stage of
385
532
*/
386
533
#define HA_MRR_USE_DEFAULT_IMPL 64
387
534
 
 
535
/*
 
536
  Used only as parameter to multi_range_read_info():
 
537
  Flag set <=> the caller guarantees that the bounds of the scanned ranges
 
538
  will not have NULL values.
 
539
*/
 
540
#define HA_MRR_NO_NULL_ENDPOINTS 128
 
541
 
388
542
typedef int myf;
389
 
#define MYF(v)          (static_cast<drizzled::myf>(v))
 
543
#define MYF(v)          (myf) (v)
 
544
 
 
545
#define MY_I_S_MAYBE_NULL 1
 
546
#define MY_I_S_UNSIGNED   2
 
547
 
 
548
 
 
549
#define SKIP_OPEN_TABLE 0                // do not open table
 
550
#define OPEN_FRM_ONLY   1                // open FRM file only
 
551
#define OPEN_FULL_TABLE 2                // open FRM,MYD, MYI files
390
552
 
391
553
/*
392
554
   "Declared Type Collation"
416
578
 * The following are for the interface with the .frm file
417
579
 */
418
580
 
 
581
#define FIELDFLAG_DECIMAL    1
 
582
#define FIELDFLAG_BINARY    1  // Shares same flag
 
583
#define FIELDFLAG_NUMBER    2
 
584
#define FIELDFLAG_DECIMAL_POSITION      4
 
585
#define FIELDFLAG_PACK      120  // Bits used for packing
 
586
#define FIELDFLAG_INTERVAL    256     // mangled with decimals!
 
587
#define FIELDFLAG_BLOB      1024  // mangled with decimals!
 
588
 
 
589
#define FIELDFLAG_NO_DEFAULT    16384   /* sql */
 
590
#define FIELDFLAG_SUM      ((uint32_t) 32768)// predit: +#fieldflag
 
591
#define FIELDFLAG_MAYBE_NULL    ((uint32_t) 32768)// sql
 
592
#define FIELDFLAG_HEX_ESCAPE    ((uint32_t) 0x10000)
419
593
#define FIELDFLAG_PACK_SHIFT    3
 
594
#define FIELDFLAG_DEC_SHIFT    8
420
595
#define FIELDFLAG_MAX_DEC    31
421
596
 
422
597
#define MTYP_TYPENR(type) (type & 127)  /* Remove bits from type */
423
598
 
 
599
#define f_is_dec(x)     ((x) & FIELDFLAG_DECIMAL)
 
600
#define f_is_num(x)     ((x) & FIELDFLAG_NUMBER)
 
601
#define f_is_decimal_precision(x)  ((x) & FIELDFLAG_DECIMAL_POSITION)
 
602
#define f_is_packed(x)  ((x) & FIELDFLAG_PACK)
 
603
#define f_packtype(x)   (((x) >> FIELDFLAG_PACK_SHIFT) & 15)
 
604
#define f_decimals(x)   ((uint8_t) (((x) >> FIELDFLAG_DEC_SHIFT) & \
 
605
                                     FIELDFLAG_MAX_DEC))
 
606
#define f_is_alpha(x)   (!f_is_num(x))
 
607
#define f_is_binary(x)  ((x) & FIELDFLAG_BINARY) // 4.0- compatibility
 
608
#define f_is_enum(x)    (((x) & (FIELDFLAG_INTERVAL | FIELDFLAG_NUMBER)) == \
 
609
                         FIELDFLAG_INTERVAL)
 
610
#define f_is_blob(x)    (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == \
 
611
                         FIELDFLAG_BLOB)
 
612
#define f_is_equ(x)     ((x) & (1+2+FIELDFLAG_PACK+31*256))
424
613
#define f_settype(x)    (((int) x) << FIELDFLAG_PACK_SHIFT)
425
 
 
426
 
 
427
 
#ifdef __cplusplus
428
 
template <class T> void set_if_bigger(T &a, const T &b)
429
 
{
430
 
  if (a < b)
431
 
    a=b;
432
 
}
433
 
 
434
 
template <class T> void set_if_smaller(T &a, const T &b)
435
 
{
436
 
  if (a > b)
437
 
    a=b;
438
 
}
439
 
#else
440
 
#ifdef __GNUC__
441
 
#define set_if_bigger(a,b) do {                 \
442
 
  const typeof(a) _a = (a);                     \
443
 
  const typeof(b) _b = (b);                     \
444
 
  (void) (&_a == &_b);                          \
445
 
  if ((a) < (b)) (a)=(b);                       \
446
 
  } while(0)
447
 
#define set_if_smaller(a,b) do {                \
448
 
  const typeof(a) _a = (a);                     \
449
 
  const typeof(b) _b = (b);                     \
450
 
  (void) (&_a == &_b);                          \
451
 
  if ((a) > (b)) (a)=(b);                       \
452
 
  } while(0)
453
 
 
454
 
#else
455
 
#define set_if_bigger(a,b)  do { if ((a) < (b)) (a)=(b); } while(0)
456
 
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
457
 
#endif
458
 
#endif
459
 
 
460
 
 
461
 
#define array_elements(a) \
462
 
  ((sizeof(a) / sizeof(*(a))) / \
463
 
   static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
464
 
 
465
 
 
466
 
/* Some types that is different between systems */
467
 
 
468
 
#ifndef FN_LIBCHAR
469
 
#define FN_LIBCHAR  '/'
470
 
#define FN_ROOTDIR  "/"
471
 
#endif
472
 
#define MY_NFILE  64  /* This is only used to save filenames */
473
 
#ifndef OS_FILE_LIMIT
474
 
#define OS_FILE_LIMIT  65535
475
 
#endif
476
 
 
477
 
/*
478
 
  How much overhead does malloc have. The code often allocates
479
 
  something like 1024-MALLOC_OVERHEAD bytes
480
 
*/
481
 
#define MALLOC_OVERHEAD 8
482
 
 
483
 
/* get memory in huncs */
484
 
static const uint32_t ONCE_ALLOC_INIT= 4096;
485
 
/* Typical record cash */
486
 
static const uint32_t RECORD_CACHE_SIZE= 64*1024;
487
 
/* Typical key cash */
488
 
static const uint32_t KEY_CACHE_SIZE= 8*1024*1024;
489
 
 
490
 
/* Default size of a key cache block  */
491
 
static const uint32_t KEY_CACHE_BLOCK_SIZE= 1024;
492
 
 
493
 
 
494
 
/* Some things that this system doesn't have */
495
 
 
496
 
/* Some defines of functions for portability */
497
 
 
498
 
#ifndef uint64_t2double
499
 
#define uint64_t2double(A) ((double) (uint64_t) (A))
500
 
#endif
501
 
 
502
 
#ifndef offsetof
503
 
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
504
 
#endif
505
 
#define ulong_to_double(X) ((double) (ulong) (X))
506
 
 
507
 
/* From limits.h instead */
508
 
#ifndef DBL_MIN
509
 
#define DBL_MIN    4.94065645841246544e-324
510
 
#endif
511
 
#ifndef DBL_MAX
512
 
#define DBL_MAX    1.79769313486231470e+308
513
 
#endif
514
 
 
515
 
 
516
 
/* Define missing math constants. */
517
 
#ifndef M_PI
518
 
#define M_PI 3.14159265358979323846
519
 
#endif
520
 
#ifndef M_E
521
 
#define M_E 2.7182818284590452354
522
 
#endif
523
 
#ifndef M_LN2
524
 
#define M_LN2 0.69314718055994530942
525
 
#endif
526
 
 
527
 
/*
528
 
  Max size that must be added to a so that we know Size to make
529
 
  adressable obj.
530
 
*/
531
 
#define MY_ALIGN(A,L)  (((A) + (L) - 1) & ~((L) - 1))
532
 
#define ALIGN_SIZE(A)  MY_ALIGN((A),sizeof(double))
533
 
/* Size to make adressable obj. */
534
 
#define ALIGN_PTR(A, t) ((t*) MY_ALIGN((A),sizeof(t)))
535
 
/* Offset of field f in structure t */
536
 
#define OFFSET(t, f)  ((size_t)(char *)&((t *)0)->f)
537
 
#ifdef __cplusplus
538
 
#define ADD_TO_PTR(ptr,size,type) (type) (reinterpret_cast<const unsigned char*>(ptr)+size)
539
 
#define PTR_BYTE_DIFF(A,B) (ptrdiff_t) (reinterpret_cast<const unsigned char*>(A) - reinterpret_cast<const unsigned char*>(B))
540
 
#else
541
 
 #define ADD_TO_PTR(ptr,size,type) (type) ((unsigned char*) (ptr)+size)
542
 
 #define PTR_BYTE_DIFF(A,B) (ptrdiff_t) ((unsigned char*) (A) - (unsigned char*) (B))
543
 
#endif
544
 
 
545
 
#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B))
546
 
#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))]
547
 
 
548
 
/* Typdefs for easyier portability */
549
 
 
550
 
 
551
 
#if defined(SIZEOF_OFF_T)
552
 
# if (SIZEOF_OFF_T == 8)
553
 
#  define OFF_T_MAX (INT64_MAX)
554
 
# else
555
 
#  define OFF_T_MAX (INT32_MAX)
556
 
# endif
557
 
#endif
558
 
 
559
 
#define MY_FILEPOS_ERROR  -1
560
 
 
561
 
#define DRIZZLE_SERVER
562
 
 
563
 
/* Length of decimal number represented by INT32. */
564
 
#define MY_INT32_NUM_DECIMAL_DIGITS 11
565
 
 
566
 
/* Length of decimal number represented by INT64. */
567
 
#define MY_INT64_NUM_DECIMAL_DIGITS 21
568
 
 
569
 
/*
570
 
  Io buffer size; Must be a power of 2 and
571
 
  a multiple of 512. May be
572
 
  smaller what the disk page size. This influences the speed of the
573
 
  isam btree library. eg to big to slow.
574
 
*/
575
 
#define IO_SIZE 4096
576
 
/* Max file name len */
577
 
#define FN_LEN 256
578
 
/* Max length of extension (part of FN_LEN) */
579
 
#define FN_EXTLEN 20
580
 
/* Max length of full path-name */
581
 
#define FN_REFLEN 512
582
 
/* File extension character */
583
 
#define FN_EXTCHAR '.'
584
 
/* ~ is used as abbrev for home dir */
585
 
#define FN_HOMELIB '~'
586
 
/* ./ is used as abbrev for current dir */
587
 
#define FN_CURLIB '.'
588
 
/* Parent directory; Must be a string */
589
 
#define FN_PARENTDIR ".."
590
 
 
591
 
/* Quote argument (before cpp) */
592
 
#ifndef QUOTE_ARG
593
 
# define QUOTE_ARG(x) #x
594
 
#endif
595
 
/* Quote argument, (after cpp) */
596
 
#ifndef STRINGIFY_ARG
597
 
# define STRINGIFY_ARG(x) QUOTE_ARG(x)
598
 
#endif
599
 
 
600
 
/*
601
 
 * The macros below are borrowed from include/linux/compiler.h in the
602
 
 * Linux kernel. Use them to indicate the likelyhood of the truthfulness
603
 
 * of a condition. This serves two purposes - newer versions of gcc will be
604
 
 * able to optimize for branch predication, which could yield siginficant
605
 
 * performance gains in frequently executed sections of the code, and the
606
 
 * other reason to use them is for documentation
607
 
 */
608
 
#if !defined(__GNUC__)
609
 
#define __builtin_expect(x, expected_value) (x)
610
 
#endif
611
 
 
612
 
#define likely(x)  __builtin_expect((x),1)
613
 
#define unlikely(x)  __builtin_expect((x),0)
614
 
 
615
 
 
616
 
/*
617
 
  Only Linux is known to need an explicit sync of the directory to make sure a
618
 
  file creation/deletion/renaming in(from,to) this directory durable.
619
 
*/
620
 
#ifdef TARGET_OS_LINUX
621
 
#define NEED_EXPLICIT_SYNC_DIR 1
622
 
#endif
623
 
 
624
 
/* We need to turn off _DTRACE_VERSION if we're not going to use dtrace */
625
 
#if !defined(HAVE_DTRACE)
626
 
# undef _DTRACE_VERSION
627
 
# define _DTRACE_VERSION 0
628
 
#endif
629
 
 
630
 
} /* namespace drizzled */
631
 
 
632
 
#endif /* DRIZZLED_DEFINITIONS_H */
 
614
#define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL)
 
615
#define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT)
 
616
#define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE)
 
617
 
 
618
#endif /* DRIZZLE_SERVER_DEFINITIONS_H */
 
619