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