~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/definitions.h

  • Committer: Monty Taylor
  • Date: 2010-01-02 05:11:55 UTC
  • mto: (1259.3.1 build)
  • mto: This revision was merged to the branch mainline in revision 1262.
  • Revision ID: mordred@inaugust.com-20100102051155-akdm8w5rr6xwzayu
pandora-build - proper detection of memcached.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
#include <stdint.h>
32
32
 
33
 
#include "common.h"
34
 
 
35
 
namespace drizzled
36
 
{
37
 
 
38
 
/* Global value for how we extend our temporary directory */
39
 
#define GLOBAL_TEMPORARY_EXT ".temporary"
40
 
 
41
33
/* These paths are converted to other systems (WIN95) before use */
42
34
 
43
35
#define LANGUAGE        "english/"
44
36
#define TEMP_PREFIX     "MY"
45
37
#define LOG_PREFIX      "ML"
46
 
 
47
 
#define ER(X) ::drizzled::error_message((X))
48
 
 
49
 
/* buffer size for strerror_r() */
50
 
#define STRERROR_MAX 256
51
 
 
 
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 */
52
43
/* extra 4+4 bytes for slave tmp tables */
53
44
#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
54
45
#define MAX_ALIAS_NAME 256
82
73
#define RAND_TABLE_BIT  (((table_map) 1) << (sizeof(table_map)*8-1))
83
74
#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
84
75
                           RAND_TABLE_BIT)
85
 
#define MAX_FIELDS      4096      /* Historical limit from MySQL FRM. */
 
76
#define MAX_FIELDS      4096                    /* Limit in the .frm file */
86
77
 
87
78
#define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
88
79
 
89
80
#define MAX_SORT_MEMORY (2048*1024-MALLOC_OVERHEAD)
90
81
#define MIN_SORT_MEMORY (32*1024-MALLOC_OVERHEAD)
91
82
 
 
83
/* Memory allocated when parsing a statement / saving a statement */
 
84
#define MEM_ROOT_BLOCK_SIZE       8192
 
85
#define MEM_ROOT_PREALLOC         8192
 
86
 
92
87
#define DEFAULT_ERROR_COUNT     64
93
88
#define EXTRA_RECORDS   10                      /* Extra records in sort */
 
89
#define SCROLL_EXTRA    5                       /* Extra scroll-rows. */
 
90
#define FIELD_NAME_USED ((uint32_t) 32768)              /* Bit set if fieldname used */
 
91
#define FIELD_NR_MASK   16383                   /* To get fieldnumber */
 
92
#define FERR            -1                      /* Error from my_functions */
 
93
#define CREATE_MODE     0                       /* Default mode on new files */
94
94
#define NAMES_SEP_CHAR  '\377'                  /* Char to sep. names */
95
95
 
96
96
#define READ_RECORD_BUFFER      (uint32_t) (IO_SIZE*8) /* Pointer_buffer_size */
97
97
#define DISK_BUFFER_SIZE        (uint32_t) (IO_SIZE*16) /* Size of diskbuffer */
98
98
 
 
99
#define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH)
99
100
#define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH)
100
101
#define MYF_RW MYF(MY_WME+MY_NABP)              /* Vid my_read & my_write */
101
102
 
 
103
        /* Defines for use with openfrm, openprt and openfrd */
 
104
 
 
105
#define READ_ALL                1       /* openfrm: Read all parameters */
 
106
#define EXTRA_RECORD            8       /* Reservera plats f|r extra record */
 
107
#define DONT_GIVE_ERROR         256     /* Don't do frm_error on openfrm  */
 
108
#define DELAYED_OPEN            4096    /* Open table later */
 
109
/**
 
110
  This flag is used in function get_all_tables() which fills
 
111
  I_S tables with data which are retrieved from frm files and storage engine
 
112
  The flag means that we need to open FRM file only to get necessary data.
 
113
*/
 
114
#define OPEN_FRM_FILE_ONLY     32768
 
115
/**
 
116
  This flag is used in function get_all_tables() which fills
 
117
  I_S tables with data which are retrieved from frm files and storage engine
 
118
  The flag means that we need to process tables only to get necessary data.
 
119
  Views are not processed.
 
120
*/
 
121
#define OPEN_TABLE_ONLY        OPEN_FRM_FILE_ONLY*2
 
122
/**
 
123
  This flag is used in function get_all_tables() which fills
 
124
  I_S tables with data which are retrieved from frm files and storage engine.
 
125
  The flag means that I_S table uses optimization algorithm.
 
126
*/
 
127
#define OPTIMIZE_I_S_TABLE     OPEN_TABLE_ONLY*2
 
128
 
102
129
/*
103
130
  Minimum length pattern before Turbo Boyer-Moore is used
104
131
  for SELECT "text" LIKE "%pattern%", excluding the two
114
141
 
115
142
#define BIN_LOG_HEADER_SIZE    4
116
143
 
 
144
#define COLUMN_FORMAT_MASK 7
 
145
#define COLUMN_FORMAT_SHIFT 3
 
146
 
117
147
/* Below are #defines that used to be in mysql_priv.h */
118
148
/***************************************************************************
119
149
  Configuration parameters
137
167
#define STACK_MIN_SIZE_FOR_OPEN 1024*80
138
168
#define STACK_BUFF_ALLOC        352     ///< For stack overrun checks
139
169
 
 
170
#define TEMP_POOL_SIZE          128
 
171
 
140
172
#define QUERY_ALLOC_BLOCK_SIZE          8192
141
173
#define QUERY_ALLOC_PREALLOC_SIZE       8192
 
174
#define TRANS_ALLOC_BLOCK_SIZE          4096
 
175
#define TRANS_ALLOC_PREALLOC_SIZE       4096
142
176
#define RANGE_ALLOC_BLOCK_SIZE          4096
143
177
#define TABLE_ALLOC_BLOCK_SIZE          1024
144
178
#define WARN_ALLOC_BLOCK_SIZE           2048
150
184
*/
151
185
#define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (10L*1024*1024)
152
186
#define MIN_ROWS_TO_USE_TABLE_CACHE      100
 
187
#define MIN_ROWS_TO_USE_BULK_INSERT      100
153
188
 
154
189
/**
155
190
  The following is used to decide if MySQL should use table scanning
190
225
 
191
226
/** Characters shown for the command in 'show processlist'. */
192
227
#define PROCESS_LIST_WIDTH 100
 
228
/* Characters shown for the command in 'information_schema.processlist' */
 
229
#define PROCESS_LIST_INFO_WIDTH 65535
193
230
 
194
231
#define PRECISION_FOR_DOUBLE 53
195
232
#define PRECISION_FOR_FLOAT  24
199
236
#define FLUSH_TIME              0               /**< Don't flush tables */
200
237
#define MAX_CONNECT_ERRORS      10              ///< errors before disabling host
201
238
 
 
239
#define INTERRUPT_PRIOR 10
 
240
#define CONNECT_PRIOR   9
 
241
#define WAIT_PRIOR      8
 
242
#define QUERY_PRIOR     6
 
243
 
202
244
/* Bits from testflag */
203
245
enum test_flag_bit
204
246
{
218
260
#define MODE_NO_ZERO_DATE               (2)
219
261
#define MODE_INVALID_DATES              (MODE_NO_ZERO_DATE*2)
220
262
 
 
263
/* @@optimizer_switch flags */
 
264
#define OPTIMIZER_SWITCH_NO_MATERIALIZATION 1
 
265
#define OPTIMIZER_SWITCH_NO_SEMIJOIN 2
 
266
 
221
267
#define MY_CHARSET_BIN_MB_MAXLEN 1
222
268
 
223
269
// uncachable cause
224
 
static const uint32_t UNCACHEABLE_DEPENDENT= 1;
225
 
static const uint32_t UNCACHEABLE_RAND= 2;
226
 
static const uint32_t UNCACHEABLE_SIDEEFFECT= 3;
 
270
#define UNCACHEABLE_DEPENDENT   1
 
271
#define UNCACHEABLE_RAND        2
 
272
#define UNCACHEABLE_SIDEEFFECT  4
227
273
/// forcing to save JOIN for explain
228
 
static const uint32_t UNCACHEABLE_EXPLAIN= 4;
 
274
#define UNCACHEABLE_EXPLAIN     8
229
275
/** Don't evaluate subqueries in prepare even if they're not correlated */
230
 
static const uint32_t UNCACHEABLE_PREPARE= 5;
 
276
#define UNCACHEABLE_PREPARE    16
231
277
/* For uncorrelated SELECT in an UNION with some correlated SELECTs */
232
 
static const uint32_t UNCACHEABLE_UNITED= 6;
 
278
#define UNCACHEABLE_UNITED     32
233
279
 
234
280
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
235
281
#define UNDEF_POS (-1)
236
282
 
 
283
/* sql_show.cc:show_log_files() */
 
284
#define SHOW_LOG_STATUS_FREE "FREE"
 
285
#define SHOW_LOG_STATUS_INUSE "IN USE"
 
286
 
237
287
/* Options to add_table_to_list() */
238
 
static const uint32_t TL_OPTION_UPDATING= 0;
239
 
static const uint32_t TL_OPTION_FORCE_INDEX= 1;
240
 
static const uint32_t TL_OPTION_IGNORE_LEAVES= 2;
241
 
static const uint32_t TL_OPTION_ALIAS= 3;
242
 
static const uint32_t NUM_OF_TABLE_OPTIONS= 4;
 
288
#define TL_OPTION_UPDATING      1
 
289
#define TL_OPTION_FORCE_INDEX   2
 
290
#define TL_OPTION_IGNORE_LEAVES 4
 
291
#define TL_OPTION_ALIAS         8
243
292
 
244
293
/* Some portable defines */
245
294
 
259
308
 
260
309
#define STRING_BUFFER_USUAL_SIZE 80
261
310
 
 
311
/*
 
312
  Some defines for exit codes for ::is_equal class functions.
 
313
*/
 
314
#define IS_EQUAL_NO 0
 
315
#define IS_EQUAL_YES 1
 
316
#define IS_EQUAL_PACK_LENGTH 2
 
317
 
 
318
 
262
319
typedef void *range_seq_t;
263
320
 
264
321
enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX };
273
330
#define HA_ADMIN_INVALID         -5
274
331
#define HA_ADMIN_REJECT          -6
275
332
 
 
333
#define HA_NOT_DELETE_WITH_CACHE (1 << 18)
 
334
 
276
335
/* bits in index_flags(index_number) for what you can do with index */
277
336
#define HA_READ_NEXT            1       /* TODO really use this flag */
278
337
#define HA_READ_PREV            2       /* supports ::index_prev */
285
344
  set for unordered (e.g. HASH) indexes.
286
345
*/
287
346
#define HA_KEY_SCAN_NOT_ROR     128
 
347
#define HA_DO_INDEX_COND_PUSHDOWN  256 /* Supports Index Condition Pushdown */
288
348
 
289
349
/* operations for disable/enable indexes */
290
350
#define HA_KEY_SWITCH_NONUNIQ      0
346
406
#define HA_CREATE_USED_CHARSET          (1L << 8)
347
407
#define HA_CREATE_USED_DEFAULT_CHARSET  (1L << 9)
348
408
#define HA_CREATE_USED_ROW_FORMAT       (1L << 15)
 
409
#define HA_CREATE_USED_KEY_BLOCK_SIZE   (1L << 19)
 
410
#define HA_CREATE_USED_BLOCK_SIZE       (1L << 22)
 
411
 
 
412
#define MAXGTRIDSIZE 64
 
413
#define MAXBQUALSIZE 64
349
414
 
350
415
/*
351
416
  The below two are not used (and not handled) in this milestone of this WL
386
451
#define HA_MRR_USE_DEFAULT_IMPL 64
387
452
 
388
453
typedef int myf;
389
 
#define MYF(v)          (static_cast<drizzled::myf>(v))
 
454
#define MYF(v)          (myf) (v)
 
455
 
 
456
#define MY_I_S_MAYBE_NULL 1
 
457
#define MY_I_S_UNSIGNED   2
 
458
 
390
459
 
391
460
/*
392
461
   "Declared Type Collation"
409
478
#define MY_COLL_ALLOW_CONV            3
410
479
#define MY_COLL_DISALLOW_NONE         4
411
480
#define MY_COLL_CMP_CONV              7
412
 
 
413
 
inline static void clear_timestamp_auto_bits(enum timestamp_auto_set_type &_target_, 
414
 
                                             const enum timestamp_auto_set_type _bits_)
415
 
{
416
 
  _target_= (enum timestamp_auto_set_type)((int)(_target_) & ~_bits_);
417
 
}
 
481
#define clear_timestamp_auto_bits(_target_, _bits_) \
 
482
  (_target_)= (enum timestamp_auto_set_type)((int)(_target_) & ~(int)(_bits_))
418
483
 
419
484
/*
420
485
 * The following are for the interface with the .frm file
423
488
#define FIELDFLAG_PACK_SHIFT    3
424
489
#define FIELDFLAG_MAX_DEC    31
425
490
 
426
 
#ifdef __cplusplus
427
 
// FIXME: T will just be drizzled::Field::utype, but that would
428
 
// require including field.h. Moving the function elsewhere might be a
429
 
// better idea. Leaving it for restructuring.
430
 
template <typename T> 
431
 
T MTYP_TYPENR(const T& type)
432
 
{
433
 
  return static_cast<T>(type & 127);
434
 
}
435
 
#else
436
491
#define MTYP_TYPENR(type) (type & 127)  /* Remove bits from type */
437
 
#endif
438
 
 
439
 
inline static uint32_t f_settype(const enum enum_field_types x)
440
 
{
441
 
  return (uint32_t(x) << FIELDFLAG_PACK_SHIFT);
442
 
}
 
492
 
 
493
#define f_packtype(x)   (((x) >> FIELDFLAG_PACK_SHIFT) & 15)
 
494
#define f_settype(x)    (((int) x) << FIELDFLAG_PACK_SHIFT)
 
495
 
443
496
 
444
497
#ifdef __cplusplus
445
498
template <class T> void set_if_bigger(T &a, const T &b)
501
554
static const uint32_t ONCE_ALLOC_INIT= 4096;
502
555
/* Typical record cash */
503
556
static const uint32_t RECORD_CACHE_SIZE= 64*1024;
 
557
/* Typical key cash */
 
558
static const uint32_t KEY_CACHE_SIZE= 8*1024*1024;
 
559
 
 
560
/* Default size of a key cache block  */
 
561
static const uint32_t KEY_CACHE_BLOCK_SIZE= 1024;
504
562
 
505
563
 
506
564
/* Some things that this system doesn't have */
507
565
 
508
566
/* Some defines of functions for portability */
509
567
 
 
568
#undef remove    /* Crashes MySQL on SCO 5.0.0 */
510
569
#ifndef uint64_t2double
511
570
#define uint64_t2double(A) ((double) (uint64_t) (A))
512
571
#endif
516
575
#endif
517
576
#define ulong_to_double(X) ((double) (ulong) (X))
518
577
 
 
578
#ifndef STACK_DIRECTION
 
579
#error "please add -DSTACK_DIRECTION=1 or -1 to your CPPFLAGS"
 
580
#endif
 
581
 
519
582
/* From limits.h instead */
520
583
#ifndef DBL_MIN
521
584
#define DBL_MIN    4.94065645841246544e-324
570
633
 
571
634
#define MY_FILEPOS_ERROR  -1
572
635
 
 
636
/* Defines for time function */
 
637
#define SCALE_SEC  100
 
638
#define SCALE_USEC  10000
 
639
 
573
640
#define DRIZZLE_SERVER
574
641
 
575
642
/* Length of decimal number represented by INT32. */
639
706
# define _DTRACE_VERSION 0
640
707
#endif
641
708
 
642
 
typedef uint64_t table_map;   /* Used for table bits in join */
643
 
typedef uint32_t nesting_map; /* Used for flags of nesting constructs */
644
 
 
645
 
} /* namespace drizzled */
646
 
 
647
709
#endif /* DRIZZLED_DEFINITIONS_H */