mysql.h 40 KB

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