1 | /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB |
2 | 2012 by MontyProgram AB |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. |
8 | |
9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public |
15 | License along with this library; if not, write to the Free |
16 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
17 | MA 02111-1301, USA */ |
18 | |
19 | /* defines for the libmariadb library */ |
20 | |
21 | #ifndef _mysql_h |
22 | #define _mysql_h |
23 | |
24 | #ifdef __cplusplus |
25 | extern "C" { |
26 | #endif |
27 | |
28 | #ifndef LIBMARIADB |
29 | #define LIBMARIADB |
30 | #endif |
31 | #ifndef MYSQL_CLIENT |
32 | #define MYSQL_CLIENT |
33 | #endif |
34 | |
35 | #include <stdarg.h> |
36 | #include <time.h> |
37 | |
38 | #if !defined (_global_h) && !defined (MY_GLOBAL_INCLUDED) /* If not standard header */ |
39 | #include <sys/types.h> |
40 | typedef char my_bool; |
41 | typedef unsigned long long my_ulonglong; |
42 | |
43 | #if !defined(_WIN32) |
44 | #define STDCALL |
45 | #else |
46 | #define STDCALL __stdcall |
47 | #endif |
48 | |
49 | #ifndef my_socket_defined |
50 | #define my_socket_defined |
51 | #if defined(_WIN64) |
52 | #define my_socket unsigned long long |
53 | #elif defined(_WIN32) |
54 | #define my_socket unsigned int |
55 | #else |
56 | typedef int my_socket; |
57 | #endif |
58 | #endif |
59 | #endif |
60 | #include "mariadb_com.h" |
61 | #include "mariadb_version.h" |
62 | #include "ma_list.h" |
63 | #include "mariadb_ctype.h" |
64 | |
65 | |
66 | typedef struct st_ma_const_string |
67 | { |
68 | const char *str; |
69 | size_t length; |
70 | } MARIADB_CONST_STRING; |
71 | |
72 | typedef struct st_ma_const_data |
73 | { |
74 | const unsigned char *data; |
75 | size_t length; |
76 | } MARIADB_CONST_DATA; |
77 | |
78 | |
79 | #ifndef ST_MA_USED_MEM_DEFINED |
80 | #define ST_MA_USED_MEM_DEFINED |
81 | typedef struct st_ma_used_mem { /* struct for once_alloc */ |
82 | struct st_ma_used_mem *next; /* Next block in use */ |
83 | size_t left; /* memory left in block */ |
84 | size_t size; /* Size of block */ |
85 | } MA_USED_MEM; |
86 | |
87 | typedef struct st_ma_mem_root { |
88 | MA_USED_MEM *free; |
89 | MA_USED_MEM *used; |
90 | MA_USED_MEM *pre_alloc; |
91 | size_t min_malloc; |
92 | size_t block_size; |
93 | unsigned int block_num; |
94 | unsigned int first_block_usage; |
95 | void (*error_handler)(void); |
96 | } MA_MEM_ROOT; |
97 | #endif |
98 | |
99 | extern unsigned int mysql_port; |
100 | extern char *mysql_unix_port; |
101 | extern unsigned int mariadb_deinitialize_ssl; |
102 | |
103 | #define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) |
104 | #define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) |
105 | #define IS_BLOB(n) ((n) & BLOB_FLAG) |
106 | #define IS_NUM(t) (((t) <= MYSQL_TYPE_INT24 && (t) != MYSQL_TYPE_TIMESTAMP) || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL) |
107 | #define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG) |
108 | #define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR || (f)->type == MYSQL_TYPE_NEWDECIMAL || (f)->type == MYSQL_TYPE_DECIMAL) |
109 | |
110 | typedef struct st_mysql_field { |
111 | char *name; /* Name of column */ |
112 | char *org_name; /* Name of original column (added after 3.23.58) */ |
113 | char *table; /* Table of column if column was a field */ |
114 | char *org_table; /* Name of original table (added after 3.23.58 */ |
115 | char *db; /* table schema (added after 3.23.58) */ |
116 | char *catalog; /* table catalog (added after 3.23.58) */ |
117 | char *def; /* Default value (set by mysql_list_fields) */ |
118 | unsigned long length; /* Width of column */ |
119 | unsigned long max_length; /* Max width of selected set */ |
120 | /* added after 3.23.58 */ |
121 | unsigned int name_length; |
122 | unsigned int org_name_length; |
123 | unsigned int table_length; |
124 | unsigned int org_table_length; |
125 | unsigned int db_length; |
126 | unsigned int catalog_length; |
127 | unsigned int def_length; |
128 | /***********************/ |
129 | unsigned int flags; /* Div flags */ |
130 | unsigned int decimals; /* Number of decimals in field */ |
131 | unsigned int charsetnr; /* char set number (added in 4.1) */ |
132 | enum enum_field_types type; /* Type of field. Se mysql_com.h for types */ |
133 | void *extension; /* added in 4.1 */ |
134 | } MYSQL_FIELD; |
135 | |
136 | typedef char **MYSQL_ROW; /* return data as array of strings */ |
137 | typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */ |
138 | |
139 | #define SET_CLIENT_ERROR(a, b, c, d) \ |
140 | do { \ |
141 | (a)->net.last_errno= (b);\ |
142 | strncpy((a)->net.sqlstate, (c), SQLSTATE_LENGTH);\ |
143 | (a)->net.sqlstate[SQLSTATE_LENGTH]= 0;\ |
144 | strncpy((a)->net.last_error, (d) ? (d) : ER((b)), MYSQL_ERRMSG_SIZE - 1);\ |
145 | (a)->net.last_error[MYSQL_ERRMSG_SIZE - 1]= 0;\ |
146 | } while(0) |
147 | |
148 | /* For mysql_async.c */ |
149 | #define set_mariadb_error(A,B,C) SET_CLIENT_ERROR((A),(B),(C),0) |
150 | extern const char *SQLSTATE_UNKNOWN; |
151 | #define unknown_sqlstate SQLSTATE_UNKNOWN |
152 | |
153 | #define CLEAR_CLIENT_ERROR(a) \ |
154 | do { \ |
155 | (a)->net.last_errno= 0;\ |
156 | strcpy((a)->net.sqlstate, "00000");\ |
157 | (a)->net.last_error[0]= '\0';\ |
158 | if ((a)->net.extension)\ |
159 | (a)->net.extension->extended_errno= 0;\ |
160 | } while (0) |
161 | |
162 | #define MYSQL_COUNT_ERROR (~(unsigned long long) 0) |
163 | |
164 | |
165 | typedef struct st_mysql_rows { |
166 | struct st_mysql_rows *next; /* list of rows */ |
167 | MYSQL_ROW data; |
168 | unsigned long length; |
169 | } MYSQL_ROWS; |
170 | |
171 | typedef MYSQL_ROWS *MYSQL_ROW_OFFSET; /* offset to current row */ |
172 | |
173 | typedef struct st_mysql_data { |
174 | MYSQL_ROWS *data; |
175 | void *embedded_info; |
176 | MA_MEM_ROOT alloc; |
177 | unsigned long long rows; |
178 | unsigned int fields; |
179 | void *extension; |
180 | } MYSQL_DATA; |
181 | |
182 | enum mysql_option |
183 | { |
184 | MYSQL_OPT_CONNECT_TIMEOUT, |
185 | MYSQL_OPT_COMPRESS, |
186 | MYSQL_OPT_NAMED_PIPE, |
187 | MYSQL_INIT_COMMAND, |
188 | MYSQL_READ_DEFAULT_FILE, |
189 | MYSQL_READ_DEFAULT_GROUP, |
190 | MYSQL_SET_CHARSET_DIR, |
191 | MYSQL_SET_CHARSET_NAME, |
192 | MYSQL_OPT_LOCAL_INFILE, |
193 | MYSQL_OPT_PROTOCOL, |
194 | MYSQL_SHARED_MEMORY_BASE_NAME, |
195 | MYSQL_OPT_READ_TIMEOUT, |
196 | MYSQL_OPT_WRITE_TIMEOUT, |
197 | MYSQL_OPT_USE_RESULT, |
198 | MYSQL_OPT_USE_REMOTE_CONNECTION, |
199 | MYSQL_OPT_USE_EMBEDDED_CONNECTION, |
200 | MYSQL_OPT_GUESS_CONNECTION, |
201 | MYSQL_SET_CLIENT_IP, |
202 | MYSQL_SECURE_AUTH, |
203 | MYSQL_REPORT_DATA_TRUNCATION, |
204 | MYSQL_OPT_RECONNECT, |
205 | MYSQL_OPT_SSL_VERIFY_SERVER_CERT, |
206 | MYSQL_PLUGIN_DIR, |
207 | MYSQL_DEFAULT_AUTH, |
208 | MYSQL_OPT_BIND, |
209 | MYSQL_OPT_SSL_KEY, |
210 | MYSQL_OPT_SSL_CERT, |
211 | MYSQL_OPT_SSL_CA, |
212 | MYSQL_OPT_SSL_CAPATH, |
213 | MYSQL_OPT_SSL_CIPHER, |
214 | MYSQL_OPT_SSL_CRL, |
215 | MYSQL_OPT_SSL_CRLPATH, |
216 | /* Connection attribute options */ |
217 | MYSQL_OPT_CONNECT_ATTR_RESET, |
218 | MYSQL_OPT_CONNECT_ATTR_ADD, |
219 | MYSQL_OPT_CONNECT_ATTR_DELETE, |
220 | MYSQL_SERVER_PUBLIC_KEY, |
221 | MYSQL_ENABLE_CLEARTEXT_PLUGIN, |
222 | MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, |
223 | MYSQL_OPT_SSL_ENFORCE, |
224 | MYSQL_OPT_MAX_ALLOWED_PACKET, |
225 | MYSQL_OPT_NET_BUFFER_LENGTH, |
226 | MYSQL_OPT_TLS_VERSION, |
227 | |
228 | /* MariaDB specific */ |
229 | MYSQL_PROGRESS_CALLBACK=5999, |
230 | MYSQL_OPT_NONBLOCK, |
231 | /* MariaDB Connector/C specific */ |
232 | MYSQL_DATABASE_DRIVER=7000, |
233 | MARIADB_OPT_SSL_FP, /* deprecated, use MARIADB_OPT_TLS_PEER_FP instead */ |
234 | MARIADB_OPT_SSL_FP_LIST, /* deprecated, use MARIADB_OPT_TLS_PEER_FP_LIST instead */ |
235 | MARIADB_OPT_TLS_PASSPHRASE, /* passphrase for encrypted certificates */ |
236 | MARIADB_OPT_TLS_CIPHER_STRENGTH, |
237 | MARIADB_OPT_TLS_VERSION, |
238 | MARIADB_OPT_TLS_PEER_FP, /* single finger print for server certificate verification */ |
239 | MARIADB_OPT_TLS_PEER_FP_LIST, /* finger print white list for server certificate verification */ |
240 | MARIADB_OPT_CONNECTION_READ_ONLY, |
241 | MYSQL_OPT_CONNECT_ATTRS, /* for mysql_get_optionv */ |
242 | MARIADB_OPT_USERDATA, |
243 | MARIADB_OPT_CONNECTION_HANDLER, |
244 | MARIADB_OPT_PORT, |
245 | MARIADB_OPT_UNIXSOCKET, |
246 | MARIADB_OPT_PASSWORD, |
247 | MARIADB_OPT_HOST, |
248 | MARIADB_OPT_USER, |
249 | MARIADB_OPT_SCHEMA, |
250 | MARIADB_OPT_DEBUG, |
251 | MARIADB_OPT_FOUND_ROWS, |
252 | MARIADB_OPT_MULTI_RESULTS, |
253 | MARIADB_OPT_MULTI_STATEMENTS, |
254 | MARIADB_OPT_INTERACTIVE, |
255 | , |
256 | MARIADB_OPT_IO_WAIT, |
257 | MARIADB_OPT_SKIP_READ_RESPONSE, |
258 | MARIADB_OPT_RESTRICTED_AUTH, |
259 | MARIADB_OPT_RPL_REGISTER_REPLICA, |
260 | MARIADB_OPT_STATUS_CALLBACK, |
261 | MARIADB_OPT_SERVER_PLUGINS, |
262 | MARIADB_OPT_BULK_UNIT_RESULTS |
263 | }; |
264 | |
265 | enum mariadb_value { |
266 | MARIADB_CHARSET_ID, |
267 | MARIADB_CHARSET_NAME, |
268 | MARIADB_CLIENT_ERRORS, |
269 | MARIADB_CLIENT_VERSION, |
270 | MARIADB_CLIENT_VERSION_ID, |
271 | MARIADB_CONNECTION_ASYNC_TIMEOUT, |
272 | MARIADB_CONNECTION_ASYNC_TIMEOUT_MS, |
273 | MARIADB_CONNECTION_MARIADB_CHARSET_INFO, |
274 | MARIADB_CONNECTION_ERROR, |
275 | MARIADB_CONNECTION_ERROR_ID, |
276 | MARIADB_CONNECTION_HOST, |
277 | MARIADB_CONNECTION_INFO, |
278 | MARIADB_CONNECTION_PORT, |
279 | MARIADB_CONNECTION_PROTOCOL_VERSION_ID, |
280 | MARIADB_CONNECTION_PVIO_TYPE, |
281 | MARIADB_CONNECTION_SCHEMA, |
282 | MARIADB_CONNECTION_SERVER_TYPE, |
283 | MARIADB_CONNECTION_SERVER_VERSION, |
284 | MARIADB_CONNECTION_SERVER_VERSION_ID, |
285 | MARIADB_CONNECTION_SOCKET, |
286 | MARIADB_CONNECTION_SQLSTATE, |
287 | MARIADB_CONNECTION_SSL_CIPHER, |
288 | MARIADB_TLS_LIBRARY, |
289 | MARIADB_CONNECTION_TLS_VERSION, |
290 | MARIADB_CONNECTION_TLS_VERSION_ID, |
291 | MARIADB_CONNECTION_TYPE, |
292 | MARIADB_CONNECTION_UNIX_SOCKET, |
293 | MARIADB_CONNECTION_USER, |
294 | MARIADB_MAX_ALLOWED_PACKET, |
295 | MARIADB_NET_BUFFER_LENGTH, |
296 | MARIADB_CONNECTION_SERVER_STATUS, |
297 | MARIADB_CONNECTION_SERVER_CAPABILITIES, |
298 | MARIADB_CONNECTION_EXTENDED_SERVER_CAPABILITIES, |
299 | MARIADB_CONNECTION_CLIENT_CAPABILITIES, |
300 | MARIADB_CONNECTION_BYTES_READ, |
301 | MARIADB_CONNECTION_BYTES_SENT, |
302 | MARIADB_TLS_PEER_CERT_INFO, |
303 | }; |
304 | |
305 | enum mysql_status { MYSQL_STATUS_READY, |
306 | MYSQL_STATUS_GET_RESULT, |
307 | MYSQL_STATUS_USE_RESULT, |
308 | MYSQL_STATUS_QUERY_SENT, |
309 | MYSQL_STATUS_SENDING_LOAD_DATA, |
310 | MYSQL_STATUS_FETCHING_DATA, |
311 | MYSQL_STATUS_NEXT_RESULT_PENDING, |
312 | MYSQL_STATUS_QUIT_SENT, /* object is "destroyed" at this stage */ |
313 | MYSQL_STATUS_STMT_RESULT |
314 | }; |
315 | |
316 | enum mysql_protocol_type |
317 | { |
318 | MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, |
319 | MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY |
320 | }; |
321 | |
322 | struct st_mysql_options { |
323 | unsigned int connect_timeout, read_timeout, write_timeout; |
324 | unsigned int port, protocol; |
325 | unsigned long client_flag; |
326 | char *host,*user,*password,*unix_socket,*db; |
327 | struct st_dynamic_array *init_command; |
328 | char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name; |
329 | char *ssl_key; /* PEM key file */ |
330 | char *ssl_cert; /* PEM cert file */ |
331 | char *ssl_ca; /* PEM CA file */ |
332 | char *ssl_capath; /* PEM directory of CA-s? */ |
333 | char *ssl_cipher; |
334 | char *shared_memory_base_name; |
335 | unsigned long max_allowed_packet; |
336 | my_bool use_ssl; /* if to use SSL or not */ |
337 | my_bool compress,named_pipe; |
338 | my_bool reconnect, unused_1, unused_2, unused_3; |
339 | enum mysql_option methods_to_use; |
340 | char *bind_address; |
341 | my_bool secure_auth; |
342 | my_bool report_data_truncation; |
343 | /* function pointers for local infile support */ |
344 | int (*local_infile_init)(void **, const char *, void *); |
345 | int (*local_infile_read)(void *, char *, unsigned int); |
346 | void (*local_infile_end)(void *); |
347 | int (*local_infile_error)(void *, char *, unsigned int); |
348 | void *local_infile_userdata; |
349 | struct st_mysql_options_extension *extension; |
350 | }; |
351 | |
352 | typedef struct st_mysql { |
353 | NET net; /* Communication parameters */ |
354 | void *unused_0; |
355 | char *host,*user,*passwd,*unix_socket,*server_version,*host_info; |
356 | char *info,*db; |
357 | const struct ma_charset_info_st *charset; /* character set */ |
358 | MYSQL_FIELD *fields; |
359 | MA_MEM_ROOT field_alloc; |
360 | unsigned long long affected_rows; |
361 | unsigned long long insert_id; /* id if insert on table with NEXTNR */ |
362 | unsigned long long ; /* Used by mysqlshow */ |
363 | unsigned long thread_id; /* Id for connection in server */ |
364 | unsigned long packet_length; |
365 | unsigned int port; |
366 | unsigned long client_flag; |
367 | unsigned long server_capabilities; |
368 | unsigned int protocol_version; |
369 | unsigned int field_count; |
370 | unsigned int server_status; |
371 | unsigned int server_language; |
372 | unsigned int warning_count; /* warning count, added in 4.1 protocol */ |
373 | struct st_mysql_options options; |
374 | enum mysql_status status; |
375 | my_bool free_me; /* If free in mysql_close */ |
376 | my_bool unused_1; |
377 | char scramble_buff[20+ 1]; |
378 | /* madded after 3.23.58 */ |
379 | my_bool unused_2; |
380 | void *unused_3, *unused_4, *unused_5, *unused_6; |
381 | LIST *stmts; |
382 | const struct st_mariadb_methods *methods; |
383 | void *thd; |
384 | my_bool *unbuffered_fetch_owner; |
385 | char *info_buffer; |
386 | struct st_mariadb_extension *extension; |
387 | } MYSQL; |
388 | |
389 | typedef struct st_mysql_res { |
390 | unsigned long long row_count; |
391 | unsigned int field_count, current_field; |
392 | MYSQL_FIELD *fields; |
393 | MYSQL_DATA *data; |
394 | MYSQL_ROWS *data_cursor; |
395 | MA_MEM_ROOT field_alloc; |
396 | MYSQL_ROW row; /* If unbuffered read */ |
397 | MYSQL_ROW current_row; /* buffer to current row */ |
398 | unsigned long *lengths; /* column lengths of current row */ |
399 | MYSQL *handle; /* for unbuffered reads */ |
400 | my_bool eof; /* Used my mysql_fetch_row */ |
401 | my_bool is_ps; |
402 | } MYSQL_RES; |
403 | |
404 | typedef struct |
405 | { |
406 | unsigned long *p_max_allowed_packet; |
407 | unsigned long *p_net_buffer_length; |
408 | void *extension; |
409 | } MYSQL_PARAMETERS; |
410 | |
411 | |
412 | enum mariadb_field_attr_t |
413 | { |
414 | MARIADB_FIELD_ATTR_DATA_TYPE_NAME= 0, |
415 | MARIADB_FIELD_ATTR_FORMAT_NAME= 1 |
416 | }; |
417 | |
418 | #define MARIADB_FIELD_ATTR_LAST MARIADB_FIELD_ATTR_FORMAT_NAME |
419 | |
420 | |
421 | int STDCALL mariadb_field_attr(MARIADB_CONST_STRING *attr, |
422 | const MYSQL_FIELD *field, |
423 | enum mariadb_field_attr_t type); |
424 | |
425 | #ifndef _mysql_time_h_ |
426 | enum enum_mysql_timestamp_type |
427 | { |
428 | MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1, |
429 | MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2 |
430 | }; |
431 | |
432 | typedef struct st_mysql_time |
433 | { |
434 | unsigned int year, month, day, hour, minute, second; |
435 | unsigned long second_part; |
436 | my_bool neg; |
437 | enum enum_mysql_timestamp_type time_type; |
438 | } MYSQL_TIME; |
439 | #define AUTO_SEC_PART_DIGITS 39 |
440 | #endif |
441 | |
442 | #define SEC_PART_DIGITS 6 |
443 | #define MARIADB_INVALID_SOCKET -1 |
444 | |
445 | /* Asynchronous API constants */ |
446 | #define MYSQL_WAIT_READ 1 |
447 | #define MYSQL_WAIT_WRITE 2 |
448 | #define MYSQL_WAIT_EXCEPT 4 |
449 | #define MYSQL_WAIT_TIMEOUT 8 |
450 | |
451 | typedef struct character_set |
452 | { |
453 | unsigned int number; /* character set number */ |
454 | unsigned int state; /* character set state */ |
455 | const char *csname; /* character set name */ |
456 | const char *name; /* collation name */ |
457 | const char *; /* comment */ |
458 | const char *dir; /* character set directory */ |
459 | unsigned int mbminlen; /* min. length for multibyte strings */ |
460 | unsigned int mbmaxlen; /* max. length for multibyte strings */ |
461 | } MY_CHARSET_INFO; |
462 | |
463 | /* Local infile support functions */ |
464 | #define LOCAL_INFILE_ERROR_LEN 512 |
465 | |
466 | #include "mariadb_stmt.h" |
467 | |
468 | #ifndef MYSQL_CLIENT_PLUGIN_HEADER |
469 | #define \ |
470 | int type; \ |
471 | unsigned int interface_version; \ |
472 | const char *name; \ |
473 | const char *author; \ |
474 | const char *desc; \ |
475 | unsigned int version[3]; \ |
476 | const char *license; \ |
477 | void *mysql_api; \ |
478 | int (*init)(char *, size_t, int, va_list); \ |
479 | int (*deinit)(void); \ |
480 | int (*options)(const char *option, const void *); |
481 | struct st_mysql_client_plugin |
482 | { |
483 | MYSQL_CLIENT_PLUGIN_HEADER |
484 | }; |
485 | |
486 | enum mariadb_tls_verification { |
487 | MARIADB_VERIFY_NONE = 0, |
488 | MARIADB_VERIFY_PIPE, |
489 | MARIADB_VERIFY_UNIXSOCKET, |
490 | MARIADB_VERIFY_LOCALHOST, |
491 | MARIADB_VERIFY_FINGERPRINT, |
492 | MARIADB_VERIFY_PEER_CERT |
493 | }; |
494 | |
495 | typedef struct |
496 | { |
497 | int version; |
498 | char *issuer; |
499 | char *subject; |
500 | char fingerprint[65]; |
501 | struct tm not_before; |
502 | struct tm not_after; |
503 | enum mariadb_tls_verification verify_mode; |
504 | } MARIADB_X509_INFO; |
505 | |
506 | |
507 | struct st_mysql_client_plugin * |
508 | mysql_load_plugin(struct st_mysql *mysql, const char *name, int type, |
509 | int argc, ...); |
510 | struct st_mysql_client_plugin * STDCALL |
511 | mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type, |
512 | int argc, va_list args); |
513 | struct st_mysql_client_plugin * STDCALL |
514 | mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type); |
515 | struct st_mysql_client_plugin * STDCALL |
516 | mysql_client_register_plugin(struct st_mysql *mysql, |
517 | struct st_mysql_client_plugin *plugin); |
518 | #endif |
519 | |
520 | |
521 | void STDCALL mysql_set_local_infile_handler(MYSQL *mysql, |
522 | int (*local_infile_init)(void **, const char *, void *), |
523 | int (*local_infile_read)(void *, char *, unsigned int), |
524 | void (*local_infile_end)(void *), |
525 | int (*local_infile_error)(void *, char*, unsigned int), |
526 | void *); |
527 | |
528 | void mysql_set_local_infile_default(MYSQL *mysql); |
529 | |
530 | void my_set_error(MYSQL *mysql, unsigned int error_nr, |
531 | const char *sqlstate, const char *format, ...); |
532 | /* Functions to get information from the MYSQL and MYSQL_RES structures */ |
533 | /* Should definitely be used if one uses shared libraries */ |
534 | |
535 | my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res); |
536 | unsigned int STDCALL mysql_num_fields(MYSQL_RES *res); |
537 | my_bool STDCALL mysql_eof(MYSQL_RES *res); |
538 | MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res, |
539 | unsigned int fieldnr); |
540 | MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res); |
541 | MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res); |
542 | unsigned int STDCALL mysql_field_tell(MYSQL_RES *res); |
543 | |
544 | unsigned int STDCALL mysql_field_count(MYSQL *mysql); |
545 | my_bool STDCALL mysql_more_results(MYSQL *mysql); |
546 | int STDCALL mysql_next_result(MYSQL *mysql); |
547 | my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql); |
548 | my_bool STDCALL mysql_autocommit(MYSQL *mysql, my_bool mode); |
549 | my_bool STDCALL mysql_commit(MYSQL *mysql); |
550 | my_bool STDCALL mysql_rollback(MYSQL *mysql); |
551 | my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql); |
552 | unsigned int STDCALL mysql_errno(MYSQL *mysql); |
553 | const char * STDCALL mysql_error(MYSQL *mysql); |
554 | const char * STDCALL mysql_info(MYSQL *mysql); |
555 | unsigned long STDCALL mysql_thread_id(MYSQL *mysql); |
556 | const char * STDCALL mysql_character_set_name(MYSQL *mysql); |
557 | void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *cs); |
558 | int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname); |
559 | |
560 | my_bool mariadb_get_infov(MYSQL *mysql, enum mariadb_value value, void *arg, ...); |
561 | my_bool STDCALL mariadb_get_info(MYSQL *mysql, enum mariadb_value value, void *arg); |
562 | MYSQL * STDCALL mysql_init(MYSQL *mysql); |
563 | int STDCALL mysql_ssl_set(MYSQL *mysql, const char *key, |
564 | const char *cert, const char *ca, |
565 | const char *capath, const char *cipher); |
566 | const char * STDCALL mysql_get_ssl_cipher(MYSQL *mysql); |
567 | my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user, |
568 | const char *passwd, const char *db); |
569 | MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host, |
570 | const char *user, |
571 | const char *passwd, |
572 | const char *db, |
573 | unsigned int port, |
574 | const char *unix_socket, |
575 | unsigned long clientflag); |
576 | void STDCALL mysql_close(MYSQL *sock); |
577 | int STDCALL mysql_select_db(MYSQL *mysql, const char *db); |
578 | int STDCALL mysql_query(MYSQL *mysql, const char *q); |
579 | int STDCALL mysql_send_query(MYSQL *mysql, const char *q, |
580 | unsigned long length); |
581 | my_bool STDCALL mysql_read_query_result(MYSQL *mysql); |
582 | int STDCALL mysql_real_query(MYSQL *mysql, const char *q, |
583 | unsigned long length); |
584 | int STDCALL mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level); |
585 | int STDCALL mysql_dump_debug_info(MYSQL *mysql); |
586 | int STDCALL mysql_refresh(MYSQL *mysql, |
587 | unsigned int refresh_options); |
588 | int STDCALL mysql_kill(MYSQL *mysql,unsigned long pid); |
589 | int STDCALL mysql_ping(MYSQL *mysql); |
590 | char * STDCALL mysql_stat(MYSQL *mysql); |
591 | char * STDCALL mysql_get_server_info(MYSQL *mysql); |
592 | unsigned long STDCALL mysql_get_server_version(MYSQL *mysql); |
593 | char * STDCALL mysql_get_host_info(MYSQL *mysql); |
594 | unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql); |
595 | MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild); |
596 | MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild); |
597 | MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table, |
598 | const char *wild); |
599 | MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql); |
600 | MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); |
601 | MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); |
602 | int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option, |
603 | const void *arg); |
604 | int STDCALL mysql_options4(MYSQL *mysql,enum mysql_option option, |
605 | const void *arg1, const void *arg2); |
606 | void STDCALL mysql_free_result(MYSQL_RES *result); |
607 | void STDCALL mysql_data_seek(MYSQL_RES *result, |
608 | unsigned long long offset); |
609 | MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET); |
610 | MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result, |
611 | MYSQL_FIELD_OFFSET offset); |
612 | MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result); |
613 | unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result); |
614 | MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result); |
615 | unsigned long STDCALL mysql_escape_string(char *to,const char *from, |
616 | unsigned long from_length); |
617 | unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql, |
618 | char *to,const char *from, |
619 | unsigned long length); |
620 | unsigned int STDCALL mysql_thread_safe(void); |
621 | unsigned int STDCALL mysql_warning_count(MYSQL *mysql); |
622 | const char * STDCALL mysql_sqlstate(MYSQL *mysql); |
623 | int STDCALL mysql_server_init(int argc, char **argv, char **groups); |
624 | void STDCALL mysql_server_end(void); |
625 | void STDCALL mysql_thread_end(void); |
626 | my_bool STDCALL mysql_thread_init(void); |
627 | int STDCALL mysql_set_server_option(MYSQL *mysql, |
628 | enum enum_mysql_set_option option); |
629 | const char * STDCALL mysql_get_client_info(void); |
630 | unsigned long STDCALL mysql_get_client_version(void); |
631 | my_bool STDCALL mariadb_connection(MYSQL *mysql); |
632 | const char * STDCALL mysql_get_server_name(MYSQL *mysql); |
633 | MARIADB_CHARSET_INFO * STDCALL mariadb_get_charset_by_name(const char *csname); |
634 | MARIADB_CHARSET_INFO * STDCALL mariadb_get_charset_by_nr(unsigned int csnr); |
635 | size_t STDCALL mariadb_convert_string(const char *from, size_t *from_len, MARIADB_CHARSET_INFO *from_cs, |
636 | char *to, size_t *to_len, MARIADB_CHARSET_INFO *to_cs, int *errorcode); |
637 | int mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...); |
638 | int mysql_get_optionv(MYSQL *mysql, enum mysql_option option, void *arg, ...); |
639 | int STDCALL mysql_get_option(MYSQL *mysql, enum mysql_option option, void *arg); |
640 | unsigned long STDCALL mysql_hex_string(char *to, const char *from, unsigned long len); |
641 | my_socket STDCALL mysql_get_socket(MYSQL *mysql); |
642 | unsigned int STDCALL mysql_get_timeout_value(const MYSQL *mysql); |
643 | unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql); |
644 | my_bool STDCALL mariadb_reconnect(MYSQL *mysql); |
645 | int STDCALL mariadb_cancel(MYSQL *mysql); |
646 | void STDCALL mysql_debug(const char *debug); |
647 | unsigned long STDCALL mysql_net_read_packet(MYSQL *mysql); |
648 | unsigned long STDCALL mysql_net_field_length(unsigned char **packet); |
649 | my_bool STDCALL mysql_embedded(void); |
650 | MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void); |
651 | |
652 | /* Async API */ |
653 | int STDCALL mysql_close_start(MYSQL *sock); |
654 | int STDCALL mysql_close_cont(MYSQL *sock, int status); |
655 | int STDCALL mysql_commit_start(my_bool *ret, MYSQL * mysql); |
656 | int STDCALL mysql_commit_cont(my_bool *ret, MYSQL * mysql, int status); |
657 | int STDCALL mysql_dump_debug_info_cont(int *ret, MYSQL *mysql, int ready_status); |
658 | int STDCALL mysql_dump_debug_info_start(int *ret, MYSQL *mysql); |
659 | int STDCALL mysql_rollback_start(my_bool *ret, MYSQL * mysql); |
660 | int STDCALL mysql_rollback_cont(my_bool *ret, MYSQL * mysql, int status); |
661 | int STDCALL mysql_autocommit_start(my_bool *ret, MYSQL * mysql, |
662 | my_bool auto_mode); |
663 | int STDCALL mysql_list_fields_cont(MYSQL_RES **ret, MYSQL *mysql, int ready_status); |
664 | int STDCALL mysql_list_fields_start(MYSQL_RES **ret, MYSQL *mysql, const char *table, |
665 | const char *wild); |
666 | int STDCALL mysql_autocommit_cont(my_bool *ret, MYSQL * mysql, int status); |
667 | int STDCALL mysql_next_result_start(int *ret, MYSQL *mysql); |
668 | int STDCALL mysql_next_result_cont(int *ret, MYSQL *mysql, int status); |
669 | int STDCALL mysql_select_db_start(int *ret, MYSQL *mysql, const char *db); |
670 | int STDCALL mysql_select_db_cont(int *ret, MYSQL *mysql, int ready_status); |
671 | int STDCALL mysql_stmt_warning_count(MYSQL_STMT *stmt); |
672 | int STDCALL mysql_stmt_next_result_start(int *ret, MYSQL_STMT *stmt); |
673 | int STDCALL mysql_stmt_next_result_cont(int *ret, MYSQL_STMT *stmt, int status); |
674 | |
675 | int STDCALL mysql_set_character_set_start(int *ret, MYSQL *mysql, |
676 | const char *csname); |
677 | int STDCALL mysql_set_character_set_cont(int *ret, MYSQL *mysql, |
678 | int status); |
679 | int STDCALL mysql_change_user_start(my_bool *ret, MYSQL *mysql, |
680 | const char *user, |
681 | const char *passwd, |
682 | const char *db); |
683 | int STDCALL mysql_change_user_cont(my_bool *ret, MYSQL *mysql, |
684 | int status); |
685 | int STDCALL mysql_real_connect_start(MYSQL **ret, MYSQL *mysql, |
686 | const char *host, |
687 | const char *user, |
688 | const char *passwd, |
689 | const char *db, |
690 | unsigned int port, |
691 | const char *unix_socket, |
692 | unsigned long clientflag); |
693 | int STDCALL mysql_real_connect_cont(MYSQL **ret, MYSQL *mysql, |
694 | int status); |
695 | int STDCALL mysql_query_start(int *ret, MYSQL *mysql, |
696 | const char *q); |
697 | int STDCALL mysql_query_cont(int *ret, MYSQL *mysql, |
698 | int status); |
699 | int STDCALL mysql_send_query_start(int *ret, MYSQL *mysql, |
700 | const char *q, |
701 | unsigned long length); |
702 | int STDCALL mysql_send_query_cont(int *ret, MYSQL *mysql, int status); |
703 | int STDCALL mysql_real_query_start(int *ret, MYSQL *mysql, |
704 | const char *q, |
705 | unsigned long length); |
706 | int STDCALL mysql_real_query_cont(int *ret, MYSQL *mysql, |
707 | int status); |
708 | int STDCALL mysql_store_result_start(MYSQL_RES **ret, MYSQL *mysql); |
709 | int STDCALL mysql_store_result_cont(MYSQL_RES **ret, MYSQL *mysql, |
710 | int status); |
711 | int STDCALL mysql_shutdown_start(int *ret, MYSQL *mysql, |
712 | enum mysql_enum_shutdown_level |
713 | shutdown_level); |
714 | int STDCALL mysql_shutdown_cont(int *ret, MYSQL *mysql, |
715 | int status); |
716 | int STDCALL mysql_refresh_start(int *ret, MYSQL *mysql, |
717 | unsigned int refresh_options); |
718 | int STDCALL mysql_refresh_cont(int *ret, MYSQL *mysql, int status); |
719 | int STDCALL mysql_kill_start(int *ret, MYSQL *mysql, |
720 | unsigned long pid); |
721 | int STDCALL mysql_kill_cont(int *ret, MYSQL *mysql, int status); |
722 | int STDCALL mysql_set_server_option_start(int *ret, MYSQL *mysql, |
723 | enum enum_mysql_set_option |
724 | option); |
725 | int STDCALL mysql_set_server_option_cont(int *ret, MYSQL *mysql, |
726 | int status); |
727 | int STDCALL mysql_ping_start(int *ret, MYSQL *mysql); |
728 | int STDCALL mysql_ping_cont(int *ret, MYSQL *mysql, int status); |
729 | int STDCALL mysql_stat_start(const char **ret, MYSQL *mysql); |
730 | int STDCALL mysql_stat_cont(const char **ret, MYSQL *mysql, |
731 | int status); |
732 | int STDCALL mysql_free_result_start(MYSQL_RES *result); |
733 | int STDCALL mysql_free_result_cont(MYSQL_RES *result, int status); |
734 | int STDCALL mysql_fetch_row_start(MYSQL_ROW *ret, |
735 | MYSQL_RES *result); |
736 | int STDCALL mysql_fetch_row_cont(MYSQL_ROW *ret, MYSQL_RES *result, |
737 | int status); |
738 | int STDCALL mysql_read_query_result_start(my_bool *ret, |
739 | MYSQL *mysql); |
740 | int STDCALL mysql_read_query_result_cont(my_bool *ret, |
741 | MYSQL *mysql, int status); |
742 | int STDCALL mysql_reset_connection_start(int *ret, MYSQL *mysql); |
743 | int STDCALL mysql_reset_connection_cont(int *ret, MYSQL *mysql, int status); |
744 | int STDCALL mysql_session_track_get_next(MYSQL *mysql, enum enum_session_state_type type, const char **data, size_t *length); |
745 | int STDCALL mysql_session_track_get_first(MYSQL *mysql, enum enum_session_state_type type, const char **data, size_t *length); |
746 | int STDCALL mysql_stmt_prepare_start(int *ret, MYSQL_STMT *stmt,const char *query, unsigned long length); |
747 | int STDCALL mysql_stmt_prepare_cont(int *ret, MYSQL_STMT *stmt, int status); |
748 | int STDCALL mysql_stmt_execute_start(int *ret, MYSQL_STMT *stmt); |
749 | int STDCALL mysql_stmt_execute_cont(int *ret, MYSQL_STMT *stmt, int status); |
750 | int STDCALL mysql_stmt_fetch_start(int *ret, MYSQL_STMT *stmt); |
751 | int STDCALL mysql_stmt_fetch_cont(int *ret, MYSQL_STMT *stmt, int status); |
752 | int STDCALL mysql_stmt_store_result_start(int *ret, MYSQL_STMT *stmt); |
753 | int STDCALL mysql_stmt_store_result_cont(int *ret, MYSQL_STMT *stmt,int status); |
754 | int STDCALL mysql_stmt_close_start(my_bool *ret, MYSQL_STMT *stmt); |
755 | int STDCALL mysql_stmt_close_cont(my_bool *ret, MYSQL_STMT * stmt, int status); |
756 | int STDCALL mysql_stmt_reset_start(my_bool *ret, MYSQL_STMT * stmt); |
757 | int STDCALL mysql_stmt_reset_cont(my_bool *ret, MYSQL_STMT *stmt, int status); |
758 | int STDCALL mysql_stmt_free_result_start(my_bool *ret, MYSQL_STMT *stmt); |
759 | int STDCALL mysql_stmt_free_result_cont(my_bool *ret, MYSQL_STMT *stmt, |
760 | int status); |
761 | int STDCALL mysql_stmt_send_long_data_start(my_bool *ret, MYSQL_STMT *stmt, |
762 | unsigned int param_number, |
763 | const char *data, |
764 | unsigned long len); |
765 | int STDCALL mysql_stmt_send_long_data_cont(my_bool *ret, MYSQL_STMT *stmt, |
766 | int status); |
767 | int STDCALL mysql_reset_connection(MYSQL *mysql); |
768 | |
769 | /* API function calls (used by dynamic plugins) */ |
770 | struct st_mariadb_api { |
771 | unsigned long long (STDCALL *mysql_num_rows)(MYSQL_RES *res); |
772 | unsigned int (STDCALL *mysql_num_fields)(MYSQL_RES *res); |
773 | my_bool (STDCALL *mysql_eof)(MYSQL_RES *res); |
774 | MYSQL_FIELD *(STDCALL *mysql_fetch_field_direct)(MYSQL_RES *res, unsigned int fieldnr); |
775 | MYSQL_FIELD * (STDCALL *mysql_fetch_fields)(MYSQL_RES *res); |
776 | MYSQL_ROWS * (STDCALL *mysql_row_tell)(MYSQL_RES *res); |
777 | unsigned int (STDCALL *mysql_field_tell)(MYSQL_RES *res); |
778 | unsigned int (STDCALL *mysql_field_count)(MYSQL *mysql); |
779 | my_bool (STDCALL *mysql_more_results)(MYSQL *mysql); |
780 | int (STDCALL *mysql_next_result)(MYSQL *mysql); |
781 | unsigned long long (STDCALL *mysql_affected_rows)(MYSQL *mysql); |
782 | my_bool (STDCALL *mysql_autocommit)(MYSQL *mysql, my_bool mode); |
783 | my_bool (STDCALL *mysql_commit)(MYSQL *mysql); |
784 | my_bool (STDCALL *mysql_rollback)(MYSQL *mysql); |
785 | unsigned long long (STDCALL *mysql_insert_id)(MYSQL *mysql); |
786 | unsigned int (STDCALL *mysql_errno)(MYSQL *mysql); |
787 | const char * (STDCALL *mysql_error)(MYSQL *mysql); |
788 | const char * (STDCALL *mysql_info)(MYSQL *mysql); |
789 | unsigned long (STDCALL *mysql_thread_id)(MYSQL *mysql); |
790 | const char * (STDCALL *mysql_character_set_name)(MYSQL *mysql); |
791 | void (STDCALL *mysql_get_character_set_info)(MYSQL *mysql, MY_CHARSET_INFO *cs); |
792 | int (STDCALL *mysql_set_character_set)(MYSQL *mysql, const char *csname); |
793 | my_bool (*mariadb_get_infov)(MYSQL *mysql, enum mariadb_value value, void *arg, ...); |
794 | my_bool (STDCALL *mariadb_get_info)(MYSQL *mysql, enum mariadb_value value, void *arg); |
795 | MYSQL * (STDCALL *mysql_init)(MYSQL *mysql); |
796 | int (STDCALL *mysql_ssl_set)(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher); |
797 | const char * (STDCALL *mysql_get_ssl_cipher)(MYSQL *mysql); |
798 | my_bool (STDCALL *mysql_change_user)(MYSQL *mysql, const char *user, const char *passwd, const char *db); |
799 | MYSQL * (STDCALL *mysql_real_connect)(MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag); |
800 | void (STDCALL *mysql_close)(MYSQL *sock); |
801 | int (STDCALL *mysql_select_db)(MYSQL *mysql, const char *db); |
802 | int (STDCALL *mysql_query)(MYSQL *mysql, const char *q); |
803 | int (STDCALL *mysql_send_query)(MYSQL *mysql, const char *q, unsigned long length); |
804 | my_bool (STDCALL *mysql_read_query_result)(MYSQL *mysql); |
805 | int (STDCALL *mysql_real_query)(MYSQL *mysql, const char *q, unsigned long length); |
806 | int (STDCALL *mysql_shutdown)(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level); |
807 | int (STDCALL *mysql_dump_debug_info)(MYSQL *mysql); |
808 | int (STDCALL *mysql_refresh)(MYSQL *mysql, unsigned int refresh_options); |
809 | int (STDCALL *mysql_kill)(MYSQL *mysql,unsigned long pid); |
810 | int (STDCALL *mysql_ping)(MYSQL *mysql); |
811 | char * (STDCALL *mysql_stat)(MYSQL *mysql); |
812 | char * (STDCALL *mysql_get_server_info)(MYSQL *mysql); |
813 | unsigned long (STDCALL *mysql_get_server_version)(MYSQL *mysql); |
814 | char * (STDCALL *mysql_get_host_info)(MYSQL *mysql); |
815 | unsigned int (STDCALL *mysql_get_proto_info)(MYSQL *mysql); |
816 | MYSQL_RES * (STDCALL *mysql_list_dbs)(MYSQL *mysql,const char *wild); |
817 | MYSQL_RES * (STDCALL *mysql_list_tables)(MYSQL *mysql,const char *wild); |
818 | MYSQL_RES * (STDCALL *mysql_list_fields)(MYSQL *mysql, const char *table, const char *wild); |
819 | MYSQL_RES * (STDCALL *mysql_list_processes)(MYSQL *mysql); |
820 | MYSQL_RES * (STDCALL *mysql_store_result)(MYSQL *mysql); |
821 | MYSQL_RES * (STDCALL *mysql_use_result)(MYSQL *mysql); |
822 | int (STDCALL *mysql_options)(MYSQL *mysql,enum mysql_option option, const void *arg); |
823 | void (STDCALL *mysql_free_result)(MYSQL_RES *result); |
824 | void (STDCALL *mysql_data_seek)(MYSQL_RES *result, unsigned long long offset); |
825 | MYSQL_ROW_OFFSET (STDCALL *mysql_row_seek)(MYSQL_RES *result, MYSQL_ROW_OFFSET); |
826 | MYSQL_FIELD_OFFSET (STDCALL *mysql_field_seek)(MYSQL_RES *result, MYSQL_FIELD_OFFSET offset); |
827 | MYSQL_ROW (STDCALL *mysql_fetch_row)(MYSQL_RES *result); |
828 | unsigned long * (STDCALL *mysql_fetch_lengths)(MYSQL_RES *result); |
829 | MYSQL_FIELD * (STDCALL *mysql_fetch_field)(MYSQL_RES *result); |
830 | unsigned long (STDCALL *mysql_escape_string)(char *to,const char *from, unsigned long from_length); |
831 | unsigned long (STDCALL *mysql_real_escape_string)(MYSQL *mysql, char *to,const char *from, unsigned long length); |
832 | unsigned int (STDCALL *mysql_thread_safe)(void); |
833 | unsigned int (STDCALL *mysql_warning_count)(MYSQL *mysql); |
834 | const char * (STDCALL *mysql_sqlstate)(MYSQL *mysql); |
835 | int (STDCALL *mysql_server_init)(int argc, char **argv, char **groups); |
836 | void (STDCALL *mysql_server_end)(void); |
837 | void (STDCALL *mysql_thread_end)(void); |
838 | my_bool (STDCALL *mysql_thread_init)(void); |
839 | int (STDCALL *mysql_set_server_option)(MYSQL *mysql, enum enum_mysql_set_option option); |
840 | const char * (STDCALL *mysql_get_client_info)(void); |
841 | unsigned long (STDCALL *mysql_get_client_version)(void); |
842 | my_bool (STDCALL *mariadb_connection)(MYSQL *mysql); |
843 | const char * (STDCALL *mysql_get_server_name)(MYSQL *mysql); |
844 | MARIADB_CHARSET_INFO * (STDCALL *mariadb_get_charset_by_name)(const char *csname); |
845 | MARIADB_CHARSET_INFO * (STDCALL *mariadb_get_charset_by_nr)(unsigned int csnr); |
846 | size_t (STDCALL *mariadb_convert_string)(const char *from, size_t *from_len, MARIADB_CHARSET_INFO *from_cs, char *to, size_t *to_len, MARIADB_CHARSET_INFO *to_cs, int *errorcode); |
847 | int (*mysql_optionsv)(MYSQL *mysql,enum mysql_option option, ...); |
848 | int (*mysql_get_optionv)(MYSQL *mysql, enum mysql_option option, void *arg, ...); |
849 | int (STDCALL *mysql_get_option)(MYSQL *mysql, enum mysql_option option, void *arg); |
850 | unsigned long (STDCALL *mysql_hex_string)(char *to, const char *from, unsigned long len); |
851 | my_socket (STDCALL *mysql_get_socket)(MYSQL *mysql); |
852 | unsigned int (STDCALL *mysql_get_timeout_value)(const MYSQL *mysql); |
853 | unsigned int (STDCALL *mysql_get_timeout_value_ms)(const MYSQL *mysql); |
854 | my_bool (STDCALL *mariadb_reconnect)(MYSQL *mysql); |
855 | MYSQL_STMT * (STDCALL *mysql_stmt_init)(MYSQL *mysql); |
856 | int (STDCALL *mysql_stmt_prepare)(MYSQL_STMT *stmt, const char *query, unsigned long length); |
857 | int (STDCALL *mysql_stmt_execute)(MYSQL_STMT *stmt); |
858 | int (STDCALL *mysql_stmt_fetch)(MYSQL_STMT *stmt); |
859 | int (STDCALL *mysql_stmt_fetch_column)(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, unsigned int column, unsigned long offset); |
860 | int (STDCALL *mysql_stmt_store_result)(MYSQL_STMT *stmt); |
861 | unsigned long (STDCALL *mysql_stmt_param_count)(MYSQL_STMT * stmt); |
862 | my_bool (STDCALL *mysql_stmt_attr_set)(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, const void *attr); |
863 | my_bool (STDCALL *mysql_stmt_attr_get)(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, void *attr); |
864 | my_bool (STDCALL *mysql_stmt_bind_param)(MYSQL_STMT * stmt, MYSQL_BIND * bnd); |
865 | my_bool (STDCALL *mysql_stmt_bind_result)(MYSQL_STMT * stmt, MYSQL_BIND * bnd); |
866 | my_bool (STDCALL *mysql_stmt_close)(MYSQL_STMT * stmt); |
867 | my_bool (STDCALL *mysql_stmt_reset)(MYSQL_STMT * stmt); |
868 | my_bool (STDCALL *mysql_stmt_free_result)(MYSQL_STMT *stmt); |
869 | my_bool (STDCALL *mysql_stmt_send_long_data)(MYSQL_STMT *stmt, unsigned int param_number, const char *data, unsigned long length); |
870 | MYSQL_RES *(STDCALL *mysql_stmt_result_metadata)(MYSQL_STMT *stmt); |
871 | MYSQL_RES *(STDCALL *mysql_stmt_param_metadata)(MYSQL_STMT *stmt); |
872 | unsigned int (STDCALL *mysql_stmt_errno)(MYSQL_STMT * stmt); |
873 | const char *(STDCALL *mysql_stmt_error)(MYSQL_STMT * stmt); |
874 | const char *(STDCALL *mysql_stmt_sqlstate)(MYSQL_STMT * stmt); |
875 | MYSQL_ROW_OFFSET (STDCALL *mysql_stmt_row_seek)(MYSQL_STMT *stmt, MYSQL_ROW_OFFSET offset); |
876 | MYSQL_ROW_OFFSET (STDCALL *mysql_stmt_row_tell)(MYSQL_STMT *stmt); |
877 | void (STDCALL *mysql_stmt_data_seek)(MYSQL_STMT *stmt, unsigned long long offset); |
878 | unsigned long long (STDCALL *mysql_stmt_num_rows)(MYSQL_STMT *stmt); |
879 | unsigned long long (STDCALL *mysql_stmt_affected_rows)(MYSQL_STMT *stmt); |
880 | unsigned long long (STDCALL *mysql_stmt_insert_id)(MYSQL_STMT *stmt); |
881 | unsigned int (STDCALL *mysql_stmt_field_count)(MYSQL_STMT *stmt); |
882 | int (STDCALL *mysql_stmt_next_result)(MYSQL_STMT *stmt); |
883 | my_bool (STDCALL *mysql_stmt_more_results)(MYSQL_STMT *stmt); |
884 | int (STDCALL *mariadb_stmt_execute_direct)(MYSQL_STMT *stmt, const char *stmtstr, size_t length); |
885 | int (STDCALL *mysql_reset_connection)(MYSQL *mysql); |
886 | }; |
887 | |
888 | /* these methods can be overwritten by db plugins */ |
889 | struct st_mariadb_methods { |
890 | MYSQL *(*db_connect)(MYSQL *mysql, const char *host, const char *user, const char *passwd, |
891 | const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag); |
892 | void (*db_close)(MYSQL *mysql); |
893 | int (*db_command)(MYSQL *mysql,enum enum_server_command command, const char *arg, |
894 | size_t length, my_bool skip_check, void *opt_arg); |
895 | void (*db_skip_result)(MYSQL *mysql); |
896 | int (*db_read_query_result)(MYSQL *mysql); |
897 | MYSQL_DATA *(*db_read_rows)(MYSQL *mysql,MYSQL_FIELD *fields, unsigned int field_count); |
898 | int (*db_read_one_row)(MYSQL *mysql,unsigned int fields,MYSQL_ROW row, unsigned long *lengths); |
899 | /* prepared statements */ |
900 | my_bool (*db_supported_buffer_type)(enum enum_field_types type); |
901 | my_bool (*db_read_prepare_response)(MYSQL_STMT *stmt); |
902 | int (*db_read_stmt_result)(MYSQL *mysql); |
903 | my_bool (*db_stmt_get_result_metadata)(MYSQL_STMT *stmt); |
904 | my_bool (*db_stmt_get_param_metadata)(MYSQL_STMT *stmt); |
905 | int (*db_stmt_read_all_rows)(MYSQL_STMT *stmt); |
906 | int (*db_stmt_fetch)(MYSQL_STMT *stmt, unsigned char **row); |
907 | int (*db_stmt_fetch_to_bind)(MYSQL_STMT *stmt, unsigned char *row); |
908 | void (*db_stmt_flush_unbuffered)(MYSQL_STMT *stmt); |
909 | void (*set_error)(MYSQL *mysql, unsigned int error_nr, const char *sqlstate, const char *format, ...); |
910 | void (*invalidate_stmts)(MYSQL *mysql, const char *function_name); |
911 | struct st_mariadb_api *api; |
912 | int (*db_read_execute_response)(MYSQL_STMT *stmt); |
913 | unsigned char* (*db_execute_generate_request)(MYSQL_STMT *stmt, size_t *request_len, my_bool internal); |
914 | }; |
915 | |
916 | /* synonyms/aliases functions */ |
917 | #define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) |
918 | #define mysql_library_init mysql_server_init |
919 | #define mysql_library_end mysql_server_end |
920 | #define mariadb_connect(hdl, conn_str) mysql_real_connect((hdl),(conn_str), NULL, NULL, NULL, 0, NULL, 0) |
921 | |
922 | /* new api functions */ |
923 | |
924 | #define HAVE_MYSQL_REAL_CONNECT |
925 | |
926 | |
927 | #ifdef __cplusplus |
928 | } |
929 | #endif |
930 | |
931 | #endif |
932 | |