~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/common.h

Does not work (compile issue in plugin).

Show diffs side-by-side

added added

removed removed

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