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