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