~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/common.h

  • Committer: Brian Aker
  • Date: 2010-01-22 00:53:13 UTC
  • Revision ID: brian@gaz-20100122005313-jmizcbcdi1lt4tcx
Revert db patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
#define SELECT_NO_JOIN_CACHE    (UINT64_C(1) << 7)     // intern
56
56
#define OPTION_BIG_TABLES       (UINT64_C(1) << 8)     // THD, user
57
57
#define OPTION_BIG_SELECTS      (UINT64_C(1) << 9)     // THD, user
 
58
#define OPTION_LOG_OFF          (UINT64_C(1) << 10)    // THD, user
58
59
#define TMP_TABLE_ALL_COLUMNS   (UINT64_C(1) << 12)    // SELECT, intern
59
60
#define OPTION_WARNINGS         (UINT64_C(1) << 13)    // THD, user
60
61
#define OPTION_AUTO_IS_NULL     (UINT64_C(1) << 14)    // THD, user, binlog
73
74
   key checks in some cases */
74
75
#define OPTION_RELAXED_UNIQUE_CHECKS    (UINT64_C(1) << 27) // THD, user, binlog
75
76
#define SELECT_NO_UNLOCK                (UINT64_C(1) << 28) // SELECT, intern
 
77
#define OPTION_SCHEMA_TABLE             (UINT64_C(1) << 29) // SELECT, intern
76
78
/** Flag set if setup_tables already done */
77
79
#define OPTION_SETUP_TABLES_DONE        (UINT64_C(1) << 30) // intern
78
80
/** If not set then the thread will ignore all warnings with level notes. */
79
81
#define OPTION_SQL_NOTES                (UINT64_C(1) << 31) // THD, user
 
82
/**
 
83
  Force the used temporary table to be a MyISAM table (because we will use
 
84
  fulltext functions when reading from it.
 
85
*/
 
86
#define TMP_TABLE_FORCE_MYISAM          (UINT64_C(1) << 32)
 
87
#define OPTION_PROFILING                (UINT64_C(1) << 33)
 
88
 
 
89
/*
 
90
  Dont report errors for individual rows,
 
91
  But just report error on commit (or read ofcourse)
 
92
*/
 
93
#define OPTION_ALLOW_BATCH              (UINT64_C(1) << 33) // THD, intern (slave)
80
94
 
81
95
/**
82
96
  Maximum length of time zone name that we support
89
103
#define USERNAME_CHAR_LENGTH 16
90
104
#define NAME_CHAR_LEN   64              /* Field/table name length */
91
105
#define NAME_LEN                (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
92
 
#define MAXIMUM_IDENTIFIER_LENGTH NAME_LEN
93
106
#define USERNAME_LENGTH         (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
94
107
 
95
108
#define SERVER_VERSION_LENGTH 60
96
109
#define SQLSTATE_LENGTH 5
97
110
 
98
111
/*
 
112
  Maximum length of comments
 
113
*/
 
114
#define TABLE_COMMENT_MAXLEN 2048
 
115
#define COLUMN_COMMENT_MAXLEN 1024
 
116
#define INDEX_COMMENT_MAXLEN 1024
 
117
 
 
118
/*
99
119
  USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain
100
120
  username and hostname parts of the user identifier with trailing zero in
101
121
  MySQL standard format:
103
123
*/
104
124
#define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2
105
125
 
 
126
#define LOCAL_HOST      "localhost"
 
127
 
106
128
/*
107
129
  You should add new commands to the end of this list, otherwise old
108
130
  servers won't be able to handle them as 'unsupported'.
109
131
*/
110
132
 
 
133
enum enum_server_command
 
134
{
 
135
  COM_SLEEP,
 
136
  COM_QUIT,
 
137
  COM_INIT_DB,
 
138
  COM_QUERY,
 
139
  COM_SHUTDOWN,
 
140
  COM_CONNECT,
 
141
  COM_PING,
 
142
  /* don't forget to update const char *command_name[] in sql_parse.cc */
 
143
  /* Must be last */
 
144
  COM_END
 
145
};
 
146
 
 
147
 
111
148
/*
112
149
  Length of random string sent by server on handshake; this is also length of
113
150
  obfuscated password, recieved from client
126
163
/* The following are only sent to new clients */
127
164
#define ENUM_FLAG       256             /* field is an enum */
128
165
#define AUTO_INCREMENT_FLAG 512         /* field is a autoincrement field */
129
 
#define FUNCTION_DEFAULT_FLAG   1024            /* Field is a timestamp, uses a function to generate the value. */
 
166
#define TIMESTAMP_FLAG  1024            /* Field is a timestamp */
 
167
#define SET_FLAG        2048            /* field is a set */
130
168
#define NO_DEFAULT_VALUE_FLAG 4096      /* Field doesn't have default value */
131
169
#define ON_UPDATE_NOW_FLAG 8192         /* Field is set to NOW on UPDATE */
 
170
#define NUM_FLAG        32768           /* Field is num (for clients) */
132
171
#define PART_KEY_FLAG   16384           /* Intern; Part of some key */
133
172
#define GROUP_FLAG      32768           /* Intern: Group field */
134
173
#define UNIQUE_FLAG     65536           /* Intern: Used by sql_yacc */
135
174
#define BINCMP_FLAG     131072          /* Intern: Used by sql_yacc */
 
175
#define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */
 
176
#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */
 
177
#define FIELD_IN_ADD_INDEX (1<< 20)     /* Intern: Field used in ADD INDEX */
 
178
#define FIELD_IS_RENAMED (1<< 21)       /* Intern: Field is being renamed */
 
179
#define FIELD_STORAGE_FLAGS 22          /* Storage type: bit 22, 23 and 24 */
136
180
#define COLUMN_FORMAT_FLAGS 25          /* Column format: bit 25, 26 and 27 */
137
 
#define COLUMN_FORMAT_MASK 7
 
181
 
 
182
#define REFRESH_LOG             2       /* Start on new log file */
 
183
#define REFRESH_TABLES          4       /* close all tables */
 
184
#define REFRESH_STATUS          16      /* Flush status variables */
 
185
 
 
186
/* The following can't be set with mysql_refresh() */
 
187
#define REFRESH_READ_LOCK       16384   /* Lock tables for read */
 
188
#define REFRESH_FAST            32768   /* Intern flag */
138
189
 
139
190
#define SERVER_STATUS_IN_TRANS     1    /* Transaction has started */
140
191
#define SERVER_STATUS_AUTOCOMMIT   2    /* Server in auto_commit mode */
141
192
#define SERVER_MORE_RESULTS_EXISTS 8    /* Multi query - next query exists */
142
193
#define SERVER_QUERY_NO_GOOD_INDEX_USED 16
143
194
#define SERVER_QUERY_NO_INDEX_USED      32
 
195
/*
 
196
  The server was able to fulfill the clients request and opened a
 
197
  read-only non-scrollable cursor for a query. This flag comes
 
198
  in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands.
 
199
*/
 
200
#define SERVER_STATUS_CURSOR_EXISTS 64
 
201
/*
 
202
  This flag is sent when a read-only cursor is exhausted, in reply to
 
203
  COM_STMT_FETCH command.
 
204
*/
 
205
#define SERVER_STATUS_LAST_ROW_SENT 128
144
206
#define SERVER_STATUS_DB_DROPPED        256 /* A database was dropped */
 
207
#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512
 
208
/*
 
209
  Tell clients that this query was logged to the slow query log.
 
210
  Not yet set in the server, but interface is defined for applications
 
211
  to use.  See WorkLog 4098.
 
212
*/
 
213
#define SERVER_QUERY_WAS_SLOW           1024
145
214
 
146
215
#define DRIZZLE_ERRMSG_SIZE     512
147
216
 
149
218
 
150
219
#define MAX_INT_WIDTH           10      /* Max width for a LONG w.o. sign */
151
220
#define MAX_BIGINT_WIDTH        20      /* Max width for a LONGLONG */
 
221
#define MAX_CHAR_WIDTH          255     /* Max length for a CHAR colum */
152
222
#define MAX_BLOB_WIDTH          (uint32_t)16777216      /* Default width for blob */
153
223
 
154
224
#define DRIZZLE_PROTOCOL_NO_MORE_DATA 0xFE
156
226
 
157
227
 
158
228
 
159
 
#define packet_error UINT32_MAX
160
 
 
161
 
#if defined(__cplusplus)
162
 
 
163
 
namespace drizzled
164
 
{
165
 
 
166
 
enum enum_server_command
167
 
{
168
 
  COM_SLEEP,
169
 
  COM_QUIT,
170
 
  COM_INIT_DB,
171
 
  COM_QUERY,
172
 
  COM_SHUTDOWN,
173
 
  COM_CONNECT,
174
 
  COM_PING,
175
 
  /* don't forget to update const char *command_name[] in sql_parse.cc */
176
 
  /* Must be last */
177
 
  COM_END
178
 
};
179
 
 
180
 
 
181
 
enum enum_field_types { 
182
 
                        DRIZZLE_TYPE_LONG,
 
229
#define packet_error (~(uint32_t) 0)
 
230
 
 
231
 
 
232
/* Shutdown/kill enums and constants */
 
233
 
 
234
/* Bits for THD::killable. */
 
235
#define DRIZZLE_SHUTDOWN_KILLABLE_CONNECT    (unsigned char)(1 << 0)
 
236
#define DRIZZLE_SHUTDOWN_KILLABLE_TRANS      (unsigned char)(1 << 1)
 
237
#define DRIZZLE_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2)
 
238
#define DRIZZLE_SHUTDOWN_KILLABLE_UPDATE     (unsigned char)(1 << 3)
 
239
 
 
240
enum enum_field_types { DRIZZLE_TYPE_LONG,
183
241
                        DRIZZLE_TYPE_DOUBLE,
184
242
                        DRIZZLE_TYPE_NULL,
185
243
                        DRIZZLE_TYPE_TIMESTAMP,
190
248
                        DRIZZLE_TYPE_DECIMAL,
191
249
                        DRIZZLE_TYPE_ENUM,
192
250
                        DRIZZLE_TYPE_BLOB,
193
 
                        DRIZZLE_TYPE_TIME,
194
 
                        DRIZZLE_TYPE_BOOLEAN,
195
 
                        DRIZZLE_TYPE_UUID,
196
 
                        DRIZZLE_TYPE_MICROTIME
 
251
                        DRIZZLE_TYPE_MAX=DRIZZLE_TYPE_BLOB
197
252
};
198
 
const int enum_field_types_size= DRIZZLE_TYPE_MICROTIME + 1;
199
 
 
200
 
} /* namespace drizzled */
201
 
 
202
 
#endif /* defined(__cplusplus) */
 
253
 
 
254
 
 
255
  /* The following is for user defined functions */
 
256
 
 
257
enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT,
 
258
                  DECIMAL_RESULT};
 
259
 
203
260
 
204
261
#endif /* DRIZZLED_COMMON_H */