~stewart/drizzle/embedded-innodb-create-select-transaction-arrgh

« back to all changes in this revision

Viewing changes to sql/unireg.h

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2000-2006 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
 
 
17
/*  Extra functions used by unireg library */
 
18
 
 
19
#ifndef _unireg_h
 
20
 
 
21
#ifndef NO_ALARM_LOOP
 
22
#define NO_ALARM_LOOP           /* lib5 and popen can't use alarm */
 
23
#endif
 
24
 
 
25
/* These paths are converted to other systems (WIN95) before use */
 
26
 
 
27
#define LANGUAGE        "english/"
 
28
#define ERRMSG_FILE     "errmsg.sys"
 
29
#define TEMP_PREFIX     "MY"
 
30
#define LOG_PREFIX      "ML"
 
31
#define PROGDIR         "bin/"
 
32
#ifndef DATADIR
 
33
#define DATADIR         "data/"
 
34
#endif
 
35
#ifndef SHAREDIR
 
36
#define SHAREDIR        "share/"
 
37
#endif
 
38
#ifndef PLUGINDIR
 
39
#define PLUGINDIR       "lib/plugin"
 
40
#endif
 
41
 
 
42
#define ER(X) errmesg[(X) - ER_ERROR_FIRST]
 
43
#define ER_SAFE(X) (((X) >= ER_ERROR_FIRST && (X) <= ER_ERROR_LAST) ? ER(X) : "Invalid error code")
 
44
 
 
45
 
 
46
#define ERRMAPP 1                               /* Errormap f|r my_error */
 
47
#define LIBLEN FN_REFLEN-FN_LEN                 /* Max l{ngd p} dev */
 
48
/* extra 4+4 bytes for slave tmp tables */
 
49
#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
 
50
#define MAX_ALIAS_NAME 256
 
51
#define MAX_FIELD_NAME 34                       /* Max colum name length +2 */
 
52
#define MAX_SYS_VAR_LENGTH 32
 
53
#define MAX_KEY MAX_INDEXES                     /* Max used keys */
 
54
#define MAX_REF_PARTS 16                        /* Max parts used as ref */
 
55
#define MAX_KEY_LENGTH 4096                     /* max possible key */
 
56
#define MAX_KEY_LENGTH_DECIMAL_WIDTH 4          /* strlen("4096") */
 
57
#if SIZEOF_OFF_T > 4
 
58
#define MAX_REFLENGTH 8                         /* Max length for record ref */
 
59
#else
 
60
#define MAX_REFLENGTH 4                         /* Max length for record ref */
 
61
#endif
 
62
#define MAX_HOSTNAME  61                        /* len+1 in mysql.user */
 
63
 
 
64
#define MAX_MBWIDTH             4               /* Max multibyte sequence */
 
65
#define MAX_FIELD_CHARLENGTH    255
 
66
#define MAX_FIELD_VARCHARLENGTH 65535
 
67
#define CONVERT_IF_BIGGER_TO_BLOB 512           /* Used for CREATE ... SELECT */
 
68
 
 
69
/* Max column width +1 */
 
70
#define MAX_FIELD_WIDTH         (MAX_FIELD_CHARLENGTH*MAX_MBWIDTH+1)
 
71
 
 
72
#define MAX_BIT_FIELD_LENGTH    64      /* Max length in bits for bit fields */
 
73
 
 
74
#define MAX_DATE_WIDTH          10      /* YYYY-MM-DD */
 
75
#define MAX_TIME_WIDTH          23      /* -DDDDDD HH:MM:SS.###### */
 
76
#define MAX_DATETIME_FULL_WIDTH 29      /* YYYY-MM-DD HH:MM:SS.###### AM */
 
77
#define MAX_DATETIME_WIDTH      19      /* YYYY-MM-DD HH:MM:SS */
 
78
#define MAX_DATETIME_COMPRESSED_WIDTH 14  /* YYYYMMDDHHMMSS */
 
79
 
 
80
#define MAX_TABLES      (sizeof(table_map)*8-3) /* Max tables in join */
 
81
#define PARAM_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-3))
 
82
#define OUTER_REF_TABLE_BIT     (((table_map) 1) << (sizeof(table_map)*8-2))
 
83
#define RAND_TABLE_BIT  (((table_map) 1) << (sizeof(table_map)*8-1))
 
84
#define PSEUDO_TABLE_BITS (PARAM_TABLE_BIT | OUTER_REF_TABLE_BIT | \
 
85
                           RAND_TABLE_BIT)
 
86
#define MAX_FIELDS      4096                    /* Limit in the .frm file */
 
87
 
 
88
#define MAX_SELECT_NESTING (sizeof(nesting_map)*8-1)
 
89
 
 
90
#define MAX_SORT_MEMORY (2048*1024-MALLOC_OVERHEAD)
 
91
#define MIN_SORT_MEMORY (32*1024-MALLOC_OVERHEAD)
 
92
 
 
93
/* Memory allocated when parsing a statement / saving a statement */
 
94
#define MEM_ROOT_BLOCK_SIZE       8192
 
95
#define MEM_ROOT_PREALLOC         8192
 
96
#define TRANS_MEM_ROOT_BLOCK_SIZE 4096
 
97
#define TRANS_MEM_ROOT_PREALLOC   4096
 
98
 
 
99
#define DEFAULT_ERROR_COUNT     64
 
100
#define EXTRA_RECORDS   10                      /* Extra records in sort */
 
101
#define SCROLL_EXTRA    5                       /* Extra scroll-rows. */
 
102
#define FIELD_NAME_USED ((uint) 32768)          /* Bit set if fieldname used */
 
103
#define FORM_NAME_USED  ((uint) 16384)          /* Bit set if formname used */
 
104
#define FIELD_NR_MASK   16383                   /* To get fieldnumber */
 
105
#define FERR            -1                      /* Error from my_functions */
 
106
#define CREATE_MODE     0                       /* Default mode on new files */
 
107
#define NAMES_SEP_CHAR  '\377'                  /* Char to sep. names */
 
108
 
 
109
#define READ_RECORD_BUFFER      (uint) (IO_SIZE*8) /* Pointer_buffer_size */
 
110
#define DISK_BUFFER_SIZE        (uint) (IO_SIZE*16) /* Size of diskbuffer */
 
111
 
 
112
#define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH)
 
113
#define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH)
 
114
#define MYF_RW MYF(MY_WME+MY_NABP)              /* Vid my_read & my_write */
 
115
 
 
116
#define SPECIAL_USE_LOCKS       1               /* Lock used databases */
 
117
#define SPECIAL_NO_NEW_FUNC     2               /* Skip new functions */
 
118
#define SPECIAL_SKIP_SHOW_DB    4               /* Don't allow 'show db' */
 
119
#define SPECIAL_WAIT_IF_LOCKED  8               /* Wait if locked database */
 
120
#define SPECIAL_SAME_DB_NAME   16               /* form name = file name */
 
121
#define SPECIAL_ENGLISH        32               /* English error messages */
 
122
#define SPECIAL_NO_RESOLVE     64               /* Don't use gethostname */
 
123
#define SPECIAL_NO_PRIOR        128             /* Don't prioritize threads */
 
124
#define SPECIAL_BIG_SELECTS     256             /* Don't use heap tables */
 
125
#define SPECIAL_NO_HOST_CACHE   512             /* Don't cache hosts */
 
126
#define SPECIAL_SHORT_LOG_FORMAT 1024
 
127
#define SPECIAL_SAFE_MODE       2048
 
128
#define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Obsolete */
 
129
 
 
130
        /* Extern defines */
 
131
#define store_record(A,B) bmove_align((A)->B,(A)->record[0],(size_t) (A)->s->reclength)
 
132
#define restore_record(A,B) bmove_align((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
 
133
#define cmp_record(A,B) memcmp((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
 
134
#define empty_record(A) { \
 
135
                          restore_record((A),s->default_values); \
 
136
                          bfill((A)->null_flags,(A)->s->null_bytes,255);\
 
137
                        }
 
138
 
 
139
        /* Defines for use with openfrm, openprt and openfrd */
 
140
 
 
141
#define READ_ALL                1       /* openfrm: Read all parameters */
 
142
#define CHANGE_FRM              2       /* openfrm: open .frm as O_RDWR */
 
143
#define READ_KEYINFO            4       /* L{s nyckeldata fr}n filen */
 
144
#define EXTRA_RECORD            8       /* Reservera plats f|r extra record */
 
145
#define DONT_OPEN_TABLES        8       /* Don't open database-files (frd) */
 
146
#define DONT_OPEN_MASTER_REG    16      /* Don't open first reg-file (prt) */
 
147
#define EXTRA_LONG_RECORD       16      /* Plats f|r dubbel s|k-record */
 
148
#define COMPUTE_TYPES           32      /* Kontrollera type f|r f{ltena */
 
149
#define SEARCH_PRG              64      /* S|k efter registret i 'prg_dev' */
 
150
#define READ_USED_NAMES         128     /* L{s anv{nda formul{rnamn */
 
151
#define DONT_GIVE_ERROR         256     /* Don't do frm_error on openfrm  */
 
152
#define READ_SCREENS            1024    /* Read screens, info and helpfile */
 
153
#define DELAYED_OPEN            4096    /* Open table later */
 
154
#define OPEN_VIEW               8192    /* Allow open on view */
 
155
#define OPEN_VIEW_NO_PARSE     16384    /* Open frm only if it's a view,
 
156
                                           but do not parse view itself */
 
157
/**
 
158
  This flag is used in function get_all_tables() which fills
 
159
  I_S tables with data which are retrieved from frm files and storage engine
 
160
  The flag means that we need to open FRM file only to get necessary data.
 
161
*/
 
162
#define OPEN_FRM_FILE_ONLY     32768
 
163
/**
 
164
  This flag is used in function get_all_tables() which fills
 
165
  I_S tables with data which are retrieved from frm files and storage engine
 
166
  The flag means that we need to process tables only to get necessary data.
 
167
  Views are not processed.
 
168
*/
 
169
#define OPEN_TABLE_ONLY        OPEN_FRM_FILE_ONLY*2
 
170
/**
 
171
  This flag is used in function get_all_tables() which fills
 
172
  I_S tables with data which are retrieved from frm files and storage engine
 
173
  The flag means that we need to process views only to get necessary data.
 
174
  Tables are not processed.
 
175
*/
 
176
#define OPEN_VIEW_ONLY         OPEN_TABLE_ONLY*2
 
177
/**
 
178
  This flag is used in function get_all_tables() which fills
 
179
  I_S tables with data which are retrieved from frm files and storage engine.
 
180
  The flag means that we need to open a view using
 
181
  open_normal_and_derived_tables() function.
 
182
*/
 
183
#define OPEN_VIEW_FULL         OPEN_VIEW_ONLY*2
 
184
/**
 
185
  This flag is used in function get_all_tables() which fills
 
186
  I_S tables with data which are retrieved from frm files and storage engine.
 
187
  The flag means that I_S table uses optimization algorithm.
 
188
*/
 
189
#define OPTIMIZE_I_S_TABLE     OPEN_VIEW_FULL*2
 
190
 
 
191
/*
 
192
  The flag means that we need to process trigger files only.
 
193
*/
 
194
#define OPEN_TRIGGER_ONLY      OPTIMIZE_I_S_TABLE*2
 
195
 
 
196
#define SC_INFO_LENGTH 4                /* Form format constant */
 
197
#define TE_INFO_LENGTH 3
 
198
#define MTYP_NOEMPTY_BIT 128
 
199
 
 
200
#define FRM_VER_TRUE_VARCHAR (FRM_VER+4) /* 10 */
 
201
#define MYSQL_VERSION_TABLESPACE_IN_FRM_CGE 50120
 
202
#define MYSQL_VERSION_TABLESPACE_IN_FRM 50205
 
203
#define MYSQL_VERSION_TABLESPACE_IN_FRM_STR "50205"
 
204
 
 
205
/*
 
206
  Minimum length pattern before Turbo Boyer-Moore is used
 
207
  for SELECT "text" LIKE "%pattern%", excluding the two
 
208
  wildcards in class Item_func_like.
 
209
*/
 
210
#define MIN_TURBOBM_PATTERN_LEN 3
 
211
 
 
212
/* 
 
213
   Defines for binary logging.
 
214
   Do not decrease the value of BIN_LOG_HEADER_SIZE.
 
215
   Do not even increase it before checking code.
 
216
*/
 
217
 
 
218
#define BIN_LOG_HEADER_SIZE    4 
 
219
 
 
220
#define DEFAULT_KEY_CACHE_NAME "default"
 
221
 
 
222
#define STORAGE_TYPE_MASK 7
 
223
#define COLUMN_FORMAT_MASK 7
 
224
#define COLUMN_FORMAT_SHIFT 3
 
225
 
 
226
/* Include prototypes for unireg */
 
227
 
 
228
#include "mysqld_error.h"
 
229
#include "structs.h"                            /* All structs we need */
 
230
 
 
231
#endif