1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
1 |
/*
|
2 |
* Drizzle Client & Protocol Library
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Eric Day (eday@oddments.org)
|
|
5 |
* All rights reserved.
|
|
6 |
*
|
|
1971.2.1
by kalebral at gmail
update files that did not have license or had incorrect license structure |
7 |
* Redistribution and use in source and binary forms, with or without
|
8 |
* modification, are permitted provided that the following conditions are
|
|
9 |
* met:
|
|
10 |
*
|
|
11 |
* * Redistributions of source code must retain the above copyright
|
|
12 |
* notice, this list of conditions and the following disclaimer.
|
|
13 |
*
|
|
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
|
|
17 |
* distribution.
|
|
18 |
*
|
|
19 |
* * The names of its contributors may not be used to endorse or
|
|
20 |
* promote products derived from this software without specific prior
|
|
21 |
* written permission.
|
|
22 |
*
|
|
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.
|
|
34 |
*
|
|
1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
35 |
*/
|
36 |
||
37 |
/**
|
|
38 |
* @file
|
|
39 |
* @brief Struct Definitions
|
|
40 |
*/
|
|
41 |
||
2464.1.2
by Brian Aker
Fix compiling issues for 1.0, and cleanup header files. |
42 |
#pragma once
|
1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
43 |
|
1722.1.1
by Monty Taylor
Fixed intel compiler issues. |
44 |
#include <sys/types.h> |
2164.1.3
by Monty Taylor
Merged in various amounts of win32 fixes. Now is quite happy in vs10. |
45 |
|
1722.1.1
by Monty Taylor
Fixed intel compiler issues. |
46 |
#ifndef NI_MAXHOST
|
47 |
# define NI_MAXHOST 1025
|
|
48 |
#endif
|
|
1720.1.7
by Monty Taylor
Fixed the ICC missing header and the new config.h foo. |
49 |
|
1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
50 |
#ifdef __cplusplus
|
51 |
extern "C" { |
|
52 |
#endif
|
|
53 |
||
54 |
/**
|
|
55 |
* @ingroup drizzle
|
|
56 |
*/
|
|
57 |
struct drizzle_st |
|
58 |
{
|
|
59 |
uint16_t error_code; |
|
2464.1.2
by Brian Aker
Fix compiling issues for 1.0, and cleanup header files. |
60 |
int options; |
1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
61 |
drizzle_verbose_t verbose; |
62 |
uint32_t con_count; |
|
63 |
uint32_t pfds_size; |
|
64 |
uint32_t query_count; |
|
65 |
uint32_t query_new; |
|
66 |
uint32_t query_running; |
|
67 |
int last_errno; |
|
68 |
int timeout; |
|
69 |
drizzle_con_st *con_list; |
|
70 |
void *context; |
|
71 |
drizzle_context_free_fn *context_free_fn; |
|
72 |
drizzle_event_watch_fn *event_watch_fn; |
|
73 |
void *event_watch_context; |
|
74 |
drizzle_log_fn *log_fn; |
|
75 |
void *log_context; |
|
76 |
struct pollfd *pfds; |
|
77 |
drizzle_query_st *query_list; |
|
78 |
char sqlstate[DRIZZLE_MAX_SQLSTATE_SIZE + 1]; |
|
79 |
char last_error[DRIZZLE_MAX_ERROR_SIZE]; |
|
80 |
};
|
|
81 |
||
82 |
/**
|
|
83 |
* @ingroup drizzle_con
|
|
84 |
*/
|
|
85 |
struct drizzle_con_tcp_st |
|
86 |
{
|
|
87 |
in_port_t port; |
|
88 |
struct addrinfo *addrinfo; |
|
89 |
char *host; |
|
90 |
char host_buffer[NI_MAXHOST]; |
|
91 |
};
|
|
92 |
||
93 |
/**
|
|
94 |
* @ingroup drizzle_con
|
|
95 |
*/
|
|
96 |
struct drizzle_con_uds_st |
|
97 |
{
|
|
98 |
struct addrinfo addrinfo; |
|
99 |
struct sockaddr_un sockaddr; |
|
100 |
};
|
|
101 |
||
102 |
/**
|
|
103 |
* @ingroup drizzle_con
|
|
104 |
*/
|
|
105 |
struct drizzle_con_st |
|
106 |
{
|
|
107 |
uint8_t packet_number; |
|
108 |
uint8_t protocol_version; |
|
109 |
uint8_t state_current; |
|
110 |
short events; |
|
111 |
short revents; |
|
2464.1.2
by Brian Aker
Fix compiling issues for 1.0, and cleanup header files. |
112 |
int capabilities; |
1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
113 |
drizzle_charset_t charset; |
114 |
drizzle_command_t command; |
|
2464.1.2
by Brian Aker
Fix compiling issues for 1.0, and cleanup header files. |
115 |
int options; |
1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
116 |
drizzle_con_socket_t socket_type; |
117 |
drizzle_con_status_t status; |
|
118 |
uint32_t max_packet_size; |
|
119 |
uint32_t result_count; |
|
120 |
uint32_t thread_id; |
|
121 |
int backlog; |
|
122 |
int fd; |
|
123 |
size_t buffer_size; |
|
124 |
size_t command_offset; |
|
125 |
size_t command_size; |
|
126 |
size_t command_total; |
|
127 |
size_t packet_size; |
|
128 |
struct addrinfo *addrinfo_next; |
|
129 |
uint8_t *buffer_ptr; |
|
130 |
uint8_t *command_buffer; |
|
131 |
uint8_t *command_data; |
|
132 |
void *context; |
|
133 |
drizzle_con_context_free_fn *context_free_fn; |
|
134 |
drizzle_st *drizzle; |
|
135 |
drizzle_con_st *next; |
|
136 |
drizzle_con_st *prev; |
|
137 |
drizzle_query_st *query; |
|
138 |
drizzle_result_st *result; |
|
139 |
drizzle_result_st *result_list; |
|
140 |
uint8_t *scramble; |
|
141 |
union
|
|
142 |
{
|
|
143 |
drizzle_con_tcp_st tcp; |
|
144 |
drizzle_con_uds_st uds; |
|
145 |
} socket; |
|
146 |
uint8_t buffer[DRIZZLE_MAX_BUFFER_SIZE]; |
|
147 |
char db[DRIZZLE_MAX_DB_SIZE]; |
|
148 |
char password[DRIZZLE_MAX_PASSWORD_SIZE]; |
|
149 |
uint8_t scramble_buffer[DRIZZLE_MAX_SCRAMBLE_SIZE]; |
|
150 |
char server_version[DRIZZLE_MAX_SERVER_VERSION_SIZE]; |
|
1939.2.1
by Evan Jones
Adds protocol support for MySQL 5.5.7 |
151 |
char server_extra[DRIZZLE_MAX_SERVER_EXTRA_SIZE]; |
1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
152 |
drizzle_state_fn *state_stack[DRIZZLE_STATE_STACK_SIZE]; |
153 |
char user[DRIZZLE_MAX_USER_SIZE]; |
|
154 |
};
|
|
155 |
||
156 |
/**
|
|
157 |
* @ingroup drizzle_query
|
|
158 |
*/
|
|
159 |
struct drizzle_query_st |
|
160 |
{
|
|
161 |
drizzle_st *drizzle; |
|
162 |
drizzle_query_st *next; |
|
163 |
drizzle_query_st *prev; |
|
2464.1.2
by Brian Aker
Fix compiling issues for 1.0, and cleanup header files. |
164 |
int options; |
1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
165 |
drizzle_query_state_t state; |
166 |
drizzle_con_st *con; |
|
167 |
drizzle_result_st *result; |
|
168 |
const char *string; |
|
169 |
size_t size; |
|
170 |
void *context; |
|
171 |
drizzle_query_context_free_fn *context_free_fn; |
|
172 |
};
|
|
173 |
||
174 |
/**
|
|
175 |
* @ingroup drizzle_result
|
|
176 |
*/
|
|
177 |
struct drizzle_result_st |
|
178 |
{
|
|
179 |
drizzle_con_st *con; |
|
180 |
drizzle_result_st *next; |
|
181 |
drizzle_result_st *prev; |
|
2464.1.2
by Brian Aker
Fix compiling issues for 1.0, and cleanup header files. |
182 |
int options; |
1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
183 |
|
184 |
char info[DRIZZLE_MAX_INFO_SIZE]; |
|
185 |
uint16_t error_code; |
|
186 |
char sqlstate[DRIZZLE_MAX_SQLSTATE_SIZE + 1]; |
|
187 |
uint64_t insert_id; |
|
188 |
uint16_t warning_count; |
|
189 |
uint64_t affected_rows; |
|
190 |
||
191 |
uint16_t column_count; |
|
192 |
uint16_t column_current; |
|
193 |
drizzle_column_st *column_list; |
|
194 |
drizzle_column_st *column; |
|
195 |
drizzle_column_st *column_buffer; |
|
196 |
||
197 |
uint64_t row_count; |
|
198 |
uint64_t row_current; |
|
199 |
||
200 |
uint16_t field_current; |
|
201 |
size_t field_total; |
|
202 |
size_t field_offset; |
|
203 |
size_t field_size; |
|
204 |
drizzle_field_t field; |
|
205 |
drizzle_field_t field_buffer; |
|
206 |
||
207 |
uint64_t row_list_size; |
|
208 |
drizzle_row_t row; |
|
209 |
drizzle_row_t *row_list; |
|
210 |
size_t *field_sizes; |
|
211 |
size_t **field_sizes_list; |
|
212 |
};
|
|
213 |
||
214 |
/**
|
|
215 |
* @ingroup drizzle_column
|
|
216 |
*/
|
|
217 |
struct drizzle_column_st |
|
218 |
{
|
|
219 |
drizzle_result_st *result; |
|
220 |
drizzle_column_st *next; |
|
221 |
drizzle_column_st *prev; |
|
2464.1.2
by Brian Aker
Fix compiling issues for 1.0, and cleanup header files. |
222 |
int options; |
1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
223 |
char catalog[DRIZZLE_MAX_CATALOG_SIZE]; |
224 |
char db[DRIZZLE_MAX_DB_SIZE]; |
|
225 |
char table[DRIZZLE_MAX_TABLE_SIZE]; |
|
226 |
char orig_table[DRIZZLE_MAX_TABLE_SIZE]; |
|
227 |
char name[DRIZZLE_MAX_COLUMN_NAME_SIZE]; |
|
228 |
char orig_name[DRIZZLE_MAX_COLUMN_NAME_SIZE]; |
|
229 |
drizzle_charset_t charset; |
|
230 |
uint32_t size; |
|
231 |
size_t max_size; |
|
232 |
drizzle_column_type_t type; |
|
2464.1.2
by Brian Aker
Fix compiling issues for 1.0, and cleanup header files. |
233 |
int flags; |
1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
234 |
uint8_t decimals; |
235 |
uint8_t default_value[DRIZZLE_MAX_DEFAULT_VALUE_SIZE]; |
|
236 |
size_t default_value_size; |
|
237 |
};
|
|
238 |
||
239 |
#ifdef __cplusplus
|
|
240 |
}
|
|
241 |
#endif
|