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