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
25extern "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>
40typedef char my_bool;
41typedef 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
56typedef 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
66typedef struct st_ma_const_string
67{
68 const char *str;
69 size_t length;
70} MARIADB_CONST_STRING;
71
72typedef 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
99extern unsigned int mysql_port;
100extern char *mysql_unix_port;
101extern 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)
150extern 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 MYSQL_OPT_ZSTD_COMPRESSION_LEVEL,
228
229 /* MariaDB-specific */
230 MYSQL_PROGRESS_CALLBACK=5999,
231 MYSQL_OPT_NONBLOCK,
232 /* MariaDB Connector/C specific */
233 MYSQL_DATABASE_DRIVER=7000,
234 MARIADB_OPT_SSL_FP, /* deprecated, use MARIADB_OPT_TLS_PEER_FP instead */
235 MARIADB_OPT_SSL_FP_LIST, /* deprecated, use MARIADB_OPT_TLS_PEER_FP_LIST instead */
236 MARIADB_OPT_TLS_PASSPHRASE, /* passphrase for encrypted certificates */
237 MARIADB_OPT_TLS_CIPHER_STRENGTH,
238 MARIADB_OPT_TLS_VERSION,
239 MARIADB_OPT_TLS_PEER_FP, /* single finger print for server certificate verification */
240 MARIADB_OPT_TLS_PEER_FP_LIST, /* finger print white list for server certificate verification */
241 MARIADB_OPT_CONNECTION_READ_ONLY,
242 MYSQL_OPT_CONNECT_ATTRS, /* for mysql_get_optionv */
243 MARIADB_OPT_USERDATA,
244 MARIADB_OPT_CONNECTION_HANDLER,
245 MARIADB_OPT_PORT,
246 MARIADB_OPT_UNIXSOCKET,
247 MARIADB_OPT_PASSWORD,
248 MARIADB_OPT_HOST,
249 MARIADB_OPT_USER,
250 MARIADB_OPT_SCHEMA,
251 MARIADB_OPT_DEBUG,
252 MARIADB_OPT_FOUND_ROWS,
253 MARIADB_OPT_MULTI_RESULTS,
254 MARIADB_OPT_MULTI_STATEMENTS,
255 MARIADB_OPT_INTERACTIVE,
256 MARIADB_OPT_PROXY_HEADER,
257 MARIADB_OPT_IO_WAIT,
258 MARIADB_OPT_SKIP_READ_RESPONSE,
259 MARIADB_OPT_RESTRICTED_AUTH,
260 MARIADB_OPT_RPL_REGISTER_REPLICA,
261 MARIADB_OPT_STATUS_CALLBACK,
262 MARIADB_OPT_SERVER_PLUGINS,
263 MARIADB_OPT_BULK_UNIT_RESULTS,
264 MARIADB_OPT_TLS_VERIFICATION_CALLBACK,
265 MARIADB_OPT_MAX_COLUMNS,
266 };
267
268 enum mariadb_value {
269 MARIADB_CHARSET_ID,
270 MARIADB_CHARSET_NAME,
271 MARIADB_CLIENT_ERRORS,
272 MARIADB_CLIENT_VERSION,
273 MARIADB_CLIENT_VERSION_ID,
274 MARIADB_CONNECTION_ASYNC_TIMEOUT,
275 MARIADB_CONNECTION_ASYNC_TIMEOUT_MS,
276 MARIADB_CONNECTION_MARIADB_CHARSET_INFO,
277 MARIADB_CONNECTION_ERROR,
278 MARIADB_CONNECTION_ERROR_ID,
279 MARIADB_CONNECTION_HOST,
280 MARIADB_CONNECTION_INFO,
281 MARIADB_CONNECTION_PORT,
282 MARIADB_CONNECTION_PROTOCOL_VERSION_ID,
283 MARIADB_CONNECTION_PVIO_TYPE,
284 MARIADB_CONNECTION_SCHEMA,
285 MARIADB_CONNECTION_SERVER_TYPE,
286 MARIADB_CONNECTION_SERVER_VERSION,
287 MARIADB_CONNECTION_SERVER_VERSION_ID,
288 MARIADB_CONNECTION_SOCKET,
289 MARIADB_CONNECTION_SQLSTATE,
290 MARIADB_CONNECTION_SSL_CIPHER,
291 MARIADB_TLS_LIBRARY,
292 MARIADB_CONNECTION_TLS_VERSION,
293 MARIADB_CONNECTION_TLS_VERSION_ID,
294 MARIADB_CONNECTION_TYPE,
295 MARIADB_CONNECTION_UNIX_SOCKET,
296 MARIADB_CONNECTION_USER,
297 MARIADB_MAX_ALLOWED_PACKET,
298 MARIADB_NET_BUFFER_LENGTH,
299 MARIADB_CONNECTION_SERVER_STATUS,
300 MARIADB_CONNECTION_SERVER_CAPABILITIES,
301 MARIADB_CONNECTION_EXTENDED_SERVER_CAPABILITIES,
302 MARIADB_CONNECTION_CLIENT_CAPABILITIES,
303 MARIADB_CONNECTION_BYTES_READ,
304 MARIADB_CONNECTION_BYTES_SENT,
305 MARIADB_TLS_PEER_CERT_INFO,
306 MARIADB_TLS_VERIFY_STATUS
307 };
308
309 enum mysql_status { MYSQL_STATUS_READY,
310 MYSQL_STATUS_GET_RESULT,
311 MYSQL_STATUS_USE_RESULT,
312 MYSQL_STATUS_QUERY_SENT,
313 MYSQL_STATUS_SENDING_LOAD_DATA,
314 MYSQL_STATUS_FETCHING_DATA,
315 MYSQL_STATUS_NEXT_RESULT_PENDING,
316 MYSQL_STATUS_QUIT_SENT, /* object is "destroyed" at this stage */
317 MYSQL_STATUS_STMT_RESULT
318 };
319
320 enum mysql_protocol_type
321 {
322 MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
323 MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
324 };
325
326struct st_mysql_options {
327 unsigned int connect_timeout, read_timeout, write_timeout;
328 unsigned int port, protocol;
329 unsigned long client_flag;
330 char *host,*user,*password,*unix_socket,*db;
331 struct st_dynamic_array *init_command;
332 char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name;
333 char *ssl_key; /* PEM key file */
334 char *ssl_cert; /* PEM cert file */
335 char *ssl_ca; /* PEM CA file */
336 char *ssl_capath; /* PEM directory of CA-s? */
337 char *ssl_cipher;
338 char *shared_memory_base_name;
339 unsigned long max_allowed_packet;
340 my_bool use_ssl; /* if to use SSL or not */
341 my_bool compress,named_pipe;
342 my_bool reconnect, unused_1, unused_2, unused_3;
343 enum mysql_option methods_to_use;
344 char *bind_address;
345 my_bool secure_auth;
346 my_bool report_data_truncation;
347 /* function pointers for local infile support */
348 int (*local_infile_init)(void **, const char *, void *);
349 int (*local_infile_read)(void *, char *, unsigned int);
350 void (*local_infile_end)(void *);
351 int (*local_infile_error)(void *, char *, unsigned int);
352 void *local_infile_userdata;
353 struct st_mysql_options_extension *extension;
354};
355
356 typedef struct st_mysql {
357 NET net; /* Communication parameters */
358 void *unused_0;
359 char *host,*user,*passwd,*unix_socket,*server_version,*host_info;
360 char *info,*db;
361 const struct ma_charset_info_st *charset; /* character set */
362 MYSQL_FIELD *fields;
363 MA_MEM_ROOT field_alloc;
364 unsigned long long affected_rows;
365 unsigned long long insert_id; /* id if insert on table with NEXTNR */
366 unsigned long long extra_info; /* Used by mysqlshow */
367 unsigned long thread_id; /* Id for connection in server */
368 unsigned long packet_length;
369 unsigned int port;
370 unsigned long client_flag;
371 unsigned long server_capabilities;
372 unsigned int protocol_version;
373 unsigned int field_count;
374 unsigned int server_status;
375 unsigned int server_language;
376 unsigned int warning_count; /* warning count, added in 4.1 protocol */
377 struct st_mysql_options options;
378 enum mysql_status status;
379 my_bool free_me; /* If free in mysql_close */
380 my_bool unused_1;
381 char scramble_buff[20+ 1];
382 /* madded after 3.23.58 */
383 my_bool unused_2;
384 void *unused_3, *unused_4, *unused_5, *unused_6;
385 LIST *stmts;
386 const struct st_mariadb_methods *methods;
387 void *thd;
388 my_bool *unbuffered_fetch_owner;
389 char *info_buffer;
390 struct st_mariadb_extension *extension;
391} MYSQL;
392
393typedef struct st_mysql_res {
394 unsigned long long row_count;
395 unsigned int field_count, current_field;
396 MYSQL_FIELD *fields;
397 MYSQL_DATA *data;
398 MYSQL_ROWS *data_cursor;
399 MA_MEM_ROOT field_alloc;
400 MYSQL_ROW row; /* If unbuffered read */
401 MYSQL_ROW current_row; /* buffer to current row */
402 unsigned long *lengths; /* column lengths of current row */
403 MYSQL *handle; /* for unbuffered reads */
404 my_bool eof; /* Used my mysql_fetch_row */
405 my_bool is_ps;
406} MYSQL_RES;
407
408typedef struct
409{
410 unsigned long *p_max_allowed_packet;
411 unsigned long *p_net_buffer_length;
412 void *extension;
413} MYSQL_PARAMETERS;
414
415
416enum mariadb_field_attr_t
417{
418 MARIADB_FIELD_ATTR_DATA_TYPE_NAME= 0,
419 MARIADB_FIELD_ATTR_FORMAT_NAME= 1
420};
421
422#define MARIADB_FIELD_ATTR_LAST MARIADB_FIELD_ATTR_FORMAT_NAME
423
424
425int STDCALL mariadb_field_attr(MARIADB_CONST_STRING *attr,
426 const MYSQL_FIELD *field,
427 enum mariadb_field_attr_t type);
428
429#ifndef _mysql_time_h_
430enum enum_mysql_timestamp_type
431{
432 MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
433 MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
434};
435
436typedef struct st_mysql_time
437{
438 unsigned int year, month, day, hour, minute, second;
439 unsigned long second_part;
440 my_bool neg;
441 enum enum_mysql_timestamp_type time_type;
442} MYSQL_TIME;
443#define AUTO_SEC_PART_DIGITS 39
444#endif
445
446#define SEC_PART_DIGITS 6
447#define MARIADB_INVALID_SOCKET -1
448
449/* Asynchronous API constants */
450#define MYSQL_WAIT_READ 1
451#define MYSQL_WAIT_WRITE 2
452#define MYSQL_WAIT_EXCEPT 4
453#define MYSQL_WAIT_TIMEOUT 8
454
455#define MARIADB_TLS_VERIFY_OK 0
456#define MARIADB_TLS_VERIFY_TRUST 1
457#define MARIADB_TLS_VERIFY_HOST 2
458#define MARIADB_TLS_VERIFY_FINGERPRINT 4
459#define MARIADB_TLS_VERIFY_PERIOD 8
460#define MARIADB_TLS_VERIFY_REVOKED 16
461#define MARIADB_TLS_VERIFY_UNKNOWN 32
462#define MARIADB_TLS_VERIFY_ERROR 128 /* last */
463
464/* Length encoding return values, returned by mariadb_net_field_length */
465#define MARIADB_LENENC_OK 0
466#define MARIADB_LENENC_NULL 1 /* only returned if flag MARIADB_LENENC_FORBID_NULL was not set */
467#define MARIADB_LENENC_ERROR 2
468
469/* Flags for mariadb_net_field_length */
470#define MARIADB_LENENC_FORBID_NULL 1
471
472typedef struct character_set
473{
474 unsigned int number; /* character set number */
475 unsigned int state; /* character set state */
476 const char *csname; /* character set name */
477 const char *name; /* collation name */
478 const char *comment; /* comment */
479 const char *dir; /* character set directory */
480 unsigned int mbminlen; /* min. length for multibyte strings */
481 unsigned int mbmaxlen; /* max. length for multibyte strings */
482} MY_CHARSET_INFO;
483
484/* Local infile support functions */
485#define LOCAL_INFILE_ERROR_LEN 512
486
487#include "mariadb_stmt.h"
488
489#ifndef MYSQL_CLIENT_PLUGIN_HEADER
490#define MYSQL_CLIENT_PLUGIN_HEADER \
491 int type; \
492 unsigned int interface_version; \
493 const char *name; \
494 const char *author; \
495 const char *desc; \
496 unsigned int version[3]; \
497 const char *license; \
498 void *mysql_api; \
499 int (*init)(char *, size_t, int, va_list); \
500 int (*deinit)(void); \
501 int (*options)(const char *option, const void *);
502struct st_mysql_client_plugin
503{
504 MYSQL_CLIENT_PLUGIN_HEADER
505};
506
507enum mariadb_tls_verification {
508 MARIADB_VERIFY_NONE = 0,
509 MARIADB_VERIFY_PIPE,
510 MARIADB_VERIFY_UNIXSOCKET,
511 MARIADB_VERIFY_LOCALHOST,
512 MARIADB_VERIFY_FINGERPRINT,
513 MARIADB_VERIFY_PEER_CERT
514};
515
516typedef struct
517{
518 int version;
519 char *issuer;
520 char *subject;
521 char fingerprint[129];
522 struct tm not_before;
523 struct tm not_after;
524} MARIADB_X509_INFO;
525
526
527struct st_mysql_client_plugin *
528mysql_load_plugin(struct st_mysql *mysql, const char *name, int type,
529 int argc, ...);
530struct st_mysql_client_plugin * STDCALL
531mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type,
532 int argc, va_list args);
533struct st_mysql_client_plugin * STDCALL
534mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type);
535struct st_mysql_client_plugin * STDCALL
536mysql_client_register_plugin(struct st_mysql *mysql,
537 struct st_mysql_client_plugin *plugin);
538#endif
539
540
541void STDCALL mysql_set_local_infile_handler(MYSQL *mysql,
542 int (*local_infile_init)(void **, const char *, void *),
543 int (*local_infile_read)(void *, char *, unsigned int),
544 void (*local_infile_end)(void *),
545 int (*local_infile_error)(void *, char*, unsigned int),
546 void *);
547
548void mysql_set_local_infile_default(MYSQL *mysql);
549
550void my_set_error(MYSQL *mysql, unsigned int error_nr,
551 const char *sqlstate, const char *format, ...);
552/* Functions to get information from the MYSQL and MYSQL_RES structures */
553/* Should definitely be used if one uses shared libraries */
554
555my_ulonglong STDCALL mysql_num_rows(MYSQL_RES *res);
556unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
557my_bool STDCALL mysql_eof(MYSQL_RES *res);
558MYSQL_FIELD *STDCALL mysql_fetch_field_direct(MYSQL_RES *res,
559 unsigned int fieldnr);
560MYSQL_FIELD * STDCALL mysql_fetch_fields(MYSQL_RES *res);
561MYSQL_ROWS * STDCALL mysql_row_tell(MYSQL_RES *res);
562unsigned int STDCALL mysql_field_tell(MYSQL_RES *res);
563
564unsigned int STDCALL mysql_field_count(MYSQL *mysql);
565my_bool STDCALL mysql_more_results(MYSQL *mysql);
566int STDCALL mysql_next_result(MYSQL *mysql);
567my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql);
568my_bool STDCALL mysql_autocommit(MYSQL *mysql, my_bool mode);
569my_bool STDCALL mysql_commit(MYSQL *mysql);
570my_bool STDCALL mysql_rollback(MYSQL *mysql);
571my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql);
572unsigned int STDCALL mysql_errno(MYSQL *mysql);
573const char * STDCALL mysql_error(MYSQL *mysql);
574const char * STDCALL mysql_info(MYSQL *mysql);
575unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
576const char * STDCALL mysql_character_set_name(MYSQL *mysql);
577void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *cs);
578int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname);
579
580my_bool mariadb_get_infov(MYSQL *mysql, enum mariadb_value value, void *arg, ...);
581my_bool STDCALL mariadb_get_info(MYSQL *mysql, enum mariadb_value value, void *arg);
582MYSQL * STDCALL mysql_init(MYSQL *mysql);
583int STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
584 const char *cert, const char *ca,
585 const char *capath, const char *cipher);
586const char * STDCALL mysql_get_ssl_cipher(MYSQL *mysql);
587my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
588 const char *passwd, const char *db);
589MYSQL * STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
590 const char *user,
591 const char *passwd,
592 const char *db,
593 unsigned int port,
594 const char *unix_socket,
595 unsigned long clientflag);
596void STDCALL mysql_close(MYSQL *sock);
597int STDCALL mysql_select_db(MYSQL *mysql, const char *db);
598int STDCALL mysql_query(MYSQL *mysql, const char *q);
599int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
600 unsigned long length);
601my_bool STDCALL mysql_read_query_result(MYSQL *mysql);
602int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
603 unsigned long length);
604int STDCALL mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level);
605int STDCALL mysql_dump_debug_info(MYSQL *mysql);
606int STDCALL mysql_refresh(MYSQL *mysql,
607 unsigned int refresh_options);
608int STDCALL mysql_kill(MYSQL *mysql,unsigned long pid);
609int STDCALL mysql_ping(MYSQL *mysql);
610char * STDCALL mysql_stat(MYSQL *mysql);
611char * STDCALL mysql_get_server_info(MYSQL *mysql);
612unsigned long STDCALL mysql_get_server_version(MYSQL *mysql);
613char * STDCALL mysql_get_host_info(MYSQL *mysql);
614unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql);
615MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
616MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
617MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
618 const char *wild);
619MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql);
620MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
621MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql);
622int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
623 const void *arg);
624int STDCALL mysql_options4(MYSQL *mysql,enum mysql_option option,
625 const void *arg1, const void *arg2);
626void STDCALL mysql_free_result(MYSQL_RES *result);
627void STDCALL mysql_data_seek(MYSQL_RES *result,
628 unsigned long long offset);
629MYSQL_ROW_OFFSET STDCALL mysql_row_seek(MYSQL_RES *result, MYSQL_ROW_OFFSET);
630MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
631 MYSQL_FIELD_OFFSET offset);
632MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result);
633unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
634MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result);
635unsigned long STDCALL mysql_escape_string(char *to,const char *from,
636 unsigned long from_length);
637unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
638 char *to,const char *from,
639 unsigned long length);
640unsigned int STDCALL mysql_thread_safe(void);
641unsigned int STDCALL mysql_warning_count(MYSQL *mysql);
642const char * STDCALL mysql_sqlstate(MYSQL *mysql);
643int STDCALL mysql_server_init(int argc, char **argv, char **groups);
644void STDCALL mysql_server_end(void);
645void STDCALL mysql_thread_end(void);
646my_bool STDCALL mysql_thread_init(void);
647int STDCALL mysql_set_server_option(MYSQL *mysql,
648 enum enum_mysql_set_option option);
649const char * STDCALL mysql_get_client_info(void);
650unsigned long STDCALL mysql_get_client_version(void);
651my_bool STDCALL mariadb_connection(MYSQL *mysql);
652const char * STDCALL mysql_get_server_name(MYSQL *mysql);
653MARIADB_CHARSET_INFO * STDCALL mariadb_get_charset_by_name(const char *csname);
654MARIADB_CHARSET_INFO * STDCALL mariadb_get_charset_by_nr(unsigned int csnr);
655size_t STDCALL mariadb_convert_string(const char *from, size_t *from_len, MARIADB_CHARSET_INFO *from_cs,
656 char *to, size_t *to_len, MARIADB_CHARSET_INFO *to_cs, int *errorcode);
657int mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...);
658int mysql_get_optionv(MYSQL *mysql, enum mysql_option option, void *arg, ...);
659int STDCALL mysql_get_option(MYSQL *mysql, enum mysql_option option, void *arg);
660unsigned long STDCALL mysql_hex_string(char *to, const char *from, unsigned long len);
661my_socket STDCALL mysql_get_socket(MYSQL *mysql);
662unsigned int STDCALL mysql_get_timeout_value(const MYSQL *mysql);
663unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql);
664my_bool STDCALL mariadb_reconnect(MYSQL *mysql);
665int STDCALL mariadb_cancel(MYSQL *mysql);
666void STDCALL mysql_debug(const char *debug);
667unsigned long STDCALL mysql_net_read_packet(MYSQL *mysql);
668unsigned long STDCALL mysql_net_field_length(unsigned char **packet);
669int STDCALL mariadb_net_field_length(unsigned char **packet, const unsigned char *end, unsigned int flags,
670 unsigned long *length);
671my_bool STDCALL mysql_embedded(void);
672MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void);
673
674/* Async API */
675int STDCALL mysql_close_start(MYSQL *sock);
676int STDCALL mysql_close_cont(MYSQL *sock, int status);
677int STDCALL mysql_commit_start(my_bool *ret, MYSQL * mysql);
678int STDCALL mysql_commit_cont(my_bool *ret, MYSQL * mysql, int status);
679int STDCALL mysql_dump_debug_info_cont(int *ret, MYSQL *mysql, int ready_status);
680int STDCALL mysql_dump_debug_info_start(int *ret, MYSQL *mysql);
681int STDCALL mysql_rollback_start(my_bool *ret, MYSQL * mysql);
682int STDCALL mysql_rollback_cont(my_bool *ret, MYSQL * mysql, int status);
683int STDCALL mysql_autocommit_start(my_bool *ret, MYSQL * mysql,
684 my_bool auto_mode);
685int STDCALL mysql_list_fields_cont(MYSQL_RES **ret, MYSQL *mysql, int ready_status);
686int STDCALL mysql_list_fields_start(MYSQL_RES **ret, MYSQL *mysql, const char *table,
687 const char *wild);
688int STDCALL mysql_autocommit_cont(my_bool *ret, MYSQL * mysql, int status);
689int STDCALL mysql_next_result_start(int *ret, MYSQL *mysql);
690int STDCALL mysql_next_result_cont(int *ret, MYSQL *mysql, int status);
691int STDCALL mysql_select_db_start(int *ret, MYSQL *mysql, const char *db);
692int STDCALL mysql_select_db_cont(int *ret, MYSQL *mysql, int ready_status);
693int STDCALL mysql_stmt_warning_count(MYSQL_STMT *stmt);
694int STDCALL mysql_stmt_next_result_start(int *ret, MYSQL_STMT *stmt);
695int STDCALL mysql_stmt_next_result_cont(int *ret, MYSQL_STMT *stmt, int status);
696
697int STDCALL mysql_set_character_set_start(int *ret, MYSQL *mysql,
698 const char *csname);
699int STDCALL mysql_set_character_set_cont(int *ret, MYSQL *mysql,
700 int status);
701int STDCALL mysql_change_user_start(my_bool *ret, MYSQL *mysql,
702 const char *user,
703 const char *passwd,
704 const char *db);
705int STDCALL mysql_change_user_cont(my_bool *ret, MYSQL *mysql,
706 int status);
707int STDCALL mysql_real_connect_start(MYSQL **ret, MYSQL *mysql,
708 const char *host,
709 const char *user,
710 const char *passwd,
711 const char *db,
712 unsigned int port,
713 const char *unix_socket,
714 unsigned long clientflag);
715int STDCALL mysql_real_connect_cont(MYSQL **ret, MYSQL *mysql,
716 int status);
717int STDCALL mysql_query_start(int *ret, MYSQL *mysql,
718 const char *q);
719int STDCALL mysql_query_cont(int *ret, MYSQL *mysql,
720 int status);
721int STDCALL mysql_send_query_start(int *ret, MYSQL *mysql,
722 const char *q,
723 unsigned long length);
724int STDCALL mysql_send_query_cont(int *ret, MYSQL *mysql, int status);
725int STDCALL mysql_real_query_start(int *ret, MYSQL *mysql,
726 const char *q,
727 unsigned long length);
728int STDCALL mysql_real_query_cont(int *ret, MYSQL *mysql,
729 int status);
730int STDCALL mysql_store_result_start(MYSQL_RES **ret, MYSQL *mysql);
731int STDCALL mysql_store_result_cont(MYSQL_RES **ret, MYSQL *mysql,
732 int status);
733int STDCALL mysql_shutdown_start(int *ret, MYSQL *mysql,
734 enum mysql_enum_shutdown_level
735 shutdown_level);
736int STDCALL mysql_shutdown_cont(int *ret, MYSQL *mysql,
737 int status);
738int STDCALL mysql_refresh_start(int *ret, MYSQL *mysql,
739 unsigned int refresh_options);
740int STDCALL mysql_refresh_cont(int *ret, MYSQL *mysql, int status);
741int STDCALL mysql_kill_start(int *ret, MYSQL *mysql,
742 unsigned long pid);
743int STDCALL mysql_kill_cont(int *ret, MYSQL *mysql, int status);
744int STDCALL mysql_set_server_option_start(int *ret, MYSQL *mysql,
745 enum enum_mysql_set_option
746 option);
747int STDCALL mysql_set_server_option_cont(int *ret, MYSQL *mysql,
748 int status);
749int STDCALL mysql_ping_start(int *ret, MYSQL *mysql);
750int STDCALL mysql_ping_cont(int *ret, MYSQL *mysql, int status);
751int STDCALL mysql_stat_start(const char **ret, MYSQL *mysql);
752int STDCALL mysql_stat_cont(const char **ret, MYSQL *mysql,
753 int status);
754int STDCALL mysql_free_result_start(MYSQL_RES *result);
755int STDCALL mysql_free_result_cont(MYSQL_RES *result, int status);
756int STDCALL mysql_fetch_row_start(MYSQL_ROW *ret,
757 MYSQL_RES *result);
758int STDCALL mysql_fetch_row_cont(MYSQL_ROW *ret, MYSQL_RES *result,
759 int status);
760int STDCALL mysql_read_query_result_start(my_bool *ret,
761 MYSQL *mysql);
762int STDCALL mysql_read_query_result_cont(my_bool *ret,
763 MYSQL *mysql, int status);
764int STDCALL mysql_reset_connection_start(int *ret, MYSQL *mysql);
765int STDCALL mysql_reset_connection_cont(int *ret, MYSQL *mysql, int status);
766int STDCALL mysql_session_track_get_next(MYSQL *mysql, enum enum_session_state_type type, const char **data, size_t *length);
767int STDCALL mysql_session_track_get_first(MYSQL *mysql, enum enum_session_state_type type, const char **data, size_t *length);
768int STDCALL mysql_stmt_prepare_start(int *ret, MYSQL_STMT *stmt,const char *query, unsigned long length);
769int STDCALL mysql_stmt_prepare_cont(int *ret, MYSQL_STMT *stmt, int status);
770int STDCALL mysql_stmt_execute_start(int *ret, MYSQL_STMT *stmt);
771int STDCALL mysql_stmt_execute_cont(int *ret, MYSQL_STMT *stmt, int status);
772int STDCALL mysql_stmt_fetch_start(int *ret, MYSQL_STMT *stmt);
773int STDCALL mysql_stmt_fetch_cont(int *ret, MYSQL_STMT *stmt, int status);
774int STDCALL mysql_stmt_store_result_start(int *ret, MYSQL_STMT *stmt);
775int STDCALL mysql_stmt_store_result_cont(int *ret, MYSQL_STMT *stmt,int status);
776int STDCALL mysql_stmt_close_start(my_bool *ret, MYSQL_STMT *stmt);
777int STDCALL mysql_stmt_close_cont(my_bool *ret, MYSQL_STMT * stmt, int status);
778int STDCALL mysql_stmt_reset_start(my_bool *ret, MYSQL_STMT * stmt);
779int STDCALL mysql_stmt_reset_cont(my_bool *ret, MYSQL_STMT *stmt, int status);
780int STDCALL mysql_stmt_free_result_start(my_bool *ret, MYSQL_STMT *stmt);
781int STDCALL mysql_stmt_free_result_cont(my_bool *ret, MYSQL_STMT *stmt,
782 int status);
783int STDCALL mysql_stmt_send_long_data_start(my_bool *ret, MYSQL_STMT *stmt,
784 unsigned int param_number,
785 const char *data,
786 unsigned long len);
787int STDCALL mysql_stmt_send_long_data_cont(my_bool *ret, MYSQL_STMT *stmt,
788 int status);
789int STDCALL mysql_reset_connection(MYSQL *mysql);
790
791/* API function calls (used by dynamic plugins) */
792struct st_mariadb_api {
793 unsigned long long (STDCALL *mysql_num_rows)(MYSQL_RES *res);
794 unsigned int (STDCALL *mysql_num_fields)(MYSQL_RES *res);
795 my_bool (STDCALL *mysql_eof)(MYSQL_RES *res);
796 MYSQL_FIELD *(STDCALL *mysql_fetch_field_direct)(MYSQL_RES *res, unsigned int fieldnr);
797 MYSQL_FIELD * (STDCALL *mysql_fetch_fields)(MYSQL_RES *res);
798 MYSQL_ROWS * (STDCALL *mysql_row_tell)(MYSQL_RES *res);
799 unsigned int (STDCALL *mysql_field_tell)(MYSQL_RES *res);
800 unsigned int (STDCALL *mysql_field_count)(MYSQL *mysql);
801 my_bool (STDCALL *mysql_more_results)(MYSQL *mysql);
802 int (STDCALL *mysql_next_result)(MYSQL *mysql);
803 unsigned long long (STDCALL *mysql_affected_rows)(MYSQL *mysql);
804 my_bool (STDCALL *mysql_autocommit)(MYSQL *mysql, my_bool mode);
805 my_bool (STDCALL *mysql_commit)(MYSQL *mysql);
806 my_bool (STDCALL *mysql_rollback)(MYSQL *mysql);
807 unsigned long long (STDCALL *mysql_insert_id)(MYSQL *mysql);
808 unsigned int (STDCALL *mysql_errno)(MYSQL *mysql);
809 const char * (STDCALL *mysql_error)(MYSQL *mysql);
810 const char * (STDCALL *mysql_info)(MYSQL *mysql);
811 unsigned long (STDCALL *mysql_thread_id)(MYSQL *mysql);
812 const char * (STDCALL *mysql_character_set_name)(MYSQL *mysql);
813 void (STDCALL *mysql_get_character_set_info)(MYSQL *mysql, MY_CHARSET_INFO *cs);
814 int (STDCALL *mysql_set_character_set)(MYSQL *mysql, const char *csname);
815 my_bool (*mariadb_get_infov)(MYSQL *mysql, enum mariadb_value value, void *arg, ...);
816 my_bool (STDCALL *mariadb_get_info)(MYSQL *mysql, enum mariadb_value value, void *arg);
817 MYSQL * (STDCALL *mysql_init)(MYSQL *mysql);
818 int (STDCALL *mysql_ssl_set)(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher);
819 const char * (STDCALL *mysql_get_ssl_cipher)(MYSQL *mysql);
820 my_bool (STDCALL *mysql_change_user)(MYSQL *mysql, const char *user, const char *passwd, const char *db);
821 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);
822 void (STDCALL *mysql_close)(MYSQL *sock);
823 int (STDCALL *mysql_select_db)(MYSQL *mysql, const char *db);
824 int (STDCALL *mysql_query)(MYSQL *mysql, const char *q);
825 int (STDCALL *mysql_send_query)(MYSQL *mysql, const char *q, unsigned long length);
826 my_bool (STDCALL *mysql_read_query_result)(MYSQL *mysql);
827 int (STDCALL *mysql_real_query)(MYSQL *mysql, const char *q, unsigned long length);
828 int (STDCALL *mysql_shutdown)(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level);
829 int (STDCALL *mysql_dump_debug_info)(MYSQL *mysql);
830 int (STDCALL *mysql_refresh)(MYSQL *mysql, unsigned int refresh_options);
831 int (STDCALL *mysql_kill)(MYSQL *mysql,unsigned long pid);
832 int (STDCALL *mysql_ping)(MYSQL *mysql);
833 char * (STDCALL *mysql_stat)(MYSQL *mysql);
834 char * (STDCALL *mysql_get_server_info)(MYSQL *mysql);
835 unsigned long (STDCALL *mysql_get_server_version)(MYSQL *mysql);
836 char * (STDCALL *mysql_get_host_info)(MYSQL *mysql);
837 unsigned int (STDCALL *mysql_get_proto_info)(MYSQL *mysql);
838 MYSQL_RES * (STDCALL *mysql_list_dbs)(MYSQL *mysql,const char *wild);
839 MYSQL_RES * (STDCALL *mysql_list_tables)(MYSQL *mysql,const char *wild);
840 MYSQL_RES * (STDCALL *mysql_list_fields)(MYSQL *mysql, const char *table, const char *wild);
841 MYSQL_RES * (STDCALL *mysql_list_processes)(MYSQL *mysql);
842 MYSQL_RES * (STDCALL *mysql_store_result)(MYSQL *mysql);
843 MYSQL_RES * (STDCALL *mysql_use_result)(MYSQL *mysql);
844 int (STDCALL *mysql_options)(MYSQL *mysql,enum mysql_option option, const void *arg);
845 void (STDCALL *mysql_free_result)(MYSQL_RES *result);
846 void (STDCALL *mysql_data_seek)(MYSQL_RES *result, unsigned long long offset);
847 MYSQL_ROW_OFFSET (STDCALL *mysql_row_seek)(MYSQL_RES *result, MYSQL_ROW_OFFSET);
848 MYSQL_FIELD_OFFSET (STDCALL *mysql_field_seek)(MYSQL_RES *result, MYSQL_FIELD_OFFSET offset);
849 MYSQL_ROW (STDCALL *mysql_fetch_row)(MYSQL_RES *result);
850 unsigned long * (STDCALL *mysql_fetch_lengths)(MYSQL_RES *result);
851 MYSQL_FIELD * (STDCALL *mysql_fetch_field)(MYSQL_RES *result);
852 unsigned long (STDCALL *mysql_escape_string)(char *to,const char *from, unsigned long from_length);
853 unsigned long (STDCALL *mysql_real_escape_string)(MYSQL *mysql, char *to,const char *from, unsigned long length);
854 unsigned int (STDCALL *mysql_thread_safe)(void);
855 unsigned int (STDCALL *mysql_warning_count)(MYSQL *mysql);
856 const char * (STDCALL *mysql_sqlstate)(MYSQL *mysql);
857 int (STDCALL *mysql_server_init)(int argc, char **argv, char **groups);
858 void (STDCALL *mysql_server_end)(void);
859 void (STDCALL *mysql_thread_end)(void);
860 my_bool (STDCALL *mysql_thread_init)(void);
861 int (STDCALL *mysql_set_server_option)(MYSQL *mysql, enum enum_mysql_set_option option);
862 const char * (STDCALL *mysql_get_client_info)(void);
863 unsigned long (STDCALL *mysql_get_client_version)(void);
864 my_bool (STDCALL *mariadb_connection)(MYSQL *mysql);
865 const char * (STDCALL *mysql_get_server_name)(MYSQL *mysql);
866 MARIADB_CHARSET_INFO * (STDCALL *mariadb_get_charset_by_name)(const char *csname);
867 MARIADB_CHARSET_INFO * (STDCALL *mariadb_get_charset_by_nr)(unsigned int csnr);
868 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);
869 int (*mysql_optionsv)(MYSQL *mysql,enum mysql_option option, ...);
870 int (*mysql_get_optionv)(MYSQL *mysql, enum mysql_option option, void *arg, ...);
871 int (STDCALL *mysql_get_option)(MYSQL *mysql, enum mysql_option option, void *arg);
872 unsigned long (STDCALL *mysql_hex_string)(char *to, const char *from, unsigned long len);
873 my_socket (STDCALL *mysql_get_socket)(MYSQL *mysql);
874 unsigned int (STDCALL *mysql_get_timeout_value)(const MYSQL *mysql);
875 unsigned int (STDCALL *mysql_get_timeout_value_ms)(const MYSQL *mysql);
876 my_bool (STDCALL *mariadb_reconnect)(MYSQL *mysql);
877 MYSQL_STMT * (STDCALL *mysql_stmt_init)(MYSQL *mysql);
878 int (STDCALL *mysql_stmt_prepare)(MYSQL_STMT *stmt, const char *query, unsigned long length);
879 int (STDCALL *mysql_stmt_execute)(MYSQL_STMT *stmt);
880 int (STDCALL *mysql_stmt_fetch)(MYSQL_STMT *stmt);
881 int (STDCALL *mysql_stmt_fetch_column)(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg, unsigned int column, unsigned long offset);
882 int (STDCALL *mysql_stmt_store_result)(MYSQL_STMT *stmt);
883 unsigned long (STDCALL *mysql_stmt_param_count)(MYSQL_STMT * stmt);
884 my_bool (STDCALL *mysql_stmt_attr_set)(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, const void *attr);
885 my_bool (STDCALL *mysql_stmt_attr_get)(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, void *attr);
886 my_bool (STDCALL *mysql_stmt_bind_param)(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
887 my_bool (STDCALL *mysql_stmt_bind_result)(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
888 my_bool (STDCALL *mysql_stmt_close)(MYSQL_STMT * stmt);
889 my_bool (STDCALL *mysql_stmt_reset)(MYSQL_STMT * stmt);
890 my_bool (STDCALL *mysql_stmt_free_result)(MYSQL_STMT *stmt);
891 my_bool (STDCALL *mysql_stmt_send_long_data)(MYSQL_STMT *stmt, unsigned int param_number, const char *data, unsigned long length);
892 MYSQL_RES *(STDCALL *mysql_stmt_result_metadata)(MYSQL_STMT *stmt);
893 MYSQL_RES *(STDCALL *mysql_stmt_param_metadata)(MYSQL_STMT *stmt);
894 unsigned int (STDCALL *mysql_stmt_errno)(MYSQL_STMT * stmt);
895 const char *(STDCALL *mysql_stmt_error)(MYSQL_STMT * stmt);
896 const char *(STDCALL *mysql_stmt_sqlstate)(MYSQL_STMT * stmt);
897 MYSQL_ROW_OFFSET (STDCALL *mysql_stmt_row_seek)(MYSQL_STMT *stmt, MYSQL_ROW_OFFSET offset);
898 MYSQL_ROW_OFFSET (STDCALL *mysql_stmt_row_tell)(MYSQL_STMT *stmt);
899 void (STDCALL *mysql_stmt_data_seek)(MYSQL_STMT *stmt, unsigned long long offset);
900 unsigned long long (STDCALL *mysql_stmt_num_rows)(MYSQL_STMT *stmt);
901 unsigned long long (STDCALL *mysql_stmt_affected_rows)(MYSQL_STMT *stmt);
902 unsigned long long (STDCALL *mysql_stmt_insert_id)(MYSQL_STMT *stmt);
903 unsigned int (STDCALL *mysql_stmt_field_count)(MYSQL_STMT *stmt);
904 int (STDCALL *mysql_stmt_next_result)(MYSQL_STMT *stmt);
905 my_bool (STDCALL *mysql_stmt_more_results)(MYSQL_STMT *stmt);
906 int (STDCALL *mariadb_stmt_execute_direct)(MYSQL_STMT *stmt, const char *stmtstr, size_t length);
907 int (STDCALL *mysql_reset_connection)(MYSQL *mysql);
908};
909
910/* these methods can be overwritten by db plugins */
911struct st_mariadb_methods {
912 MYSQL *(*db_connect)(MYSQL *mysql, const char *host, const char *user, const char *passwd,
913 const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag);
914 void (*db_close)(MYSQL *mysql);
915 int (*db_command)(MYSQL *mysql,enum enum_server_command command, const char *arg,
916 size_t length, my_bool skip_check, void *opt_arg);
917 void (*db_skip_result)(MYSQL *mysql);
918 int (*db_read_query_result)(MYSQL *mysql);
919 MYSQL_DATA *(*db_read_rows)(MYSQL *mysql,MYSQL_FIELD *fields, unsigned int field_count);
920 int (*db_read_one_row)(MYSQL *mysql,unsigned int fields,MYSQL_ROW row, unsigned long *lengths);
921 /* prepared statements */
922 my_bool (*db_supported_buffer_type)(enum enum_field_types type);
923 my_bool (*db_read_prepare_response)(MYSQL_STMT *stmt);
924 int (*db_read_stmt_result)(MYSQL *mysql);
925 my_bool (*db_stmt_get_result_metadata)(MYSQL_STMT *stmt);
926 my_bool (*db_stmt_get_param_metadata)(MYSQL_STMT *stmt);
927 int (*db_stmt_read_all_rows)(MYSQL_STMT *stmt);
928 int (*db_stmt_fetch)(MYSQL_STMT *stmt, unsigned char **row, unsigned long *length);
929 int (*db_stmt_fetch_to_bind)(MYSQL_STMT *stmt, unsigned char *row, unsigned long length);
930 void (*db_stmt_flush_unbuffered)(MYSQL_STMT *stmt);
931 void (*set_error)(MYSQL *mysql, unsigned int error_nr, const char *sqlstate, const char *format, ...);
932 void (*invalidate_stmts)(MYSQL *mysql, const char *function_name);
933 struct st_mariadb_api *api;
934 int (*db_read_execute_response)(MYSQL_STMT *stmt);
935 unsigned char* (*db_execute_generate_request)(MYSQL_STMT *stmt, size_t *request_len, my_bool internal);
936};
937
938/* synonyms/aliases functions */
939#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)
940#define mysql_library_init mysql_server_init
941#define mysql_library_end mysql_server_end
942#define mariadb_connect(hdl, conn_str) mysql_real_connect((hdl),(conn_str), NULL, NULL, NULL, 0, NULL, 0)
943
944/* new api functions */
945
946#define HAVE_MYSQL_REAL_CONNECT
947
948
949#ifdef __cplusplus
950}
951#endif
952
953#endif
954