2
0

mysql.h 40 KB

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