2
* Drizzle Client & Protocol Library
4
* Copyright (C) 2008 Eric Day (eday@oddments.org)
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions are
11
* * Redistributions of source code must retain the above copyright
12
* notice, this list of conditions and the following disclaimer.
14
* * Redistributions in binary form must reproduce the above
15
* copyright notice, this list of conditions and the following disclaimer
16
* in the documentation and/or other materials provided with the
19
* * The names of its contributors may not be used to endorse or
20
* promote products derived from this software without specific prior
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
* @brief Struct Definitions
42
#ifndef __DRIZZLE_STRUCTS_H
43
#define __DRIZZLE_STRUCTS_H
45
#include <sys/types.h>
48
# define NI_MAXHOST 1025
57
struct drizzle_con_tcp_st;
58
struct drizzle_con_uds_st;
59
struct drizzle_con_st;
60
struct drizzle_query_st;
61
struct drizzle_result_st;
62
struct drizzle_column_st;
74
drizzle_verbose_t verbose;
79
uint32_t query_running;
82
drizzle_con_st *con_list;
84
drizzle_context_free_fn *context_free_fn;
85
drizzle_event_watch_fn *event_watch_fn;
86
void *event_watch_context;
87
drizzle_log_fn *log_fn;
90
drizzle_query_st *query_list;
91
char sqlstate[DRIZZLE_MAX_SQLSTATE_SIZE + 1];
92
char last_error[DRIZZLE_MAX_ERROR_SIZE];
96
options(DRIZZLE_NONE),
97
verbose(DRIZZLE_VERBOSE_ERROR),
107
context_free_fn(NULL),
108
event_watch_fn(NULL),
109
event_watch_context(NULL),
118
* @ingroup drizzle_con
120
class drizzle_con_tcp_st
124
struct addrinfo *addrinfo;
126
char host_buffer[NI_MAXHOST];
130
* @ingroup drizzle_con
132
class drizzle_con_uds_st
135
struct addrinfo addrinfo;
136
struct sockaddr_un sockaddr;
140
* @ingroup drizzle_con
145
uint8_t packet_number;
146
uint8_t protocol_version;
147
uint8_t state_current;
151
drizzle_charset_t charset;
152
drizzle_command_t command;
154
drizzle_con_socket_t socket_type;
155
drizzle_con_status_t status;
156
uint32_t max_packet_size;
157
uint32_t result_count;
162
size_t command_offset;
164
size_t command_total;
166
struct addrinfo *addrinfo_next;
168
uint8_t *command_buffer;
169
uint8_t *command_data;
171
drizzle_con_context_free_fn *context_free_fn;
173
drizzle_con_st *next;
174
drizzle_con_st *prev;
175
drizzle_query_st *query;
176
drizzle_result_st *result;
177
drizzle_result_st *result_list;
181
drizzle_con_tcp_st tcp;
182
drizzle_con_uds_st uds;
184
uint8_t buffer[DRIZZLE_MAX_BUFFER_SIZE];
185
char db[DRIZZLE_MAX_DB_SIZE];
186
char password[DRIZZLE_MAX_PASSWORD_SIZE];
187
uint8_t scramble_buffer[DRIZZLE_MAX_SCRAMBLE_SIZE];
188
char server_version[DRIZZLE_MAX_SERVER_VERSION_SIZE];
189
char server_extra[DRIZZLE_MAX_SERVER_EXTRA_SIZE];
190
drizzle_state_fn *state_stack[DRIZZLE_STATE_STACK_SIZE];
191
char user[DRIZZLE_MAX_USER_SIZE];
199
capabilities(DRIZZLE_CAPABILITIES_NONE),
200
options(DRIZZLE_CON_NONE),
213
command_buffer(NULL),
216
context_free_fn(NULL),
228
* @ingroup drizzle_query
230
class drizzle_query_st
234
drizzle_query_st *next;
235
drizzle_query_st *prev;
237
drizzle_query_state_t state;
239
drizzle_result_st *result;
243
drizzle_query_context_free_fn *context_free_fn;
255
context_free_fn(NULL)
260
* @ingroup drizzle_result
262
class drizzle_result_st
266
drizzle_result_st *next;
267
drizzle_result_st *prev;
270
char info[DRIZZLE_MAX_INFO_SIZE];
272
char sqlstate[DRIZZLE_MAX_SQLSTATE_SIZE + 1];
274
uint16_t warning_count;
275
uint64_t affected_rows;
277
uint16_t column_count;
278
uint16_t column_current;
279
drizzle_column_st *column_list;
280
drizzle_column_st *column;
281
drizzle_column_st *column_buffer;
284
uint64_t row_current;
286
uint16_t field_current;
290
drizzle_field_t field;
291
drizzle_field_t field_buffer;
293
uint64_t row_list_size;
295
drizzle_row_list_t *row_list;
297
drizzle_field_sizes_list_t *field_sizes_list;
299
drizzle_result_st() :
303
options(DRIZZLE_RESULT_NONE),
322
field_sizes_list(NULL)
327
* @ingroup drizzle_column
329
class drizzle_column_st
332
drizzle_result_st *result;
333
drizzle_column_st *next;
334
drizzle_column_st *prev;
336
char catalog[DRIZZLE_MAX_CATALOG_SIZE];
337
char db[DRIZZLE_MAX_DB_SIZE];
338
char table[DRIZZLE_MAX_TABLE_SIZE];
339
char orig_table[DRIZZLE_MAX_TABLE_SIZE];
340
char name[DRIZZLE_MAX_COLUMN_NAME_SIZE];
341
char orig_name[DRIZZLE_MAX_COLUMN_NAME_SIZE];
342
drizzle_charset_t charset;
345
drizzle_column_type_t type;
348
uint8_t default_value[DRIZZLE_MAX_DEFAULT_VALUE_SIZE];
349
size_t default_value_size;
351
drizzle_column_st() :
358
flags(DRIZZLE_COLUMN_FLAGS_NONE),
360
default_value_size(0)
369
#endif /* __DRIZZLE_STRUCTS_H */