lnlidawei

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

[c][cpp]:  C/Cpp  connector  for  MariaDB

 

 

 

 

一、必要说明

 

  1、【  操作系统  】:  【 fedoral38 】

 

  2、【  mysql.h  】文件位置:  【  /usr/include/mysql/mysql.h  】

 

 

 

 

二、相关文档

 

  1、  C & C++ Connectors  --  https://mariadb.com/kb/en/mariadb-connector-c/

 

  2、  Training & Tutorials  --  https://mariadb.com/kb/en/training-tutorials/

 

 

 

 

三、【 mysql.h:  /usr/include/mysql/mysql.h 】头文件代码

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

 

 

四、参考资料

 

  1、  Knowledge Base of Mariadb  --  https://mariadb.com/kb/en/

 

  2、  connectors  --  https://mariadb.com/kb/en/connectors/

 

  3、  C & C++ Connectors  --  https://mariadb.com/kb/en/mariadb-connector-c/

 

  4、  Training & Tutorials  --  https://mariadb.com/kb/en/training-tutorials/

 

posted on 2024-01-19 07:07  lnlidawei  阅读(10)  评论(0编辑  收藏  举报