~drizzle-trunk/drizzle/development

1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
1
/*
2
 * Drizzle Client & Protocol Library
3
 *
2449.1.4 by Brian Aker
Complete update of libdrizzle
4
 * Copyright (C) 2011 Brian Aker (brian@tangent.org)
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
5
 * Copyright (C) 2008 Eric Day (eday@oddments.org)
6
 * All rights reserved.
7
 *
1971.2.1 by kalebral at gmail
update files that did not have license or had incorrect license structure
8
 * Redistribution and use in source and binary forms, with or without
9
 * modification, are permitted provided that the following conditions are
10
 * met:
11
 *
12
 *     * Redistributions of source code must retain the above copyright
13
 * notice, this list of conditions and the following disclaimer.
14
 *
15
 *     * Redistributions in binary form must reproduce the above
16
 * copyright notice, this list of conditions and the following disclaimer
17
 * in the documentation and/or other materials provided with the
18
 * distribution.
19
 *
20
 *     * The names of its contributors may not be used to endorse or
21
 * promote products derived from this software without specific prior
22
 * written permission.
23
 *
24
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
 *
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
36
 */
37
2449.1.4 by Brian Aker
Complete update of libdrizzle
38
#pragma once
39
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
40
/**
41
 * @file
42
 * @brief Defines, typedefs, enums, and macros
43
 */
44
45
#ifdef __cplusplus
46
extern "C" {
47
#endif
48
49
/**
50
 * @addtogroup drizzle_constants Constants
51
 * @ingroup drizzle_client_interface
52
 * @ingroup drizzle_server_interface
53
 * @{
54
 */
55
56
/**
57
 * @todo Remove these with next major API change.
58
 */
59
#define DRIZZLE_RETURN_SERVER_GONE DRIZZLE_RETURN_LOST_CONNECTION
60
#define DRIZZLE_RETURN_EOF DRIZZLE_RETURN_LOST_CONNECTION
61
#define DRIZZLE_COLUMN_TYPE_VIRTUAL 17
62
63
/* Defines. */
2465.1.4 by Brian Aker
Move from using 127.0.0.1, to localhost.
64
#define DRIZZLE_DEFAULT_TCP_HOST         "localhost"
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
65
#define DRIZZLE_DEFAULT_TCP_PORT         4427
1865.3.1 by Andrew Hutchings
Make port 4427 the default for client apps
66
#define DRIZZLE_DEFAULT_TCP_PORT_MYSQL   4427
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
67
#define DRIZZLE_DEFAULT_UDS              "/tmp/drizzle.sock"
68
#define DRIZZLE_DEFAULT_UDS_MYSQL        "/tmp/mysql.sock"
69
#define DRIZZLE_DEFAULT_BACKLOG          64
70
#define DRIZZLE_MAX_ERROR_SIZE           2048
71
#define DRIZZLE_MAX_USER_SIZE            64
72
#define DRIZZLE_MAX_PASSWORD_SIZE        32
73
#define DRIZZLE_MAX_DB_SIZE              64
74
#define DRIZZLE_MAX_INFO_SIZE            2048
75
#define DRIZZLE_MAX_SQLSTATE_SIZE        5
76
#define DRIZZLE_MAX_CATALOG_SIZE         128
77
#define DRIZZLE_MAX_TABLE_SIZE           128
78
#define DRIZZLE_MAX_COLUMN_NAME_SIZE     2048
79
#define DRIZZLE_MAX_DEFAULT_VALUE_SIZE   2048
80
#define DRIZZLE_MAX_PACKET_SIZE          UINT32_MAX
81
#define DRIZZLE_MAX_BUFFER_SIZE          32768
82
#define DRIZZLE_BUFFER_COPY_THRESHOLD    8192
83
#define DRIZZLE_MAX_SERVER_VERSION_SIZE  32
1939.2.1 by Evan Jones
Adds protocol support for MySQL 5.5.7
84
#define DRIZZLE_MAX_SERVER_EXTRA_SIZE    32
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
85
#define DRIZZLE_MAX_SCRAMBLE_SIZE        20
86
#define DRIZZLE_STATE_STACK_SIZE         8
87
#define DRIZZLE_ROW_GROW_SIZE            8192
88
#define DRIZZLE_DEFAULT_SOCKET_TIMEOUT   10
89
#define DRIZZLE_DEFAULT_SOCKET_SEND_SIZE 32768
90
#define DRIZZLE_DEFAULT_SOCKET_RECV_SIZE 32768
91
#define DRIZZLE_MYSQL_PASSWORD_HASH      41
92
93
/**
94
 * Return codes.
95
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
96
enum drizzle_return_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
97
{
98
  DRIZZLE_RETURN_OK,
99
  DRIZZLE_RETURN_IO_WAIT,
100
  DRIZZLE_RETURN_PAUSE,
101
  DRIZZLE_RETURN_ROW_BREAK,
102
  DRIZZLE_RETURN_MEMORY,
103
  DRIZZLE_RETURN_ERRNO,
104
  DRIZZLE_RETURN_INTERNAL_ERROR,
105
  DRIZZLE_RETURN_GETADDRINFO,
106
  DRIZZLE_RETURN_NOT_READY,
107
  DRIZZLE_RETURN_BAD_PACKET_NUMBER,
108
  DRIZZLE_RETURN_BAD_HANDSHAKE_PACKET,
109
  DRIZZLE_RETURN_BAD_PACKET,
110
  DRIZZLE_RETURN_PROTOCOL_NOT_SUPPORTED,
111
  DRIZZLE_RETURN_UNEXPECTED_DATA,
112
  DRIZZLE_RETURN_NO_SCRAMBLE,
113
  DRIZZLE_RETURN_AUTH_FAILED,
114
  DRIZZLE_RETURN_NULL_SIZE,
115
  DRIZZLE_RETURN_ERROR_CODE,
116
  DRIZZLE_RETURN_TOO_MANY_COLUMNS,
117
  DRIZZLE_RETURN_ROW_END,
118
  DRIZZLE_RETURN_LOST_CONNECTION,
119
  DRIZZLE_RETURN_COULD_NOT_CONNECT,
120
  DRIZZLE_RETURN_NO_ACTIVE_CONNECTIONS,
121
  DRIZZLE_RETURN_HANDSHAKE_FAILED,
122
  DRIZZLE_RETURN_TIMEOUT,
2449.1.4 by Brian Aker
Complete update of libdrizzle
123
  DRIZZLE_RETURN_INVALID_ARGUMENT,
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
124
  DRIZZLE_RETURN_MAX /* Always add new codes to the end before this one. */
2449.1.4 by Brian Aker
Complete update of libdrizzle
125
};
126
127
#ifndef __cplusplus
128
typedef enum drizzle_return_t drizzle_return_t;
129
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
130
131
/**
132
 * Verbosity levels.
133
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
134
enum drizzle_verbose_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
135
{
136
  DRIZZLE_VERBOSE_NEVER,
137
  DRIZZLE_VERBOSE_FATAL,
138
  DRIZZLE_VERBOSE_ERROR,
139
  DRIZZLE_VERBOSE_INFO,
140
  DRIZZLE_VERBOSE_DEBUG,
141
  DRIZZLE_VERBOSE_CRAZY,
142
  DRIZZLE_VERBOSE_MAX
2449.1.4 by Brian Aker
Complete update of libdrizzle
143
};
144
145
#ifndef __cplusplus
146
typedef enum drizzle_verbose_t drizzle_verbose_t;
147
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
148
149
/** @} */
150
151
/**
152
 * @ingroup drizzle
153
 * Options for drizzle_st.
154
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
155
enum drizzle_options_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
156
{
157
  DRIZZLE_NONE=            0,
158
  DRIZZLE_ALLOCATED=       (1 << 0),
159
  DRIZZLE_NON_BLOCKING=    (1 << 1),
160
  DRIZZLE_FREE_OBJECTS=    (1 << 2),
161
  DRIZZLE_ASSERT_DANGLING= (1 << 3)
2449.1.4 by Brian Aker
Complete update of libdrizzle
162
};
163
164
#ifndef __cplusplus
165
typedef enum drizzle_options_t drizzle_options_t;
166
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
167
168
/**
169
 * @ingroup drizzle_con
170
 * Options for drizzle_con_st.
171
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
172
enum drizzle_con_options_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
173
{
2221.9.1 by Andrew Hutchings
Add DRIZZLE_CON_MULTI_STATEMENTS libdrizzle option to enable DRIZZLE_CAPABILITIES_MULTI_STATEMENTS
174
  DRIZZLE_CON_NONE=             0,
175
  DRIZZLE_CON_ALLOCATED=        (1 << 0),
176
  DRIZZLE_CON_MYSQL=            (1 << 1),
177
  DRIZZLE_CON_RAW_PACKET=       (1 << 2),
178
  DRIZZLE_CON_RAW_SCRAMBLE=     (1 << 3),
179
  DRIZZLE_CON_READY=            (1 << 4),
180
  DRIZZLE_CON_NO_RESULT_READ=   (1 << 5),
181
  DRIZZLE_CON_IO_READY=         (1 << 6),
182
  DRIZZLE_CON_LISTEN=           (1 << 7),
183
  DRIZZLE_CON_EXPERIMENTAL=     (1 << 8),
184
  DRIZZLE_CON_FOUND_ROWS=       (1 << 9),
185
  DRIZZLE_CON_INTERACTIVE=      (1 << 11),
2229.2.1 by Brian Aker
This add M's 5.5 auth to the drivers.
186
  DRIZZLE_CON_MULTI_STATEMENTS= (1 << 12),
187
  DRIZZLE_CON_AUTH_PLUGIN=      (1 << 13)
2449.1.4 by Brian Aker
Complete update of libdrizzle
188
};
189
190
#ifndef __cplusplus
191
typedef enum drizzle_con_options_t drizzle_con_options_t;
192
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
193
194
/**
195
 * @ingroup drizzle_con
196
 * Socket types for drizzle_con_st.
197
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
198
enum drizzle_con_socket_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
199
{
200
  DRIZZLE_CON_SOCKET_TCP= 0,
201
  DRIZZLE_CON_SOCKET_UDS= (1 << 0)
2449.1.4 by Brian Aker
Complete update of libdrizzle
202
};
203
204
#ifndef __cplusplus
205
typedef enum drizzle_con_socket_t drizzle_con_socket_t;
206
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
207
208
/**
209
 * @ingroup drizzle_con
210
 * Status flags for drizle_con_st.
211
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
212
enum drizzle_con_status_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
213
{
214
  DRIZZLE_CON_STATUS_NONE=                     0,
215
  DRIZZLE_CON_STATUS_IN_TRANS=                 (1 << 0),
216
  DRIZZLE_CON_STATUS_AUTOCOMMIT=               (1 << 1),
217
  DRIZZLE_CON_STATUS_MORE_RESULTS_EXISTS=      (1 << 3),
218
  DRIZZLE_CON_STATUS_QUERY_NO_GOOD_INDEX_USED= (1 << 4),
219
  DRIZZLE_CON_STATUS_QUERY_NO_INDEX_USED=      (1 << 5),
220
  DRIZZLE_CON_STATUS_CURSOR_EXISTS=            (1 << 6),
221
  DRIZZLE_CON_STATUS_LAST_ROW_SENT=            (1 << 7),
222
  DRIZZLE_CON_STATUS_DB_DROPPED=               (1 << 8),
223
  DRIZZLE_CON_STATUS_NO_BACKSLASH_ESCAPES=     (1 << 9),
224
  DRIZZLE_CON_STATUS_QUERY_WAS_SLOW=           (1 << 10)
2449.1.4 by Brian Aker
Complete update of libdrizzle
225
};
226
227
#ifndef __cplusplus
228
typedef enum drizzle_con_status_t drizzle_con_status_t;
229
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
230
231
/**
232
 * @ingroup drizzle_con
233
 * Capabilities for drizzle_con_st.
234
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
235
enum drizzle_capabilities_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
236
{
237
  DRIZZLE_CAPABILITIES_NONE=                   0,
238
  DRIZZLE_CAPABILITIES_LONG_PASSWORD=          (1 << 0),
239
  DRIZZLE_CAPABILITIES_FOUND_ROWS=             (1 << 1),
240
  DRIZZLE_CAPABILITIES_LONG_FLAG=              (1 << 2),
241
  DRIZZLE_CAPABILITIES_CONNECT_WITH_DB=        (1 << 3),
242
  DRIZZLE_CAPABILITIES_NO_SCHEMA=              (1 << 4),
243
  DRIZZLE_CAPABILITIES_COMPRESS=               (1 << 5),
244
  DRIZZLE_CAPABILITIES_ODBC=                   (1 << 6),
245
  DRIZZLE_CAPABILITIES_LOCAL_FILES=            (1 << 7),
246
  DRIZZLE_CAPABILITIES_IGNORE_SPACE=           (1 << 8),
247
  DRIZZLE_CAPABILITIES_PROTOCOL_41=            (1 << 9),
248
  DRIZZLE_CAPABILITIES_INTERACTIVE=            (1 << 10),
249
  DRIZZLE_CAPABILITIES_SSL=                    (1 << 11),
250
  DRIZZLE_CAPABILITIES_IGNORE_SIGPIPE=         (1 << 12),
251
  DRIZZLE_CAPABILITIES_TRANSACTIONS=           (1 << 13),
252
  DRIZZLE_CAPABILITIES_RESERVED=               (1 << 14),
253
  DRIZZLE_CAPABILITIES_SECURE_CONNECTION=      (1 << 15),
254
  DRIZZLE_CAPABILITIES_MULTI_STATEMENTS=       (1 << 16),
255
  DRIZZLE_CAPABILITIES_MULTI_RESULTS=          (1 << 17),
2203.2.2 by Brian Aker
First pass through in going over work for MySQL AUTH PLUGIN style support.
256
  DRIZZLE_CAPABILITIES_PS_MULTI_RESULTS=       (1 << 18),
257
  DRIZZLE_CAPABILITIES_PLUGIN_AUTH=            (1 << 19),
2191.1.2 by Brian Aker
Adding SESSION table and adding back in the mysql interactive flag.
258
  DRIZZLE_CAPABILITIES_SSL_VERIFY_SERVER_CERT= (1 << 30),
259
  DRIZZLE_CAPABILITIES_REMEMBER_OPTIONS=       (1 << 31),
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
260
  DRIZZLE_CAPABILITIES_CLIENT= (DRIZZLE_CAPABILITIES_LONG_PASSWORD |
261
                                DRIZZLE_CAPABILITIES_FOUND_ROWS |
262
                                DRIZZLE_CAPABILITIES_LONG_FLAG |
263
                                DRIZZLE_CAPABILITIES_CONNECT_WITH_DB |
2203.2.2 by Brian Aker
First pass through in going over work for MySQL AUTH PLUGIN style support.
264
                                DRIZZLE_CAPABILITIES_PLUGIN_AUTH |
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
265
                                DRIZZLE_CAPABILITIES_TRANSACTIONS |
266
                                DRIZZLE_CAPABILITIES_PROTOCOL_41 |
2325.1.1 by Andrew Hutchings
Remove all drizzleadmin code (hopefully)
267
                                DRIZZLE_CAPABILITIES_SECURE_CONNECTION)
2449.1.4 by Brian Aker
Complete update of libdrizzle
268
};
269
270
#ifndef __cplusplus
271
typedef enum drizzle_capabilities_t drizzle_capabilities_t;
272
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
273
274
/**
275
 * @ingroup drizzle_command 
276
 * Commands for drizzle_command functions.
277
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
278
enum drizzle_command_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
279
{
280
  DRIZZLE_COMMAND_SLEEP,               /* Not used currently. */
281
  DRIZZLE_COMMAND_QUIT,
282
  DRIZZLE_COMMAND_INIT_DB,
283
  DRIZZLE_COMMAND_QUERY,
284
  DRIZZLE_COMMAND_FIELD_LIST,          /* Deprecated. */
285
  DRIZZLE_COMMAND_CREATE_DB,           /* Deprecated. */
286
  DRIZZLE_COMMAND_DROP_DB,             /* Deprecated. */
287
  DRIZZLE_COMMAND_REFRESH,
288
  DRIZZLE_COMMAND_SHUTDOWN,
289
  DRIZZLE_COMMAND_STATISTICS,
290
  DRIZZLE_COMMAND_PROCESS_INFO,        /* Deprecated. */
291
  DRIZZLE_COMMAND_CONNECT,             /* Not used currently. */
292
  DRIZZLE_COMMAND_PROCESS_KILL,        /* Deprecated. */
293
  DRIZZLE_COMMAND_DEBUG,
294
  DRIZZLE_COMMAND_PING,
295
  DRIZZLE_COMMAND_TIME,                /* Not used currently. */
296
  DRIZZLE_COMMAND_DELAYED_INSERT,      /* Not used currently. */
297
  DRIZZLE_COMMAND_CHANGE_USER,
298
  DRIZZLE_COMMAND_BINLOG_DUMP,         /* Not used currently. */
299
  DRIZZLE_COMMAND_TABLE_DUMP,          /* Not used currently. */
300
  DRIZZLE_COMMAND_CONNECT_OUT,         /* Not used currently. */
301
  DRIZZLE_COMMAND_REGISTER_SLAVE,      /* Not used currently. */
302
  DRIZZLE_COMMAND_STMT_PREPARE,        /* Not used currently. */
303
  DRIZZLE_COMMAND_STMT_EXECUTE,        /* Not used currently. */
304
  DRIZZLE_COMMAND_STMT_SEND_LONG_DATA, /* Not used currently. */
305
  DRIZZLE_COMMAND_STMT_CLOSE,          /* Not used currently. */
306
  DRIZZLE_COMMAND_STMT_RESET,          /* Not used currently. */
307
  DRIZZLE_COMMAND_SET_OPTION,          /* Not used currently. */
308
  DRIZZLE_COMMAND_STMT_FETCH,          /* Not used currently. */
309
  DRIZZLE_COMMAND_DAEMON,              /* Not used currently. */
310
  DRIZZLE_COMMAND_END                  /* Not used currently. */
2449.1.4 by Brian Aker
Complete update of libdrizzle
311
};
312
313
#ifndef __cplusplus
314
typedef enum drizzle_command_t drizzle_command_t;
315
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
316
317
/**
318
 * @ingroup drizzle_command 
319
 * Commands for the Drizzle protocol functions.
320
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
321
enum drizzle_command_drizzle_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
322
{
323
  DRIZZLE_COMMAND_DRIZZLE_SLEEP,
324
  DRIZZLE_COMMAND_DRIZZLE_QUIT,
325
  DRIZZLE_COMMAND_DRIZZLE_INIT_DB,
326
  DRIZZLE_COMMAND_DRIZZLE_QUERY,
327
  DRIZZLE_COMMAND_DRIZZLE_SHUTDOWN,
328
  DRIZZLE_COMMAND_DRIZZLE_CONNECT,
329
  DRIZZLE_COMMAND_DRIZZLE_PING,
2191.1.4 by Brian Aker
Add in interactive mode back to protocol.
330
  DRIZZLE_COMMAND_DRIZZLE_KILL,
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
331
  DRIZZLE_COMMAND_DRIZZLE_END
2449.1.4 by Brian Aker
Complete update of libdrizzle
332
};
333
334
#ifndef __cplusplus
335
typedef enum drizzle_command_drizzle_t drizzle_command_drizzle_t;
336
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
337
338
/**
339
 * @ingroup drizzle_query
340
 * Options for drizzle_query_st.
341
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
342
enum drizzle_query_options_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
343
{
1992.6.2 by Monty Taylor
Cleaned up for additional gcc 4.5 warnings.
344
  DRIZZLE_QUERY_NONE,
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
345
  DRIZZLE_QUERY_ALLOCATED= (1 << 0)
2449.1.4 by Brian Aker
Complete update of libdrizzle
346
};
347
348
#ifndef __cplusplus
349
typedef enum drizzle_query_options_t drizzle_query_options_t;
350
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
351
352
/**
353
 * @ingroup drizzle_query
354
 * States for drizle_query_st.
355
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
356
enum drizzle_query_state_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
357
{
358
  DRIZZLE_QUERY_STATE_INIT,
359
  DRIZZLE_QUERY_STATE_QUERY,
360
  DRIZZLE_QUERY_STATE_RESULT,
361
  DRIZZLE_QUERY_STATE_DONE
2449.1.4 by Brian Aker
Complete update of libdrizzle
362
};
363
364
#ifndef __cplusplus
365
typedef enum drizzle_query_state_t drizzle_query_state_t;
366
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
367
368
/**
369
 * @ingroup drizzle_result
370
 * Options for drizzle_result_st.
371
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
372
enum drizzle_result_options_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
373
{
374
  DRIZZLE_RESULT_NONE=          0,
375
  DRIZZLE_RESULT_ALLOCATED=     (1 << 0),
376
  DRIZZLE_RESULT_SKIP_COLUMN=   (1 << 1),
377
  DRIZZLE_RESULT_BUFFER_COLUMN= (1 << 2),
378
  DRIZZLE_RESULT_BUFFER_ROW=    (1 << 3),
379
  DRIZZLE_RESULT_EOF_PACKET=    (1 << 4),
380
  DRIZZLE_RESULT_ROW_BREAK=     (1 << 5)
2449.1.4 by Brian Aker
Complete update of libdrizzle
381
};
382
383
#ifndef __cplusplus
384
typedef enum drizzle_result_options_t drizzle_result_options_t;
385
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
386
387
/**
388
 * @ingroup drizzle_column
389
 * Options for drizzle_column_st.
390
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
391
enum drizzle_column_options_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
392
{
393
  DRIZZLE_COLUMN_ALLOCATED= (1 << 0)
2449.1.4 by Brian Aker
Complete update of libdrizzle
394
};
395
396
#ifndef __cplusplus
397
typedef enum drizzle_column_options_t drizzle_column_options_t;
398
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
399
400
/**
401
 * @ingroup drizzle_column
402
 * Types for drizzle_column_st.
403
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
404
enum drizzle_column_type_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
405
{
406
  DRIZZLE_COLUMN_TYPE_DECIMAL,
407
  DRIZZLE_COLUMN_TYPE_TINY,
408
  DRIZZLE_COLUMN_TYPE_SHORT,
409
  DRIZZLE_COLUMN_TYPE_LONG,
410
  DRIZZLE_COLUMN_TYPE_FLOAT,
411
  DRIZZLE_COLUMN_TYPE_DOUBLE,
412
  DRIZZLE_COLUMN_TYPE_NULL,
413
  DRIZZLE_COLUMN_TYPE_TIMESTAMP,
414
  DRIZZLE_COLUMN_TYPE_LONGLONG,
415
  DRIZZLE_COLUMN_TYPE_INT24,
416
  DRIZZLE_COLUMN_TYPE_DATE,
417
  DRIZZLE_COLUMN_TYPE_TIME,
418
  DRIZZLE_COLUMN_TYPE_DATETIME,
419
  DRIZZLE_COLUMN_TYPE_YEAR,
420
  DRIZZLE_COLUMN_TYPE_NEWDATE,
421
  DRIZZLE_COLUMN_TYPE_VARCHAR,
422
  DRIZZLE_COLUMN_TYPE_BIT,
423
  DRIZZLE_COLUMN_TYPE_NEWDECIMAL=  246,
424
  DRIZZLE_COLUMN_TYPE_ENUM=        247,
425
  DRIZZLE_COLUMN_TYPE_SET=         248,
426
  DRIZZLE_COLUMN_TYPE_TINY_BLOB=   249,
427
  DRIZZLE_COLUMN_TYPE_MEDIUM_BLOB= 250,
428
  DRIZZLE_COLUMN_TYPE_LONG_BLOB=   251,
429
  DRIZZLE_COLUMN_TYPE_BLOB=        252,
430
  DRIZZLE_COLUMN_TYPE_VAR_STRING=  253,
431
  DRIZZLE_COLUMN_TYPE_STRING=      254,
432
  DRIZZLE_COLUMN_TYPE_GEOMETRY=    255
2449.1.4 by Brian Aker
Complete update of libdrizzle
433
};
434
435
#ifndef __cplusplus
436
typedef enum drizzle_column_type_t drizzle_column_type_t;
437
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
438
439
/**
440
 * @ingroup drizzle_column
441
 * Types for drizzle_column_st for Drizzle.
442
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
443
enum drizzle_column_type_drizzle_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
444
{
445
  DRIZZLE_COLUMN_TYPE_DRIZZLE_TINY,
446
  DRIZZLE_COLUMN_TYPE_DRIZZLE_LONG,
447
  DRIZZLE_COLUMN_TYPE_DRIZZLE_DOUBLE,
448
  DRIZZLE_COLUMN_TYPE_DRIZZLE_NULL,
449
  DRIZZLE_COLUMN_TYPE_DRIZZLE_TIMESTAMP,
450
  DRIZZLE_COLUMN_TYPE_DRIZZLE_LONGLONG,
451
  DRIZZLE_COLUMN_TYPE_DRIZZLE_DATETIME,
452
  DRIZZLE_COLUMN_TYPE_DRIZZLE_DATE,
453
  DRIZZLE_COLUMN_TYPE_DRIZZLE_VARCHAR,
454
  DRIZZLE_COLUMN_TYPE_DRIZZLE_NEWDECIMAL,
455
  DRIZZLE_COLUMN_TYPE_DRIZZLE_ENUM,
456
  DRIZZLE_COLUMN_TYPE_DRIZZLE_BLOB,
2187.3.5 by Monty Taylor
Getting closer.
457
  DRIZZLE_COLUMN_TYPE_DRIZZLE_TIME,
458
  DRIZZLE_COLUMN_TYPE_DRIZZLE_BOOLEAN,
459
  DRIZZLE_COLUMN_TYPE_DRIZZLE_UUID,
460
  DRIZZLE_COLUMN_TYPE_DRIZZLE_MICROTIME,
461
  DRIZZLE_COLUMN_TYPE_DRIZZLE_MAX=DRIZZLE_COLUMN_TYPE_DRIZZLE_MICROTIME
2449.1.4 by Brian Aker
Complete update of libdrizzle
462
};
463
464
#ifndef __cplusplus
465
typedef enum drizzle_column_type_drizzle_t drizzle_column_type_drizzle_t;
466
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
467
468
/**
469
 * @ingroup drizzle_column
470
 * Flags for drizzle_column_st.
471
 */
2449.1.4 by Brian Aker
Complete update of libdrizzle
472
enum drizzle_column_flags_t
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
473
{
474
  DRIZZLE_COLUMN_FLAGS_NONE=             0,
475
  DRIZZLE_COLUMN_FLAGS_NOT_NULL=         (1 << 0),
476
  DRIZZLE_COLUMN_FLAGS_PRI_KEY=          (1 << 1),
477
  DRIZZLE_COLUMN_FLAGS_UNIQUE_KEY=       (1 << 2),
478
  DRIZZLE_COLUMN_FLAGS_MULTIPLE_KEY=     (1 << 3),
479
  DRIZZLE_COLUMN_FLAGS_BLOB=             (1 << 4),
480
  DRIZZLE_COLUMN_FLAGS_UNSIGNED=         (1 << 5),
481
  DRIZZLE_COLUMN_FLAGS_ZEROFILL=         (1 << 6),
482
  DRIZZLE_COLUMN_FLAGS_BINARY=           (1 << 7),
483
  DRIZZLE_COLUMN_FLAGS_ENUM=             (1 << 8),
484
  DRIZZLE_COLUMN_FLAGS_AUTO_INCREMENT=   (1 << 9),
485
  DRIZZLE_COLUMN_FLAGS_TIMESTAMP=        (1 << 10),
486
  DRIZZLE_COLUMN_FLAGS_SET=              (1 << 11),
487
  DRIZZLE_COLUMN_FLAGS_NO_DEFAULT_VALUE= (1 << 12),
488
  DRIZZLE_COLUMN_FLAGS_ON_UPDATE_NOW=    (1 << 13),
489
  DRIZZLE_COLUMN_FLAGS_PART_KEY=         (1 << 14),
490
  DRIZZLE_COLUMN_FLAGS_NUM=              (1 << 15),
491
  DRIZZLE_COLUMN_FLAGS_GROUP=            (1 << 15), /* NUM & GROUP the same. */
492
  DRIZZLE_COLUMN_FLAGS_UNIQUE=           (1 << 16),
493
  DRIZZLE_COLUMN_FLAGS_BINCMP=           (1 << 17),
494
  DRIZZLE_COLUMN_FLAGS_GET_FIXED_FIELDS= (1 << 18),
495
  DRIZZLE_COLUMN_FLAGS_IN_PART_FUNC=     (1 << 19),
496
  DRIZZLE_COLUMN_FLAGS_IN_ADD_INDEX=     (1 << 20),
497
  DRIZZLE_COLUMN_FLAGS_RENAMED=          (1 << 21)
2449.1.4 by Brian Aker
Complete update of libdrizzle
498
};
499
500
#ifndef __cplusplus
501
typedef enum drizzle_column_flags_t drizzle_column_flags_t;
502
#endif
1712.1.1 by Monty Taylor
Merged libdrizzle directly into tree.
503
504
/**
505
 * @addtogroup drizzle_types Types
506
 * @ingroup drizzle_client_interface
507
 * @ingroup drizzle_server_interface
508
 * @{
509
 */
510
511
/* Types. */
512
typedef struct drizzle_st drizzle_st;
513
typedef struct drizzle_con_tcp_st drizzle_con_tcp_st;
514
typedef struct drizzle_con_uds_st drizzle_con_uds_st;
515
typedef struct drizzle_con_st drizzle_con_st;
516
typedef struct drizzle_query_st drizzle_query_st;
517
typedef struct drizzle_result_st drizzle_result_st;
518
typedef struct drizzle_column_st drizzle_column_st;
519
typedef char *drizzle_field_t;
520
typedef drizzle_field_t *drizzle_row_t;
521
typedef uint8_t drizzle_charset_t;
522
523
/* Function types. */
524
typedef void (drizzle_context_free_fn)(drizzle_st *drizzle,
525
                                       void *context);
526
typedef void (drizzle_log_fn)(const char *line, drizzle_verbose_t verbose,
527
                              void *context);
528
typedef drizzle_return_t (drizzle_state_fn)(drizzle_con_st *con);
529
typedef void (drizzle_con_context_free_fn)(drizzle_con_st *con,
530
                                           void *context);
531
typedef void (drizzle_query_context_free_fn)(drizzle_query_st *query,
532
                                             void *context);
533
/**
534
 * Custom function to register or deregister interest in file descriptor
535
 * events. See drizzle_set_event_watch_fn().
536
 *
537
 * @param[in] con Connection that has changed the events it is interested in.
538
 *  Use drizzle_con_fd() to get the file descriptor.
539
 * @param[in] events A bit mask of POLLIN | POLLOUT, specifying if the
540
 *  connection is waiting for read or write events.
541
 * @param[in] context Application context pointer registered with
542
 *  drizzle_set_event_watch_fn().
543
 * @return DRIZZLE_RETURN_OK if successful.
544
 */
545
typedef drizzle_return_t (drizzle_event_watch_fn)(drizzle_con_st *con,
546
                                                  short events,
547
                                                  void *context);
548
549
/** @} */
550
551
/**
552
 * @addtogroup drizzle_macros Macros
553
 * @ingroup drizzle_client_interface
554
 * @ingroup drizzle_server_interface
555
 * @{
556
 */
557
558
/* Protocol unpacking macros. */
559
#define drizzle_get_byte2(__buffer) \
560
  (uint16_t)((__buffer)[0] | \
561
            ((__buffer)[1] << 8))
562
#define drizzle_get_byte3(__buffer) \
563
  (uint32_t)((__buffer)[0] | \
564
            ((__buffer)[1] << 8) | \
565
            ((__buffer)[2] << 16))
566
#define drizzle_get_byte4(__buffer) \
567
  (uint32_t)((__buffer)[0] | \
568
            ((__buffer)[1] << 8) | \
569
            ((__buffer)[2] << 16) | \
570
            ((__buffer)[3] << 24))
571
#define drizzle_get_byte8(__buffer) \
572
  ((uint64_t)(__buffer)[0] | \
573
  ((uint64_t)(__buffer)[1] << 8) | \
574
  ((uint64_t)(__buffer)[2] << 16) | \
575
  ((uint64_t)(__buffer)[3] << 24) | \
576
  ((uint64_t)(__buffer)[4] << 32) | \
577
  ((uint64_t)(__buffer)[5] << 40) | \
578
  ((uint64_t)(__buffer)[6] << 48) | \
579
  ((uint64_t)(__buffer)[7] << 56))
580
581
/* Protocol packing macros. */
582
#define drizzle_set_byte2(__buffer, __int) do { \
583
  (__buffer)[0]= (uint8_t)((__int) & 0xFF); \
584
  (__buffer)[1]= (uint8_t)(((__int) >> 8) & 0xFF); } while (0)
585
#define drizzle_set_byte3(__buffer, __int) do { \
586
  (__buffer)[0]= (uint8_t)((__int) & 0xFF); \
587
  (__buffer)[1]= (uint8_t)(((__int) >> 8) & 0xFF); \
588
  (__buffer)[2]= (uint8_t)(((__int) >> 16) & 0xFF); } while (0)
589
#define drizzle_set_byte4(__buffer, __int) do { \
590
  (__buffer)[0]= (uint8_t)((__int) & 0xFF); \
591
  (__buffer)[1]= (uint8_t)(((__int) >> 8) & 0xFF); \
592
  (__buffer)[2]= (uint8_t)(((__int) >> 16) & 0xFF); \
593
  (__buffer)[3]= (uint8_t)(((__int) >> 24) & 0xFF); } while (0)
594
#define drizzle_set_byte8(__buffer, __int) do { \
595
  (__buffer)[0]= (uint8_t)((__int) & 0xFF); \
596
  (__buffer)[1]= (uint8_t)(((__int) >> 8) & 0xFF); \
597
  (__buffer)[2]= (uint8_t)(((__int) >> 16) & 0xFF); \
598
  (__buffer)[3]= (uint8_t)(((__int) >> 24) & 0xFF); \
599
  (__buffer)[4]= (uint8_t)(((__int) >> 32) & 0xFF); \
600
  (__buffer)[5]= (uint8_t)(((__int) >> 40) & 0xFF); \
601
  (__buffer)[6]= (uint8_t)(((__int) >> 48) & 0xFF); \
602
  (__buffer)[7]= (uint8_t)(((__int) >> 56) & 0xFF); } while (0)
603
604
/* Multi-byte character macros. */
605
#define drizzle_mb_char(__c) (((__c) & 0x80) != 0)
606
#define drizzle_mb_length(__c) \
607
  ((uint32_t)(__c) <= 0x7f ? 1 : \
608
  ((uint32_t)(__c) <= 0x7ff ? 2 : \
609
  ((uint32_t)(__c) <= 0xd7ff ? 3 : \
610
  ((uint32_t)(__c) <= 0xdfff || (uint32_t)(__c) > 0x10ffff ? 0 : \
611
  ((uint32_t)(__c) <= 0xffff ? 3 : 4)))))
612
613
/** @} */
614
615
#ifdef __cplusplus
616
}
617
#endif