~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/unireg.h

pandora-build v0.71. Added check for avahi.

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