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