~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle-2.0/constants.h

  • Committer: Mark Atwood
  • Date: 2011-11-14 07:30:41 UTC
  • Revision ID: me@mark.atwood.name-20111114073041-mo2hgg8ouseo2kpu
releaseĀ 2011.11.29

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 * @brief Defines, typedefs, enums, and macros
43
43
 */
44
44
 
 
45
#include <stdint.h>
 
46
 
45
47
#ifdef __cplusplus
46
48
 
47
49
#include <vector>
58
60
 */
59
61
 
60
62
/* Defines. */
61
 
#define DRIZZLE_DEFAULT_TCP_HOST         "localhost"
 
63
#define DRIZZLE_DEFAULT_TCP_HOST         "127.0.0.1"
62
64
#define DRIZZLE_DEFAULT_TCP_PORT         4427
63
65
#define DRIZZLE_DEFAULT_TCP_PORT_MYSQL   4427
64
66
#define DRIZZLE_DEFAULT_UDS              "/tmp/drizzle.sock"
65
67
#define DRIZZLE_DEFAULT_UDS_MYSQL        "/tmp/mysql.sock"
66
68
#define DRIZZLE_DEFAULT_BACKLOG          64
 
69
#define DRIZZLE_MAX_ERROR_SIZE           2048
 
70
#define DRIZZLE_MAX_USER_SIZE            64
 
71
#define DRIZZLE_MAX_PASSWORD_SIZE        32
 
72
#define DRIZZLE_MAX_DB_SIZE              64
 
73
#define DRIZZLE_MAX_INFO_SIZE            2048
 
74
#define DRIZZLE_MAX_SQLSTATE_SIZE        5
 
75
#define DRIZZLE_MAX_CATALOG_SIZE         128
 
76
#define DRIZZLE_MAX_TABLE_SIZE           128
 
77
#define DRIZZLE_MAX_COLUMN_NAME_SIZE     2048
 
78
#define DRIZZLE_MAX_DEFAULT_VALUE_SIZE   2048
 
79
#define DRIZZLE_MAX_PACKET_SIZE          UINT32_MAX
 
80
#define DRIZZLE_MAX_BUFFER_SIZE          32768
67
81
#define DRIZZLE_BUFFER_COPY_THRESHOLD    8192
 
82
#define DRIZZLE_MAX_SERVER_VERSION_SIZE  32
 
83
#define DRIZZLE_MAX_SERVER_EXTRA_SIZE    32
 
84
#define DRIZZLE_MAX_SCRAMBLE_SIZE        20
 
85
#define DRIZZLE_STATE_STACK_SIZE         8
68
86
#define DRIZZLE_ROW_GROW_SIZE            8192
69
 
#define DRIZZLE_STATE_STACK_SIZE         8
70
87
#define DRIZZLE_DEFAULT_SOCKET_TIMEOUT   10
71
88
#define DRIZZLE_DEFAULT_SOCKET_SEND_SIZE 32768
72
89
#define DRIZZLE_DEFAULT_SOCKET_RECV_SIZE 32768
73
90
#define DRIZZLE_MYSQL_PASSWORD_HASH      41
74
91
 
75
 
#include <libdrizzle-2.0/deprecated_enum.h>
76
 
#include <libdrizzle-2.0/return.h>
77
 
#include <libdrizzle-2.0/command.h>
78
 
#include <libdrizzle-2.0/verbose.h>
79
 
#include <libdrizzle-2.0/limits.h>
 
92
/**
 
93
 * Return codes.
 
94
 */
 
95
enum drizzle_return_t
 
96
{
 
97
  DRIZZLE_RETURN_OK,
 
98
  DRIZZLE_RETURN_IO_WAIT,
 
99
  DRIZZLE_RETURN_PAUSE,
 
100
  DRIZZLE_RETURN_ROW_BREAK,
 
101
  DRIZZLE_RETURN_MEMORY,
 
102
  DRIZZLE_RETURN_ERRNO,
 
103
  DRIZZLE_RETURN_INTERNAL_ERROR,
 
104
  DRIZZLE_RETURN_GETADDRINFO,
 
105
  DRIZZLE_RETURN_NOT_READY,
 
106
  DRIZZLE_RETURN_BAD_PACKET_NUMBER,
 
107
  DRIZZLE_RETURN_BAD_HANDSHAKE_PACKET,
 
108
  DRIZZLE_RETURN_BAD_PACKET,
 
109
  DRIZZLE_RETURN_PROTOCOL_NOT_SUPPORTED,
 
110
  DRIZZLE_RETURN_UNEXPECTED_DATA,
 
111
  DRIZZLE_RETURN_NO_SCRAMBLE,
 
112
  DRIZZLE_RETURN_AUTH_FAILED,
 
113
  DRIZZLE_RETURN_NULL_SIZE,
 
114
  DRIZZLE_RETURN_ERROR_CODE,
 
115
  DRIZZLE_RETURN_TOO_MANY_COLUMNS,
 
116
  DRIZZLE_RETURN_ROW_END,
 
117
  DRIZZLE_RETURN_LOST_CONNECTION,
 
118
  DRIZZLE_RETURN_COULD_NOT_CONNECT,
 
119
  DRIZZLE_RETURN_NO_ACTIVE_CONNECTIONS,
 
120
  DRIZZLE_RETURN_HANDSHAKE_FAILED,
 
121
  DRIZZLE_RETURN_TIMEOUT,
 
122
  DRIZZLE_RETURN_INVALID_ARGUMENT,
 
123
  DRIZZLE_RETURN_MAX /* Always add new codes to the end before this one. */
 
124
};
 
125
 
 
126
#ifndef __cplusplus
 
127
typedef enum drizzle_return_t drizzle_return_t
 
128
#endif
 
129
 
 
130
/**
 
131
 * Verbosity levels.
 
132
 */
 
133
enum drizzle_verbose_t
 
134
{
 
135
  DRIZZLE_VERBOSE_NEVER,
 
136
  DRIZZLE_VERBOSE_FATAL,
 
137
  DRIZZLE_VERBOSE_ERROR,
 
138
  DRIZZLE_VERBOSE_INFO,
 
139
  DRIZZLE_VERBOSE_DEBUG,
 
140
  DRIZZLE_VERBOSE_CRAZY,
 
141
  DRIZZLE_VERBOSE_MAX
 
142
};
 
143
 
 
144
#ifndef __cplusplus
 
145
typedef enum drizzle_verbose_t drizzle_verbose_t;
 
146
#endif
80
147
 
81
148
/** @} */
82
149
 
83
150
/**
 
151
 * @ingroup drizzle
 
152
 * Options for drizzle_st.
 
153
 */
 
154
enum drizzle_options_t
 
155
{
 
156
  DRIZZLE_NONE=            0,
 
157
  DRIZZLE_ALLOCATED=       (1 << 0),
 
158
  DRIZZLE_NON_BLOCKING=    (1 << 1),
 
159
  DRIZZLE_FREE_OBJECTS=    (1 << 2),
 
160
  DRIZZLE_ASSERT_DANGLING= (1 << 3)
 
161
};
 
162
 
 
163
#ifndef __cplusplus
 
164
typedef enum drizzle_options_t drizzle_options_t;
 
165
#endif
 
166
 
 
167
/**
84
168
 * @ingroup drizzle_con
85
169
 * Options for drizzle_con_st.
86
170
 */
87
171
enum drizzle_con_options_t
88
172
{
89
173
  DRIZZLE_CON_NONE=             0,
90
 
  DRIZZLE_CON_ALLOCATED=        (1 << 0), // DEPRECATED
 
174
  DRIZZLE_CON_ALLOCATED=        (1 << 0),
91
175
  DRIZZLE_CON_MYSQL=            (1 << 1),
92
176
  DRIZZLE_CON_RAW_PACKET=       (1 << 2),
93
177
  DRIZZLE_CON_RAW_SCRAMBLE=     (1 << 3),
112
196
 */
113
197
enum drizzle_con_socket_t
114
198
{
115
 
  DRIZZLE_CON_SOCKET_TCP,
116
 
  DRIZZLE_CON_SOCKET_UDS
 
199
  DRIZZLE_CON_SOCKET_TCP= 0,
 
200
  DRIZZLE_CON_SOCKET_UDS= (1 << 0)
117
201
};
118
202
 
119
203
#ifndef __cplusplus
187
271
#endif
188
272
 
189
273
/**
 
274
 * @ingroup drizzle_command 
 
275
 * Commands for drizzle_command functions.
 
276
 */
 
277
enum drizzle_command_t
 
278
{
 
279
  DRIZZLE_COMMAND_SLEEP,               /* Not used currently. */
 
280
  DRIZZLE_COMMAND_QUIT,
 
281
  DRIZZLE_COMMAND_INIT_DB,
 
282
  DRIZZLE_COMMAND_QUERY,
 
283
  DRIZZLE_COMMAND_FIELD_LIST,          /* Deprecated. */
 
284
  DRIZZLE_COMMAND_CREATE_DB,           /* Deprecated. */
 
285
  DRIZZLE_COMMAND_DROP_DB,             /* Deprecated. */
 
286
  DRIZZLE_COMMAND_REFRESH,
 
287
  DRIZZLE_COMMAND_SHUTDOWN,
 
288
  DRIZZLE_COMMAND_STATISTICS,
 
289
  DRIZZLE_COMMAND_PROCESS_INFO,        /* Deprecated. */
 
290
  DRIZZLE_COMMAND_CONNECT,             /* Not used currently. */
 
291
  DRIZZLE_COMMAND_PROCESS_KILL,        /* Deprecated. */
 
292
  DRIZZLE_COMMAND_DEBUG,
 
293
  DRIZZLE_COMMAND_PING,
 
294
  DRIZZLE_COMMAND_TIME,                /* Not used currently. */
 
295
  DRIZZLE_COMMAND_DELAYED_INSERT,      /* Not used currently. */
 
296
  DRIZZLE_COMMAND_CHANGE_USER,
 
297
  DRIZZLE_COMMAND_BINLOG_DUMP,         /* Not used currently. */
 
298
  DRIZZLE_COMMAND_TABLE_DUMP,          /* Not used currently. */
 
299
  DRIZZLE_COMMAND_CONNECT_OUT,         /* Not used currently. */
 
300
  DRIZZLE_COMMAND_REGISTER_SLAVE,      /* Not used currently. */
 
301
  DRIZZLE_COMMAND_STMT_PREPARE,        /* Not used currently. */
 
302
  DRIZZLE_COMMAND_STMT_EXECUTE,        /* Not used currently. */
 
303
  DRIZZLE_COMMAND_STMT_SEND_LONG_DATA, /* Not used currently. */
 
304
  DRIZZLE_COMMAND_STMT_CLOSE,          /* Not used currently. */
 
305
  DRIZZLE_COMMAND_STMT_RESET,          /* Not used currently. */
 
306
  DRIZZLE_COMMAND_SET_OPTION,          /* Not used currently. */
 
307
  DRIZZLE_COMMAND_STMT_FETCH,          /* Not used currently. */
 
308
  DRIZZLE_COMMAND_DAEMON,              /* Not used currently. */
 
309
  DRIZZLE_COMMAND_END                  /* Not used currently. */
 
310
};
 
311
 
 
312
#ifndef __cplusplus
 
313
typedef enum drizzle_command_t drizzle_command_t;
 
314
#endif
 
315
 
 
316
/**
 
317
 * @ingroup drizzle_command 
 
318
 * Commands for the Drizzle protocol functions.
 
319
 */
 
320
enum drizzle_command_drizzle_t
 
321
{
 
322
  DRIZZLE_COMMAND_DRIZZLE_SLEEP,
 
323
  DRIZZLE_COMMAND_DRIZZLE_QUIT,
 
324
  DRIZZLE_COMMAND_DRIZZLE_INIT_DB,
 
325
  DRIZZLE_COMMAND_DRIZZLE_QUERY,
 
326
  DRIZZLE_COMMAND_DRIZZLE_SHUTDOWN,
 
327
  DRIZZLE_COMMAND_DRIZZLE_CONNECT,
 
328
  DRIZZLE_COMMAND_DRIZZLE_PING,
 
329
  DRIZZLE_COMMAND_DRIZZLE_KILL,
 
330
  DRIZZLE_COMMAND_DRIZZLE_END
 
331
};
 
332
 
 
333
#ifndef __cplusplus
 
334
typedef enum drizzle_command_drizzle_t drizzle_command_drizzle_t;
 
335
#endif
 
336
 
 
337
/**
 
338
 * @ingroup drizzle_query
 
339
 * Options for drizzle_query_st.
 
340
 */
 
341
enum drizzle_query_options_t
 
342
{
 
343
  DRIZZLE_QUERY_NONE,
 
344
  DRIZZLE_QUERY_ALLOCATED= (1 << 0)
 
345
};
 
346
 
 
347
#ifndef __cplusplus
 
348
typedef enum drizzle_query_options_t drizzle_query_options_t;
 
349
#endif
 
350
 
 
351
/**
190
352
 * @ingroup drizzle_query
191
353
 * States for drizle_query_st.
192
354
 */
209
371
enum drizzle_result_options_t
210
372
{
211
373
  DRIZZLE_RESULT_NONE=          0,
212
 
  DRIZZLE_RESULT_ALLOCATED=     (1 << 0), // DEPRECATED
 
374
  DRIZZLE_RESULT_ALLOCATED=     (1 << 0),
213
375
  DRIZZLE_RESULT_SKIP_COLUMN=   (1 << 1),
214
376
  DRIZZLE_RESULT_BUFFER_COLUMN= (1 << 2),
215
377
  DRIZZLE_RESULT_BUFFER_ROW=    (1 << 3),
227
389
 */
228
390
enum drizzle_column_options_t
229
391
{
230
 
  DRIZZLE_COLUMN_ALLOCATED= (1 << 0) // DEPRECATED
 
392
  DRIZZLE_COLUMN_ALLOCATED= (1 << 0)
231
393
};
232
394
 
233
395
#ifndef __cplusplus
363
525
class drizzle_result_st;
364
526
class drizzle_column_st;
365
527
#endif
366
 
 
367
528
typedef char drizzle_field_t_type;
368
529
typedef drizzle_field_t_type *drizzle_field_t;
369
530
typedef drizzle_field_t drizzle_row_t_type;
380
541
#endif
381
542
 
382
543
/* Function types. */
383
 
typedef void (drizzle_context_free_fn)(drizzle_st *drizzle, void *context);
384
 
typedef void (drizzle_log_fn)(const char *line, drizzle_verbose_t verbose, void *context);
 
544
typedef void (drizzle_context_free_fn)(drizzle_st *drizzle,
 
545
                                       void *context);
 
546
typedef void (drizzle_log_fn)(const char *line, drizzle_verbose_t verbose,
 
547
                              void *context);
385
548
typedef drizzle_return_t (drizzle_state_fn)(drizzle_con_st *con);
386
 
typedef void (drizzle_con_context_free_fn)(drizzle_con_st *con, void *context);
387
 
typedef void (drizzle_query_context_free_fn)(drizzle_query_st *query, void *context);
 
549
typedef void (drizzle_con_context_free_fn)(drizzle_con_st *con,
 
550
                                           void *context);
 
551
typedef void (drizzle_query_context_free_fn)(drizzle_query_st *query,
 
552
                                             void *context);
388
553
/**
389
554
 * Custom function to register or deregister interest in file descriptor
390
555
 * events. See drizzle_set_event_watch_fn().