9
3

mysql.h.pp 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. typedef char my_bool;
  2. typedef int my_socket;
  3. enum enum_server_command
  4. {
  5. COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST,
  6. COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS,
  7. COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING,
  8. COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP,
  9. COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE,
  10. COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE,
  11. COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON,
  12. COM_END
  13. };
  14. struct st_vio;
  15. typedef struct st_vio Vio;
  16. typedef struct st_net {
  17. Vio *vio;
  18. unsigned char *buff,*buff_end,*write_pos,*read_pos;
  19. my_socket fd;
  20. unsigned long remain_in_buf,length, buf_length, where_b;
  21. unsigned long max_packet,max_packet_size;
  22. unsigned int pkt_nr,compress_pkt_nr;
  23. unsigned int write_timeout, read_timeout, retry_count;
  24. int fcntl;
  25. unsigned int *return_status;
  26. unsigned char reading_or_writing;
  27. char save_char;
  28. char net_skip_rest_factor;
  29. my_bool thread_specific_malloc;
  30. unsigned char compress;
  31. my_bool unused3;
  32. void *thd;
  33. unsigned int last_errno;
  34. unsigned char error;
  35. my_bool unused4;
  36. my_bool unused5;
  37. char last_error[512];
  38. char sqlstate[5 +1];
  39. void *extension;
  40. } NET;
  41. enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
  42. MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG,
  43. MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE,
  44. MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP,
  45. MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24,
  46. MYSQL_TYPE_DATE, MYSQL_TYPE_TIME,
  47. MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR,
  48. MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR,
  49. MYSQL_TYPE_BIT,
  50. MYSQL_TYPE_TIMESTAMP2,
  51. MYSQL_TYPE_DATETIME2,
  52. MYSQL_TYPE_TIME2,
  53. MYSQL_TYPE_NEWDECIMAL=246,
  54. MYSQL_TYPE_ENUM=247,
  55. MYSQL_TYPE_SET=248,
  56. MYSQL_TYPE_TINY_BLOB=249,
  57. MYSQL_TYPE_MEDIUM_BLOB=250,
  58. MYSQL_TYPE_LONG_BLOB=251,
  59. MYSQL_TYPE_BLOB=252,
  60. MYSQL_TYPE_VAR_STRING=253,
  61. MYSQL_TYPE_STRING=254,
  62. MYSQL_TYPE_GEOMETRY=255
  63. };
  64. enum mysql_enum_shutdown_level {
  65. SHUTDOWN_DEFAULT = 0,
  66. SHUTDOWN_WAIT_CONNECTIONS= (unsigned char)(1 << 0),
  67. SHUTDOWN_WAIT_TRANSACTIONS= (unsigned char)(1 << 1),
  68. SHUTDOWN_WAIT_UPDATES= (unsigned char)(1 << 3),
  69. SHUTDOWN_WAIT_ALL_BUFFERS= ((unsigned char)(1 << 3) << 1),
  70. SHUTDOWN_WAIT_CRITICAL_BUFFERS= ((unsigned char)(1 << 3) << 1) + 1
  71. };
  72. enum enum_cursor_type
  73. {
  74. CURSOR_TYPE_NO_CURSOR= 0,
  75. CURSOR_TYPE_READ_ONLY= 1,
  76. CURSOR_TYPE_FOR_UPDATE= 2,
  77. CURSOR_TYPE_SCROLLABLE= 4
  78. };
  79. enum enum_mysql_set_option
  80. {
  81. MYSQL_OPTION_MULTI_STATEMENTS_ON,
  82. MYSQL_OPTION_MULTI_STATEMENTS_OFF
  83. };
  84. my_bool my_net_init(NET *net, Vio* vio, void *thd, unsigned int my_flags);
  85. void my_net_local_init(NET *net);
  86. void net_end(NET *net);
  87. void net_clear(NET *net, my_bool clear_buffer);
  88. my_bool net_realloc(NET *net, size_t length);
  89. my_bool net_flush(NET *net);
  90. my_bool my_net_write(NET *net,const unsigned char *packet, size_t len);
  91. my_bool net_write_command(NET *net,unsigned char command,
  92. const unsigned char *header, size_t head_len,
  93. const unsigned char *packet, size_t len);
  94. int net_real_write(NET *net,const unsigned char *packet, size_t len);
  95. unsigned long my_net_read_packet(NET *net, my_bool read_from_server);
  96. struct sockaddr;
  97. int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen,
  98. unsigned int timeout);
  99. struct my_rnd_struct;
  100. enum Item_result
  101. {
  102. STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT,
  103. TIME_RESULT
  104. };
  105. typedef struct st_udf_args
  106. {
  107. unsigned int arg_count;
  108. enum Item_result *arg_type;
  109. char **args;
  110. unsigned long *lengths;
  111. char *maybe_null;
  112. char **attributes;
  113. unsigned long *attribute_lengths;
  114. void *extension;
  115. } UDF_ARGS;
  116. typedef struct st_udf_init
  117. {
  118. my_bool maybe_null;
  119. unsigned int decimals;
  120. unsigned long max_length;
  121. char *ptr;
  122. my_bool const_item;
  123. void *extension;
  124. } UDF_INIT;
  125. void create_random_string(char *to, unsigned int length,
  126. struct my_rnd_struct *rand_st);
  127. void hash_password(unsigned long *to, const char *password, unsigned int password_len);
  128. void make_scrambled_password_323(char *to, const char *password);
  129. void scramble_323(char *to, const char *message, const char *password);
  130. my_bool check_scramble_323(const unsigned char *reply, const char *message,
  131. unsigned long *salt);
  132. void get_salt_from_password_323(unsigned long *res, const char *password);
  133. void make_scrambled_password(char *to, const char *password);
  134. void scramble(char *to, const char *message, const char *password);
  135. my_bool check_scramble(const unsigned char *reply, const char *message,
  136. const unsigned char *hash_stage2);
  137. void get_salt_from_password(unsigned char *res, const char *password);
  138. char *octet2hex(char *to, const char *str, unsigned int len);
  139. char *get_tty_password(const char *opt_message);
  140. void get_tty_password_buff(const char *opt_message, char *to, size_t length);
  141. const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
  142. my_bool my_thread_init(void);
  143. void my_thread_end(void);
  144. typedef long my_time_t;
  145. enum enum_mysql_timestamp_type
  146. {
  147. MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
  148. MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
  149. };
  150. typedef struct st_mysql_time
  151. {
  152. unsigned int year, month, day, hour, minute, second;
  153. unsigned long second_part;
  154. my_bool neg;
  155. enum enum_mysql_timestamp_type time_type;
  156. } MYSQL_TIME;
  157. typedef struct st_list {
  158. struct st_list *prev,*next;
  159. void *data;
  160. } LIST;
  161. typedef int (*list_walk_action)(void *,void *);
  162. extern LIST *list_add(LIST *root,LIST *element);
  163. extern LIST *list_delete(LIST *root,LIST *element);
  164. extern LIST *list_cons(void *data,LIST *root);
  165. extern LIST *list_reverse(LIST *root);
  166. extern void list_free(LIST *root,unsigned int free_data);
  167. extern unsigned int list_length(LIST *);
  168. extern int list_walk(LIST *,list_walk_action action,unsigned char * argument);
  169. extern unsigned int mariadb_deinitialize_ssl;
  170. extern unsigned int mysql_port;
  171. extern char *mysql_unix_port;
  172. typedef struct st_mysql_field {
  173. char *name;
  174. char *org_name;
  175. char *table;
  176. char *org_table;
  177. char *db;
  178. char *catalog;
  179. char *def;
  180. unsigned long length;
  181. unsigned long max_length;
  182. unsigned int name_length;
  183. unsigned int org_name_length;
  184. unsigned int table_length;
  185. unsigned int org_table_length;
  186. unsigned int db_length;
  187. unsigned int catalog_length;
  188. unsigned int def_length;
  189. unsigned int flags;
  190. unsigned int decimals;
  191. unsigned int charsetnr;
  192. enum enum_field_types type;
  193. void *extension;
  194. } MYSQL_FIELD;
  195. typedef char **MYSQL_ROW;
  196. typedef unsigned int MYSQL_FIELD_OFFSET;
  197. typedef unsigned long long my_ulonglong;
  198. typedef struct st_used_mem
  199. {
  200. struct st_used_mem *next;
  201. size_t left;
  202. size_t size;
  203. } USED_MEM;
  204. typedef struct st_mem_root
  205. {
  206. USED_MEM *free;
  207. USED_MEM *used;
  208. USED_MEM *pre_alloc;
  209. size_t min_malloc;
  210. size_t block_size;
  211. unsigned int block_num;
  212. unsigned int first_block_usage;
  213. void (*error_handler)(void);
  214. } MEM_ROOT;
  215. typedef struct st_typelib {
  216. unsigned int count;
  217. const char *name;
  218. const char **type_names;
  219. unsigned int *type_lengths;
  220. } TYPELIB;
  221. extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
  222. extern int find_type_with_warning(const char *x, TYPELIB *typelib,
  223. const char *option);
  224. extern int find_type_or_exit(const char *x, TYPELIB *typelib,
  225. const char *option);
  226. extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
  227. extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
  228. extern const char *get_type(TYPELIB *typelib,unsigned int nr);
  229. extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
  230. extern TYPELIB sql_protocol_typelib;
  231. my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name,
  232. my_ulonglong cur_set, my_ulonglong default_set,
  233. const char *str, unsigned int length,
  234. char **err_pos, unsigned int *err_len);
  235. typedef struct st_mysql_rows {
  236. struct st_mysql_rows *next;
  237. MYSQL_ROW data;
  238. unsigned long length;
  239. } MYSQL_ROWS;
  240. typedef MYSQL_ROWS *MYSQL_ROW_OFFSET;
  241. typedef struct embedded_query_result EMBEDDED_QUERY_RESULT;
  242. typedef struct st_mysql_data {
  243. MYSQL_ROWS *data;
  244. struct embedded_query_result *embedded_info;
  245. MEM_ROOT alloc;
  246. my_ulonglong rows;
  247. unsigned int fields;
  248. void *extension;
  249. } MYSQL_DATA;
  250. enum mysql_option
  251. {
  252. MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE,
  253. MYSQL_INIT_COMMAND, MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,
  254. MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_OPT_LOCAL_INFILE,
  255. MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT,
  256. MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT,
  257. MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION,
  258. MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP, MYSQL_SECURE_AUTH,
  259. MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT,
  260. MYSQL_OPT_SSL_VERIFY_SERVER_CERT, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH,
  261. MYSQL_OPT_BIND,
  262. MYSQL_OPT_SSL_KEY, MYSQL_OPT_SSL_CERT,
  263. MYSQL_OPT_SSL_CA, MYSQL_OPT_SSL_CAPATH, MYSQL_OPT_SSL_CIPHER,
  264. MYSQL_OPT_SSL_CRL, MYSQL_OPT_SSL_CRLPATH,
  265. MYSQL_OPT_CONNECT_ATTR_RESET, MYSQL_OPT_CONNECT_ATTR_ADD,
  266. MYSQL_OPT_CONNECT_ATTR_DELETE,
  267. MYSQL_SERVER_PUBLIC_KEY,
  268. MYSQL_ENABLE_CLEARTEXT_PLUGIN,
  269. MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
  270. MYSQL_PROGRESS_CALLBACK=5999,
  271. MYSQL_OPT_NONBLOCK,
  272. MYSQL_OPT_USE_THREAD_SPECIFIC_MEMORY
  273. };
  274. struct st_mysql_options_extention;
  275. struct st_mysql_options {
  276. unsigned int connect_timeout, read_timeout, write_timeout;
  277. unsigned int port, protocol;
  278. unsigned long client_flag;
  279. char *host,*user,*password,*unix_socket,*db;
  280. struct st_dynamic_array *init_commands;
  281. char *my_cnf_file,*my_cnf_group, *charset_dir, *charset_name;
  282. char *ssl_key;
  283. char *ssl_cert;
  284. char *ssl_ca;
  285. char *ssl_capath;
  286. char *ssl_cipher;
  287. char *shared_memory_base_name;
  288. unsigned long max_allowed_packet;
  289. my_bool use_ssl;
  290. my_bool compress,named_pipe;
  291. my_bool use_thread_specific_memory;
  292. my_bool unused2;
  293. my_bool unused3;
  294. my_bool unused4;
  295. enum mysql_option methods_to_use;
  296. char *client_ip;
  297. my_bool secure_auth;
  298. my_bool report_data_truncation;
  299. int (*local_infile_init)(void **, const char *, void *);
  300. int (*local_infile_read)(void *, char *, unsigned int);
  301. void (*local_infile_end)(void *);
  302. int (*local_infile_error)(void *, char *, unsigned int);
  303. void *local_infile_userdata;
  304. struct st_mysql_options_extention *extension;
  305. };
  306. enum mysql_status
  307. {
  308. MYSQL_STATUS_READY, MYSQL_STATUS_GET_RESULT, MYSQL_STATUS_USE_RESULT,
  309. MYSQL_STATUS_STATEMENT_GET_RESULT
  310. };
  311. enum mysql_protocol_type
  312. {
  313. MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
  314. MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
  315. };
  316. typedef struct character_set
  317. {
  318. unsigned int number;
  319. unsigned int state;
  320. const char *csname;
  321. const char *name;
  322. const char *comment;
  323. const char *dir;
  324. unsigned int mbminlen;
  325. unsigned int mbmaxlen;
  326. } MY_CHARSET_INFO;
  327. struct st_mysql_methods;
  328. struct st_mysql_stmt;
  329. typedef struct st_mysql
  330. {
  331. NET net;
  332. unsigned char *connector_fd;
  333. char *host,*user,*passwd,*unix_socket,*server_version,*host_info;
  334. char *info, *db;
  335. const struct charset_info_st *charset;
  336. MYSQL_FIELD *fields;
  337. MEM_ROOT field_alloc;
  338. my_ulonglong affected_rows;
  339. my_ulonglong insert_id;
  340. my_ulonglong extra_info;
  341. unsigned long thread_id;
  342. unsigned long packet_length;
  343. unsigned int port;
  344. unsigned long client_flag,server_capabilities;
  345. unsigned int protocol_version;
  346. unsigned int field_count;
  347. unsigned int server_status;
  348. unsigned int server_language;
  349. unsigned int warning_count;
  350. struct st_mysql_options options;
  351. enum mysql_status status;
  352. my_bool free_me;
  353. my_bool reconnect;
  354. char scramble[20 +1];
  355. my_bool unused1;
  356. void *unused2, *unused3, *unused4, *unused5;
  357. LIST *stmts;
  358. const struct st_mysql_methods *methods;
  359. void *thd;
  360. my_bool *unbuffered_fetch_owner;
  361. char *info_buffer;
  362. void *extension;
  363. } MYSQL;
  364. typedef struct st_mysql_res {
  365. my_ulonglong row_count;
  366. MYSQL_FIELD *fields;
  367. MYSQL_DATA *data;
  368. MYSQL_ROWS *data_cursor;
  369. unsigned long *lengths;
  370. MYSQL *handle;
  371. const struct st_mysql_methods *methods;
  372. MYSQL_ROW row;
  373. MYSQL_ROW current_row;
  374. MEM_ROOT field_alloc;
  375. unsigned int field_count, current_field;
  376. my_bool eof;
  377. my_bool unbuffered_fetch_cancelled;
  378. void *extension;
  379. } MYSQL_RES;
  380. typedef struct st_mysql_parameters
  381. {
  382. unsigned long *p_max_allowed_packet;
  383. unsigned long *p_net_buffer_length;
  384. void *extension;
  385. } MYSQL_PARAMETERS;
  386. int mysql_server_init(int argc, char **argv, char **groups);
  387. void mysql_server_end(void);
  388. MYSQL_PARAMETERS * mysql_get_parameters(void);
  389. my_bool mysql_thread_init(void);
  390. void mysql_thread_end(void);
  391. my_ulonglong mysql_num_rows(MYSQL_RES *res);
  392. unsigned int mysql_num_fields(MYSQL_RES *res);
  393. my_bool mysql_eof(MYSQL_RES *res);
  394. MYSQL_FIELD * mysql_fetch_field_direct(MYSQL_RES *res,
  395. unsigned int fieldnr);
  396. MYSQL_FIELD * mysql_fetch_fields(MYSQL_RES *res);
  397. MYSQL_ROW_OFFSET mysql_row_tell(MYSQL_RES *res);
  398. MYSQL_FIELD_OFFSET mysql_field_tell(MYSQL_RES *res);
  399. unsigned int mysql_field_count(MYSQL *mysql);
  400. my_ulonglong mysql_affected_rows(MYSQL *mysql);
  401. my_ulonglong mysql_insert_id(MYSQL *mysql);
  402. unsigned int mysql_errno(MYSQL *mysql);
  403. const char * mysql_error(MYSQL *mysql);
  404. const char * mysql_sqlstate(MYSQL *mysql);
  405. unsigned int mysql_warning_count(MYSQL *mysql);
  406. const char * mysql_info(MYSQL *mysql);
  407. unsigned long mysql_thread_id(MYSQL *mysql);
  408. const char * mysql_character_set_name(MYSQL *mysql);
  409. int mysql_set_character_set(MYSQL *mysql, const char *csname);
  410. int mysql_set_character_set_start(int *ret, MYSQL *mysql,
  411. const char *csname);
  412. int mysql_set_character_set_cont(int *ret, MYSQL *mysql,
  413. int status);
  414. MYSQL * mysql_init(MYSQL *mysql);
  415. my_bool mysql_ssl_set(MYSQL *mysql, const char *key,
  416. const char *cert, const char *ca,
  417. const char *capath, const char *cipher);
  418. const char * mysql_get_ssl_cipher(MYSQL *mysql);
  419. my_bool mysql_change_user(MYSQL *mysql, const char *user,
  420. const char *passwd, const char *db);
  421. int mysql_change_user_start(my_bool *ret, MYSQL *mysql,
  422. const char *user,
  423. const char *passwd,
  424. const char *db);
  425. int mysql_change_user_cont(my_bool *ret, MYSQL *mysql,
  426. int status);
  427. MYSQL * mysql_real_connect(MYSQL *mysql, const char *host,
  428. const char *user,
  429. const char *passwd,
  430. const char *db,
  431. unsigned int port,
  432. const char *unix_socket,
  433. unsigned long clientflag);
  434. int mysql_real_connect_start(MYSQL **ret, MYSQL *mysql,
  435. const char *host,
  436. const char *user,
  437. const char *passwd,
  438. const char *db,
  439. unsigned int port,
  440. const char *unix_socket,
  441. unsigned long clientflag);
  442. int mysql_real_connect_cont(MYSQL **ret, MYSQL *mysql,
  443. int status);
  444. int mysql_select_db(MYSQL *mysql, const char *db);
  445. int mysql_select_db_start(int *ret, MYSQL *mysql,
  446. const char *db);
  447. int mysql_select_db_cont(int *ret, MYSQL *mysql,
  448. int status);
  449. int mysql_query(MYSQL *mysql, const char *q);
  450. int mysql_query_start(int *ret, MYSQL *mysql,
  451. const char *q);
  452. int mysql_query_cont(int *ret, MYSQL *mysql,
  453. int status);
  454. int mysql_send_query(MYSQL *mysql, const char *q,
  455. unsigned long length);
  456. int mysql_send_query_start(int *ret, MYSQL *mysql,
  457. const char *q,
  458. unsigned long length);
  459. int mysql_send_query_cont(int *ret, MYSQL *mysql,
  460. int status);
  461. int mysql_real_query(MYSQL *mysql, const char *q,
  462. unsigned long length);
  463. int mysql_real_query_start(int *ret, MYSQL *mysql,
  464. const char *q,
  465. unsigned long length);
  466. int mysql_real_query_cont(int *ret, MYSQL *mysql,
  467. int status);
  468. MYSQL_RES * mysql_store_result(MYSQL *mysql);
  469. int mysql_store_result_start(MYSQL_RES **ret, MYSQL *mysql);
  470. int mysql_store_result_cont(MYSQL_RES **ret, MYSQL *mysql,
  471. int status);
  472. MYSQL_RES * mysql_use_result(MYSQL *mysql);
  473. void mysql_get_character_set_info(MYSQL *mysql,
  474. MY_CHARSET_INFO *charset);
  475. void
  476. mysql_set_local_infile_handler(MYSQL *mysql,
  477. int (*local_infile_init)(void **, const char *,
  478. void *),
  479. int (*local_infile_read)(void *, char *,
  480. unsigned int),
  481. void (*local_infile_end)(void *),
  482. int (*local_infile_error)(void *, char*,
  483. unsigned int),
  484. void *);
  485. void
  486. mysql_set_local_infile_default(MYSQL *mysql);
  487. int mysql_shutdown(MYSQL *mysql,
  488. enum mysql_enum_shutdown_level
  489. shutdown_level);
  490. int mysql_shutdown_start(int *ret, MYSQL *mysql,
  491. enum mysql_enum_shutdown_level
  492. shutdown_level);
  493. int mysql_shutdown_cont(int *ret, MYSQL *mysql,
  494. int status);
  495. int mysql_dump_debug_info(MYSQL *mysql);
  496. int mysql_dump_debug_info_start(int *ret, MYSQL *mysql);
  497. int mysql_dump_debug_info_cont(int *ret, MYSQL *mysql,
  498. int status);
  499. int mysql_refresh(MYSQL *mysql,
  500. unsigned int refresh_options);
  501. int mysql_refresh_start(int *ret, MYSQL *mysql,
  502. unsigned int refresh_options);
  503. int mysql_refresh_cont(int *ret, MYSQL *mysql, int status);
  504. int mysql_kill(MYSQL *mysql,unsigned long pid);
  505. int mysql_kill_start(int *ret, MYSQL *mysql,
  506. unsigned long pid);
  507. int mysql_kill_cont(int *ret, MYSQL *mysql, int status);
  508. int mysql_set_server_option(MYSQL *mysql,
  509. enum enum_mysql_set_option
  510. option);
  511. int mysql_set_server_option_start(int *ret, MYSQL *mysql,
  512. enum enum_mysql_set_option
  513. option);
  514. int mysql_set_server_option_cont(int *ret, MYSQL *mysql,
  515. int status);
  516. int mysql_ping(MYSQL *mysql);
  517. int mysql_ping_start(int *ret, MYSQL *mysql);
  518. int mysql_ping_cont(int *ret, MYSQL *mysql, int status);
  519. const char * mysql_stat(MYSQL *mysql);
  520. int mysql_stat_start(const char **ret, MYSQL *mysql);
  521. int mysql_stat_cont(const char **ret, MYSQL *mysql,
  522. int status);
  523. const char * mysql_get_server_info(MYSQL *mysql);
  524. const char * mysql_get_server_name(MYSQL *mysql);
  525. const char * mysql_get_client_info(void);
  526. unsigned long mysql_get_client_version(void);
  527. const char * mysql_get_host_info(MYSQL *mysql);
  528. unsigned long mysql_get_server_version(MYSQL *mysql);
  529. unsigned int mysql_get_proto_info(MYSQL *mysql);
  530. MYSQL_RES * mysql_list_dbs(MYSQL *mysql,const char *wild);
  531. int mysql_list_dbs_start(MYSQL_RES **ret, MYSQL *mysql,
  532. const char *wild);
  533. int mysql_list_dbs_cont(MYSQL_RES **ret, MYSQL *mysql,
  534. int status);
  535. MYSQL_RES * mysql_list_tables(MYSQL *mysql,const char *wild);
  536. int mysql_list_tables_start(MYSQL_RES **ret, MYSQL *mysql,
  537. const char *wild);
  538. int mysql_list_tables_cont(MYSQL_RES **ret, MYSQL *mysql,
  539. int status);
  540. MYSQL_RES * mysql_list_processes(MYSQL *mysql);
  541. int mysql_list_processes_start(MYSQL_RES **ret,
  542. MYSQL *mysql);
  543. int mysql_list_processes_cont(MYSQL_RES **ret, MYSQL *mysql,
  544. int status);
  545. int mysql_options(MYSQL *mysql,enum mysql_option option,
  546. const void *arg);
  547. int mysql_options4(MYSQL *mysql,enum mysql_option option,
  548. const void *arg1, const void *arg2);
  549. void mysql_free_result(MYSQL_RES *result);
  550. int mysql_free_result_start(MYSQL_RES *result);
  551. int mysql_free_result_cont(MYSQL_RES *result, int status);
  552. void mysql_data_seek(MYSQL_RES *result,
  553. my_ulonglong offset);
  554. MYSQL_ROW_OFFSET mysql_row_seek(MYSQL_RES *result,
  555. MYSQL_ROW_OFFSET offset);
  556. MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES *result,
  557. MYSQL_FIELD_OFFSET offset);
  558. MYSQL_ROW mysql_fetch_row(MYSQL_RES *result);
  559. int mysql_fetch_row_start(MYSQL_ROW *ret,
  560. MYSQL_RES *result);
  561. int mysql_fetch_row_cont(MYSQL_ROW *ret, MYSQL_RES *result,
  562. int status);
  563. unsigned long * mysql_fetch_lengths(MYSQL_RES *result);
  564. MYSQL_FIELD * mysql_fetch_field(MYSQL_RES *result);
  565. MYSQL_RES * mysql_list_fields(MYSQL *mysql, const char *table,
  566. const char *wild);
  567. int mysql_list_fields_start(MYSQL_RES **ret, MYSQL *mysql,
  568. const char *table,
  569. const char *wild);
  570. int mysql_list_fields_cont(MYSQL_RES **ret, MYSQL *mysql,
  571. int status);
  572. unsigned long mysql_escape_string(char *to,const char *from,
  573. unsigned long from_length);
  574. unsigned long mysql_hex_string(char *to,const char *from,
  575. unsigned long from_length);
  576. unsigned long mysql_real_escape_string(MYSQL *mysql,
  577. char *to,const char *from,
  578. unsigned long length);
  579. void mysql_debug(const char *debug);
  580. void myodbc_remove_escape(MYSQL *mysql,char *name);
  581. unsigned int mysql_thread_safe(void);
  582. my_bool mysql_embedded(void);
  583. my_bool mariadb_connection(MYSQL *mysql);
  584. my_bool mysql_read_query_result(MYSQL *mysql);
  585. int mysql_read_query_result_start(my_bool *ret,
  586. MYSQL *mysql);
  587. int mysql_read_query_result_cont(my_bool *ret,
  588. MYSQL *mysql, int status);
  589. enum enum_mysql_stmt_state
  590. {
  591. MYSQL_STMT_INIT_DONE= 1, MYSQL_STMT_PREPARE_DONE, MYSQL_STMT_EXECUTE_DONE,
  592. MYSQL_STMT_FETCH_DONE
  593. };
  594. typedef struct st_mysql_bind
  595. {
  596. unsigned long *length;
  597. my_bool *is_null;
  598. void *buffer;
  599. my_bool *error;
  600. unsigned char *row_ptr;
  601. void (*store_param_func)(NET *net, struct st_mysql_bind *param);
  602. void (*fetch_result)(struct st_mysql_bind *, MYSQL_FIELD *,
  603. unsigned char **row);
  604. void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *,
  605. unsigned char **row);
  606. unsigned long buffer_length;
  607. unsigned long offset;
  608. unsigned long length_value;
  609. unsigned int param_number;
  610. unsigned int pack_length;
  611. enum enum_field_types buffer_type;
  612. my_bool error_value;
  613. my_bool is_unsigned;
  614. my_bool long_data_used;
  615. my_bool is_null_value;
  616. void *extension;
  617. } MYSQL_BIND;
  618. struct st_mysql_stmt_extension;
  619. typedef struct st_mysql_stmt
  620. {
  621. MEM_ROOT mem_root;
  622. LIST list;
  623. MYSQL *mysql;
  624. MYSQL_BIND *params;
  625. MYSQL_BIND *bind;
  626. MYSQL_FIELD *fields;
  627. MYSQL_DATA result;
  628. MYSQL_ROWS *data_cursor;
  629. int (*read_row_func)(struct st_mysql_stmt *stmt,
  630. unsigned char **row);
  631. my_ulonglong affected_rows;
  632. my_ulonglong insert_id;
  633. unsigned long stmt_id;
  634. unsigned long flags;
  635. unsigned long prefetch_rows;
  636. unsigned int server_status;
  637. unsigned int last_errno;
  638. unsigned int param_count;
  639. unsigned int field_count;
  640. enum enum_mysql_stmt_state state;
  641. char last_error[512];
  642. char sqlstate[5 +1];
  643. my_bool send_types_to_server;
  644. my_bool bind_param_done;
  645. unsigned char bind_result_done;
  646. my_bool unbuffered_fetch_cancelled;
  647. my_bool update_max_length;
  648. struct st_mysql_stmt_extension *extension;
  649. } MYSQL_STMT;
  650. enum enum_stmt_attr_type
  651. {
  652. STMT_ATTR_UPDATE_MAX_LENGTH,
  653. STMT_ATTR_CURSOR_TYPE,
  654. STMT_ATTR_PREFETCH_ROWS
  655. };
  656. MYSQL_STMT * mysql_stmt_init(MYSQL *mysql);
  657. int mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
  658. unsigned long length);
  659. int mysql_stmt_prepare_start(int *ret, MYSQL_STMT *stmt,
  660. const char *query, unsigned long length);
  661. int mysql_stmt_prepare_cont(int *ret, MYSQL_STMT *stmt, int status);
  662. int mysql_stmt_execute(MYSQL_STMT *stmt);
  663. int mysql_stmt_execute_start(int *ret, MYSQL_STMT *stmt);
  664. int mysql_stmt_execute_cont(int *ret, MYSQL_STMT *stmt, int status);
  665. int mysql_stmt_fetch(MYSQL_STMT *stmt);
  666. int mysql_stmt_fetch_start(int *ret, MYSQL_STMT *stmt);
  667. int mysql_stmt_fetch_cont(int *ret, MYSQL_STMT *stmt, int status);
  668. int mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind_arg,
  669. unsigned int column,
  670. unsigned long offset);
  671. int mysql_stmt_store_result(MYSQL_STMT *stmt);
  672. int mysql_stmt_store_result_start(int *ret, MYSQL_STMT *stmt);
  673. int mysql_stmt_store_result_cont(int *ret, MYSQL_STMT *stmt,
  674. int status);
  675. unsigned long mysql_stmt_param_count(MYSQL_STMT * stmt);
  676. my_bool mysql_stmt_attr_set(MYSQL_STMT *stmt,
  677. enum enum_stmt_attr_type attr_type,
  678. const void *attr);
  679. my_bool mysql_stmt_attr_get(MYSQL_STMT *stmt,
  680. enum enum_stmt_attr_type attr_type,
  681. void *attr);
  682. my_bool mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
  683. my_bool mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
  684. my_bool mysql_stmt_close(MYSQL_STMT * stmt);
  685. int mysql_stmt_close_start(my_bool *ret, MYSQL_STMT *stmt);
  686. int mysql_stmt_close_cont(my_bool *ret, MYSQL_STMT * stmt, int status);
  687. my_bool mysql_stmt_reset(MYSQL_STMT * stmt);
  688. int mysql_stmt_reset_start(my_bool *ret, MYSQL_STMT * stmt);
  689. int mysql_stmt_reset_cont(my_bool *ret, MYSQL_STMT *stmt, int status);
  690. my_bool mysql_stmt_free_result(MYSQL_STMT *stmt);
  691. int mysql_stmt_free_result_start(my_bool *ret, MYSQL_STMT *stmt);
  692. int mysql_stmt_free_result_cont(my_bool *ret, MYSQL_STMT *stmt,
  693. int status);
  694. my_bool mysql_stmt_send_long_data(MYSQL_STMT *stmt,
  695. unsigned int param_number,
  696. const char *data,
  697. unsigned long length);
  698. int mysql_stmt_send_long_data_start(my_bool *ret, MYSQL_STMT *stmt,
  699. unsigned int param_number,
  700. const char *data,
  701. unsigned long len);
  702. int mysql_stmt_send_long_data_cont(my_bool *ret, MYSQL_STMT *stmt,
  703. int status);
  704. MYSQL_RES * mysql_stmt_result_metadata(MYSQL_STMT *stmt);
  705. MYSQL_RES * mysql_stmt_param_metadata(MYSQL_STMT *stmt);
  706. unsigned int mysql_stmt_errno(MYSQL_STMT * stmt);
  707. const char * mysql_stmt_error(MYSQL_STMT * stmt);
  708. const char * mysql_stmt_sqlstate(MYSQL_STMT * stmt);
  709. MYSQL_ROW_OFFSET mysql_stmt_row_seek(MYSQL_STMT *stmt,
  710. MYSQL_ROW_OFFSET offset);
  711. MYSQL_ROW_OFFSET mysql_stmt_row_tell(MYSQL_STMT *stmt);
  712. void mysql_stmt_data_seek(MYSQL_STMT *stmt, my_ulonglong offset);
  713. my_ulonglong mysql_stmt_num_rows(MYSQL_STMT *stmt);
  714. my_ulonglong mysql_stmt_affected_rows(MYSQL_STMT *stmt);
  715. my_ulonglong mysql_stmt_insert_id(MYSQL_STMT *stmt);
  716. unsigned int mysql_stmt_field_count(MYSQL_STMT *stmt);
  717. my_bool mysql_commit(MYSQL * mysql);
  718. int mysql_commit_start(my_bool *ret, MYSQL * mysql);
  719. int mysql_commit_cont(my_bool *ret, MYSQL * mysql, int status);
  720. my_bool mysql_rollback(MYSQL * mysql);
  721. int mysql_rollback_start(my_bool *ret, MYSQL * mysql);
  722. int mysql_rollback_cont(my_bool *ret, MYSQL * mysql, int status);
  723. my_bool mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
  724. int mysql_autocommit_start(my_bool *ret, MYSQL * mysql,
  725. my_bool auto_mode);
  726. int mysql_autocommit_cont(my_bool *ret, MYSQL * mysql, int status);
  727. my_bool mysql_more_results(MYSQL *mysql);
  728. int mysql_next_result(MYSQL *mysql);
  729. int mysql_next_result_start(int *ret, MYSQL *mysql);
  730. int mysql_next_result_cont(int *ret, MYSQL *mysql, int status);
  731. int mysql_stmt_next_result(MYSQL_STMT *stmt);
  732. int mysql_stmt_next_result_start(int *ret, MYSQL_STMT *stmt);
  733. int mysql_stmt_next_result_cont(int *ret, MYSQL_STMT *stmt, int status);
  734. void mysql_close_slow_part(MYSQL *mysql);
  735. void mysql_close(MYSQL *sock);
  736. int mysql_close_start(MYSQL *sock);
  737. int mysql_close_cont(MYSQL *sock, int status);
  738. my_socket mysql_get_socket(const MYSQL *mysql);
  739. unsigned int mysql_get_timeout_value(const MYSQL *mysql);
  740. unsigned int mysql_get_timeout_value_ms(const MYSQL *mysql);
  741. unsigned long mysql_net_read_packet(MYSQL *mysql);
  742. unsigned long mysql_net_field_length(unsigned char **packet);