1 /*
2   +----------------------------------------------------------------------+
3   | Copyright (c) The PHP Group                                          |
4   +----------------------------------------------------------------------+
5   | This source file is subject to version 3.01 of the PHP license,      |
6   | that is bundled with this package in the file LICENSE, and is        |
7   | available through the world-wide-web at the following url:           |
8   | https://www.php.net/license/3_01.txt                                 |
9   | If you did not receive a copy of the PHP license and are unable to   |
10   | obtain it through the world-wide-web, please send a note to          |
11   | license@php.net so we can mail you a copy immediately.               |
12   +----------------------------------------------------------------------+
13   | Authors: Andrey Hristov <andrey@php.net>                             |
14   |          Ulf Wendel <uw@php.net>                                     |
15   |          Georg Richter <georg@php.net>                               |
16   +----------------------------------------------------------------------+
17 */
18 #ifndef MYSQLND_LIBMYSQL_COMPAT_H
19 #define MYSQLND_LIBMYSQL_COMPAT_H
20 
21 /* Global types and definitions*/
22 #define MYSQL_NO_DATA			MYSQLND_NO_DATA
23 #define MYSQL_DATA_TRUNCATED	MYSQLND_DATA_TRUNCATED
24 #define MYSQL_STMT				MYSQLND_STMT
25 #define MYSQL_FIELD				MYSQLND_FIELD
26 #define MYSQL_RES				MYSQLND_RES
27 #define MYSQL_ROW				MYSQLND_ROW_C
28 #define MYSQL					MYSQLND
29 #define my_bool					bool
30 #define my_ulonglong			uint64_t
31 
32 #define MYSQL_VERSION_ID		MYSQLND_VERSION_ID
33 #define MYSQL_SERVER_VERSION	PHP_MYSQLND_VERSION
34 #define MYSQL_ERRMSG_SIZE		MYSQLND_ERRMSG_SIZE
35 #define SQLSTATE_LENGTH			MYSQLND_SQLSTATE_LENGTH
36 
37 /* functions */
38 #define mysql_affected_rows(r)			mysqlnd_affected_rows((r))
39 #define mysql_autocommit(r,m)			mysqlnd_autocommit((r),(m))
40 #define mysql_change_user(r,a,b,c)		mysqlnd_change_user((r), (a), (b), (c), false)
41 #define mysql_character_set_name(c)		mysqlnd_character_set_name((c))
42 #define mysql_close(r)					mysqlnd_close((r), MYSQLND_CLOSE_EXPLICIT)
43 #define mysql_commit(r)					mysqlnd_commit((r), TRANS_COR_NO_OPT, NULL)
44 #define mysql_data_seek(r,o)			mysqlnd_data_seek((r),(o))
45 #define mysql_debug(x)					mysqlnd_debug((x))
46 #define mysql_dump_debug_info(r)		mysqlnd_dump_debug_info((r))
47 #define mysql_errno(r)					mysqlnd_errno((r))
48 #define mysql_error(r)					mysqlnd_error((r))
49 #define mysql_escape_string(a,b,c)		mysqlnd_escape_string((a), (b), (c))
50 #define mysql_fetch_field(r)			mysqlnd_fetch_field((r))
51 #define mysql_fetch_field_direct(r,o)	mysqlnd_fetch_field_direct((r), (o))
52 #define mysql_fetch_fields(r)			mysqlnd_fetch_fields((r))
53 #define mysql_fetch_lengths(r)			mysqlnd_fetch_lengths((r))
54 #define mysql_fetch_row(r)				mysqlnd_fetch_row_c((r))
55 #define mysql_field_count(r)			mysqlnd_field_count((r))
56 #define mysql_field_seek(r,o)			mysqlnd_field_seek((r), (o))
57 #define mysql_field_tell(r)				mysqlnd_field_tell((r))
58 #define mysql_init(a)					mysqlnd_connection_init((a), false)
59 #define mysql_insert_id(r)				mysqlnd_insert_id((r))
60 #define mysql_kill(r,n)					mysqlnd_kill((r), (n))
61 #define mysql_list_dbs(c, wild)			mysqlnd_list_dbs((c), (wild))
62 #define mysql_list_processes(c)			mysqlnd_list_processes((c))
63 #define mysql_list_tables(c, wild)		mysqlnd_list_tables((c), (wild))
64 #define mysql_more_results(r)			mysqlnd_more_results((r))
65 #define mysql_next_result(r)			mysqlnd_next_result((r))
66 #define mysql_num_fields(r)				mysqlnd_num_fields((r))
67 #define mysql_num_rows(r)				mysqlnd_num_rows((r))
68 #define mysql_ping(r)					mysqlnd_ping((r))
69 #define mysql_real_escape_string(r,a,b,c) mysqlnd_real_escape_string((r), (a), (b), (c))
70 #define mysql_real_query(r,a,b)			mysqlnd_query((r), (a), (b))
71 #define mysql_refresh(conn, options)	mysqlnd_refresh((conn), (options))
72 #define mysql_rollback(r)				mysqlnd_rollback((r), TRANS_COR_NO_OPT, NULL)
73 #define mysql_select_db(r,a)			mysqlnd_select_db((r), (a) ,strlen((a)))
74 #define mysql_set_server_option(r,o)	mysqlnd_set_server_option((r), (o))
75 #define mysql_set_character_set(r,a)	mysqlnd_set_character_set((r), (a))
76 #define mysql_sqlstate(r)				mysqlnd_sqlstate((r))
77 #define mysql_ssl_set(c,key,cert,ca,capath,cipher)	mysqlnd_ssl_set((c), (key), (cert), (ca), (capath), (cipher))
78 #define mysql_stmt_affected_rows(s)		mysqlnd_stmt_affected_rows((s))
79 #define mysql_stmt_field_count(s)		mysqlnd_stmt_field_count((s))
80 #define mysql_stmt_param_count(s)		mysqlnd_stmt_param_count((s))
81 #define mysql_stmt_num_rows(s)			mysqlnd_stmt_num_rows((s))
82 #define mysql_stmt_insert_id(s)			mysqlnd_stmt_insert_id((s))
83 #define mysql_stmt_close(s)				mysqlnd_stmt_close((s), 0)
84 #define mysql_stmt_bind_param(s,b)		mysqlnd_stmt_bind_param((s), (b))
85 #define mysql_stmt_bind_result(s,b)		mysqlnd_stmt_bind_result((s), (b))
86 #define mysql_stmt_errno(s)				mysqlnd_stmt_errno((s))
87 #define mysql_stmt_error(s)				mysqlnd_stmt_error((s))
88 #define mysql_stmt_sqlstate(s)			mysqlnd_stmt_sqlstate((s))
89 #define mysql_stmt_prepare(s,q,l)		mysqlnd_stmt_prepare((s), (q), (l))
90 #define mysql_stmt_execute(s)			mysqlnd_stmt_execute((s))
91 #define mysql_stmt_reset(s)				mysqlnd_stmt_reset((s))
92 #define mysql_stmt_store_result(s)		mysqlnd_stmt_store_result((s))
93 #define mysql_stmt_free_result(s)		mysqlnd_stmt_free_result((s))
94 #define mysql_stmt_data_seek(s,r)		mysqlnd_stmt_data_seek((s), (r))
95 #define mysql_stmt_send_long_data(s,p,d,l) mysqlnd_stmt_send_long_data((s), (p), (d), (l))
96 #define mysql_stmt_attr_get(s,a,v)		mysqlnd_stmt_attr_get((s), (a), (v))
97 #define mysql_stmt_attr_set(s,a,v)		mysqlnd_stmt_attr_set((s), (a), (v))
98 #define mysql_stmt_result_metadata(s)	mysqlnd_stmt_result_metadata((s))
99 #define mysql_stmt_next_result(s)		mysqlnd_stmt_next_result((s))
100 #define mysql_stmt_more_results(s)		mysqlnd_stmt_more_results((s))
101 #define mysql_thread_safe()				mysqlnd_thread_safe()
102 #define mysql_info(r)					mysqlnd_info((r))
103 #define mysql_options(c,a,v)			mysqlnd_options((c), (a), (v))
104 #define mysql_options4(c,a,k,v)			mysqlnd_options4((c), (a), (k), (v))
105 #define mysql_stmt_init(r)				mysqlnd_stmt_init((r))
106 #define mysql_free_result(r)			mysqlnd_free_result((r), false)
107 #define mysql_store_result(r)			mysqlnd_store_result((r))
108 #define mysql_use_result(r)				mysqlnd_use_result((r))
109 #define mysql_async_store_result(r)		mysqlnd_async_store_result((r))
110 #define mysql_thread_id(r)				mysqlnd_thread_id((r))
111 #define mysql_get_client_info()			mysqlnd_get_client_info()
112 #define mysql_get_client_version()		mysqlnd_get_client_version()
113 #define mysql_get_host_info(r)			mysqlnd_get_host_info((r))
114 #define mysql_get_proto_info(r)			mysqlnd_get_proto_info((r))
115 #define mysql_get_server_info(r)		mysqlnd_get_server_info((r))
116 #define mysql_get_server_version(r)		mysqlnd_get_server_version((r))
117 #define mysql_warning_count(r)			mysqlnd_warning_count((r))
118 #define mysql_eof(r)					(((r)->unbuf && (r)->unbuf->eof_reached) || (r)->stored_data)
119 
120 #define REFRESH_GRANT		MYSQLND_REFRESH_GRANT
121 #define REFRESH_LOG			MYSQLND_REFRESH_LOG
122 #define REFRESH_TABLES		MYSQLND_REFRESH_TABLES
123 #define REFRESH_HOSTS		MYSQLND_REFRESH_HOSTS
124 #define REFRESH_STATUS		MYSQLND_REFRESH_STATUS
125 #define REFRESH_THREADS		MYSQLND_REFRESH_THREADS
126 #define REFRESH_SLAVE		MYSQLND_REFRESH_SLAVE
127 #define REFRESH_REPLICA		MYSQLND_REFRESH_REPLICA
128 #define REFRESH_MASTER		MYSQLND_REFRESH_MASTER
129 #define REFRESH_BACKUP_LOG	MYSQLND_REFRESH_BACKUP_LOG
130 
131 #endif /* MYSQLND_LIBMYSQL_COMPAT_H */
132