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
61
62
#define OPTION_FOUND_COMMENT (UINT64_C(1) << 15) // SELECT, intern, parser
63
#define OPTION_SAFE_UPDATES (UINT64_C(1) << 16) // THD, user
62
64
#define OPTION_BUFFER_RESULT (UINT64_C(1) << 17) // SELECT, user
63
65
#define OPTION_NOT_AUTOCOMMIT (UINT64_C(1) << 19) // THD, user
64
66
#define OPTION_BEGIN (UINT64_C(1) << 20) // THD, intern
67
#define OPTION_QUICK (UINT64_C(1) << 22) // SELECT (for DELETE)
68
#define OPTION_KEEP_LOG (UINT64_C(1) << 23) // THD, user
66
70
/* The following is used to detect a conflict with DISTINCT */
67
71
#define SELECT_ALL (UINT64_C(1) << 24) // SELECT, user, parser
73
77
key checks in some cases */
74
78
#define OPTION_RELAXED_UNIQUE_CHECKS (UINT64_C(1) << 27) // THD, user, binlog
75
79
#define SELECT_NO_UNLOCK (UINT64_C(1) << 28) // SELECT, intern
80
#define OPTION_SCHEMA_TABLE (UINT64_C(1) << 29) // SELECT, intern
76
81
/** Flag set if setup_tables already done */
77
82
#define OPTION_SETUP_TABLES_DONE (UINT64_C(1) << 30) // intern
78
83
/** If not set then the thread will ignore all warnings with level notes. */
79
84
#define OPTION_SQL_NOTES (UINT64_C(1) << 31) // THD, user
86
Force the used temporary table to be a MyISAM table (because we will use
87
fulltext functions when reading from it.
89
#define TMP_TABLE_FORCE_MYISAM (UINT64_C(1) << 32)
90
#define OPTION_PROFILING (UINT64_C(1) << 33)
93
Dont report errors for individual rows,
94
But just report error on commit (or read ofcourse)
96
#define OPTION_ALLOW_BATCH (UINT64_C(1) << 33) // THD, intern (slave)
82
99
Maximum length of time zone name that we support
89
106
#define USERNAME_CHAR_LENGTH 16
90
107
#define NAME_CHAR_LEN 64 /* Field/table name length */
91
108
#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
92
#define MAXIMUM_IDENTIFIER_LENGTH NAME_LEN
93
109
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
95
111
#define SERVER_VERSION_LENGTH 60
96
112
#define SQLSTATE_LENGTH 5
115
Maximum length of comments
117
#define TABLE_COMMENT_MAXLEN 2048
118
#define COLUMN_COMMENT_MAXLEN 1024
119
#define INDEX_COMMENT_MAXLEN 1024
99
122
USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain
100
123
username and hostname parts of the user identifier with trailing zero in
101
124
MySQL standard format:
104
127
#define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2
129
#define LOCAL_HOST "localhost"
130
#define LOCAL_HOST_NAMEDPIPE "."
107
133
You should add new commands to the end of this list, otherwise old
108
134
servers won't be able to handle them as 'unsupported'.
137
enum enum_server_command
146
/* don't forget to update const char *command_name[] in sql_parse.cc */
112
153
Length of random string sent by server on handshake; this is also length of
113
154
obfuscated password, recieved from client
115
156
#define SCRAMBLE_LENGTH 20
116
157
#define SCRAMBLE_LENGTH_323 8
158
/* length of password stored in the db: new passwords are preceeded with '*' */
159
#define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH*2+1)
160
#define SCRAMBLED_PASSWORD_CHAR_LENGTH_323 (SCRAMBLE_LENGTH_323*2)
118
163
#define NOT_NULL_FLAG 1 /* Field can't be NULL */
119
164
#define PRI_KEY_FLAG 2 /* Field is part of a primary key */
121
166
#define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */
122
167
#define BLOB_FLAG 16 /* Field is a blob */
123
168
#define UNSIGNED_FLAG 32 /* Field is unsigned */
169
#define DECIMAL_FLAG 64 /* Field is zerofill */
124
170
#define BINARY_FLAG 128 /* Field is binary */
126
172
/* The following are only sent to new clients */
127
173
#define ENUM_FLAG 256 /* field is an enum */
128
174
#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. */
175
#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */
176
#define SET_FLAG 2048 /* field is a set */
130
177
#define NO_DEFAULT_VALUE_FLAG 4096 /* Field doesn't have default value */
131
178
#define ON_UPDATE_NOW_FLAG 8192 /* Field is set to NOW on UPDATE */
179
#define NUM_FLAG 32768 /* Field is num (for clients) */
132
180
#define PART_KEY_FLAG 16384 /* Intern; Part of some key */
133
181
#define GROUP_FLAG 32768 /* Intern: Group field */
134
182
#define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */
135
183
#define BINCMP_FLAG 131072 /* Intern: Used by sql_yacc */
184
#define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */
185
#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */
186
#define FIELD_IN_ADD_INDEX (1<< 20) /* Intern: Field used in ADD INDEX */
187
#define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */
188
#define FIELD_STORAGE_FLAGS 22 /* Storage type: bit 22, 23 and 24 */
136
189
#define COLUMN_FORMAT_FLAGS 25 /* Column format: bit 25, 26 and 27 */
137
#define COLUMN_FORMAT_MASK 7
191
#define REFRESH_LOG 2 /* Start on new log file */
192
#define REFRESH_TABLES 4 /* close all tables */
193
#define REFRESH_STATUS 16 /* Flush status variables */
195
/* The following can't be set with mysql_refresh() */
196
#define REFRESH_READ_LOCK 16384 /* Lock tables for read */
197
#define REFRESH_FAST 32768 /* Intern flag */
139
199
#define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */
140
200
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
141
201
#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */
142
202
#define SERVER_QUERY_NO_GOOD_INDEX_USED 16
143
203
#define SERVER_QUERY_NO_INDEX_USED 32
205
The server was able to fulfill the clients request and opened a
206
read-only non-scrollable cursor for a query. This flag comes
207
in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands.
209
#define SERVER_STATUS_CURSOR_EXISTS 64
211
This flag is sent when a read-only cursor is exhausted, in reply to
212
COM_STMT_FETCH command.
214
#define SERVER_STATUS_LAST_ROW_SENT 128
144
215
#define SERVER_STATUS_DB_DROPPED 256 /* A database was dropped */
216
#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512
218
Tell clients that this query was logged to the slow query log.
219
Not yet set in the server, but interface is defined for applications
220
to use. See WorkLog 4098.
222
#define SERVER_QUERY_WAS_SLOW 1024
146
224
#define DRIZZLE_ERRMSG_SIZE 512
148
226
#define ONLY_KILL_QUERY 1
228
#define MAX_TINYINT_WIDTH 3 /* Max width for a TINY w.o. sign */
229
#define MAX_SMALLINT_WIDTH 5 /* Max width for a SHORT w.o. sign */
230
#define MAX_MEDIUMINT_WIDTH 8 /* Max width for a INT24 w.o. sign */
150
231
#define MAX_INT_WIDTH 10 /* Max width for a LONG w.o. sign */
151
232
#define MAX_BIGINT_WIDTH 20 /* Max width for a LONGLONG */
233
#define MAX_CHAR_WIDTH 255 /* Max length for a CHAR colum */
152
234
#define MAX_BLOB_WIDTH (uint32_t)16777216 /* Default width for blob */
154
236
#define DRIZZLE_PROTOCOL_NO_MORE_DATA 0xFE
159
#define packet_error UINT32_MAX
161
#if defined(__cplusplus)
166
enum enum_server_command
175
/* don't forget to update const char *command_name[] in sql_parse.cc */
181
enum enum_field_types {
241
#define packet_error (~(uint32_t) 0)
244
/* Shutdown/kill enums and constants */
246
/* Bits for THD::killable. */
247
#define DRIZZLE_SHUTDOWN_KILLABLE_CONNECT (unsigned char)(1 << 0)
248
#define DRIZZLE_SHUTDOWN_KILLABLE_TRANS (unsigned char)(1 << 1)
249
#define DRIZZLE_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2)
250
#define DRIZZLE_SHUTDOWN_KILLABLE_UPDATE (unsigned char)(1 << 3)
252
/* Start TINY at 1 because we removed DECIMAL from off the front of the enum */
253
enum enum_field_types { DRIZZLE_TYPE_TINY,
182
254
DRIZZLE_TYPE_LONG,
183
255
DRIZZLE_TYPE_DOUBLE,
184
256
DRIZZLE_TYPE_NULL,
187
259
DRIZZLE_TYPE_DATETIME,
188
260
DRIZZLE_TYPE_DATE,
189
261
DRIZZLE_TYPE_VARCHAR,
190
DRIZZLE_TYPE_DECIMAL,
262
DRIZZLE_TYPE_NEWDECIMAL,
191
263
DRIZZLE_TYPE_ENUM,
192
264
DRIZZLE_TYPE_BLOB,
194
DRIZZLE_TYPE_BOOLEAN,
196
DRIZZLE_TYPE_MICROTIME
265
DRIZZLE_TYPE_MAX=DRIZZLE_TYPE_BLOB
198
const int enum_field_types_size= DRIZZLE_TYPE_MICROTIME + 1;
200
} /* namespace drizzled */
202
#endif /* defined(__cplusplus) */
204
#endif /* DRIZZLED_COMMON_H */
269
/* The following is for user defined functions */
271
enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT,
274
typedef struct st_udf_args
276
unsigned int arg_count; /* Number of arguments */
277
enum Item_result *arg_type; /* Pointer to item_results */
278
char **args; /* Pointer to argument */
279
unsigned long *lengths; /* Length of string arguments */
280
char *maybe_null; /* Set to 1 for all maybe_null args */
281
char **attributes; /* Pointer to attribute name */
282
unsigned long *attribute_lengths; /* Length of attribute arguments */
286
/* This holds information about the result */
288
typedef struct st_udf_init
290
bool maybe_null; /* 1 if function can return NULL */
291
unsigned int decimals; /* for real functions */
292
unsigned long max_length; /* For string functions */
293
char *ptr; /* free pointer for function data */
294
bool const_item; /* 1 if function always returns the same value */
298
TODO: add a notion for determinism of the UDF.
299
See Item_udf_func::update_used_tables ()
302
/* Constants when using compression */
303
#define NET_HEADER_SIZE 4 /* standard header size */
304
#define COMP_HEADER_SIZE 3 /* compression header extra size */