-
Notifications
You must be signed in to change notification settings - Fork 7
/
php_cubrid7.h
205 lines (186 loc) · 6.81 KB
/
php_cubrid7.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*
* Copyright (C) 2008 Search Solution Corporation. All rights reserved by Search Solution.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of the <ORGANIZATION> nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
*/
#ifndef PHP_CUBRID_H
#define PHP_CUBRID_H
/* Allow install from PECL on PHP < 7.3 */
#ifndef GC_ADDREF
# define CUB_PHP_VERSION 71
# define GC_ADDREF(p) (++GC_REFCOUNT(p))
#else
# define CUB_PHP_VERSION 73
#endif
#ifndef GC_DELREF
# define GC_DELREF(p) (GC_REFCOUNT(p)--)
#endif
#define Z_ARRLEN_P(v) zend_hash_num_elements(Z_ARRVAL_P(v))
#ifdef PHP_WIN32
# define PHP_CUBRID_API __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
# define PHP_CUBRID_API __attribute__ ((visibility("default")))
#else
# define PHP_CUBRID_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
#include <cas_cci.h>
typedef struct
{
int facility;
int code;
char msg[1024];
} T_CUBRID_ERROR;
extern zend_module_entry cubrid_module_entry;
#define cubrid_module_ptr &cubrid_module_entry
ZEND_MINIT_FUNCTION(cubrid);
ZEND_MSHUTDOWN_FUNCTION(cubrid);
ZEND_RINIT_FUNCTION(cubrid);
ZEND_RSHUTDOWN_FUNCTION(cubrid);
ZEND_MINFO_FUNCTION(cubrid);
ZEND_FUNCTION(cubrid_version);
ZEND_FUNCTION(cubrid_connect);
ZEND_FUNCTION(cubrid_pconnect);
ZEND_FUNCTION(cubrid_connect_with_url);
ZEND_FUNCTION(cubrid_pconnect_with_url);
ZEND_FUNCTION(cubrid_close);
ZEND_FUNCTION(cubrid_prepare);
ZEND_FUNCTION(cubrid_bind);
ZEND_FUNCTION(cubrid_execute);
ZEND_FUNCTION(cubrid_batch_execute);
ZEND_FUNCTION(cubrid_next_result);
ZEND_FUNCTION(cubrid_affected_rows);
ZEND_FUNCTION(cubrid_close_request);
ZEND_FUNCTION(cubrid_fetch);
ZEND_FUNCTION(cubrid_current_oid);
ZEND_FUNCTION(cubrid_column_types);
ZEND_FUNCTION(cubrid_column_names);
ZEND_FUNCTION(cubrid_move_cursor);
ZEND_FUNCTION(cubrid_num_rows);
ZEND_FUNCTION(cubrid_num_cols);
ZEND_FUNCTION(cubrid_get);
ZEND_FUNCTION(cubrid_put);
ZEND_FUNCTION(cubrid_drop);
ZEND_FUNCTION(cubrid_is_instance);
ZEND_FUNCTION(cubrid_get_class_name);
ZEND_FUNCTION(cubrid_lock_read);
ZEND_FUNCTION(cubrid_lock_write);
ZEND_FUNCTION(cubrid_schema);
ZEND_FUNCTION(cubrid_col_size);
ZEND_FUNCTION(cubrid_col_get);
ZEND_FUNCTION(cubrid_set_add);
ZEND_FUNCTION(cubrid_set_drop);
ZEND_FUNCTION(cubrid_seq_drop);
ZEND_FUNCTION(cubrid_seq_insert);
ZEND_FUNCTION(cubrid_seq_put);
ZEND_FUNCTION(cubrid_set_autocommit);
ZEND_FUNCTION(cubrid_get_autocommit);
ZEND_FUNCTION(cubrid_commit);
ZEND_FUNCTION(cubrid_rollback);
ZEND_FUNCTION(cubrid_error_msg);
ZEND_FUNCTION(cubrid_error_code);
ZEND_FUNCTION(cubrid_error_code_facility);
ZEND_FUNCTION(cubrid_errno);
ZEND_FUNCTION(cubrid_error);
ZEND_FUNCTION(cubrid_field_name);
ZEND_FUNCTION(cubrid_field_table);
ZEND_FUNCTION(cubrid_field_type);
ZEND_FUNCTION(cubrid_field_flags);
ZEND_FUNCTION(cubrid_data_seek);
ZEND_FUNCTION(cubrid_fetch_array);
ZEND_FUNCTION(cubrid_fetch_assoc);
ZEND_FUNCTION(cubrid_fetch_row);
ZEND_FUNCTION(cubrid_fetch_field);
ZEND_FUNCTION(cubrid_num_fields);
ZEND_FUNCTION(cubrid_free_result);
ZEND_FUNCTION(cubrid_field_len);
ZEND_FUNCTION(cubrid_fetch_object);
ZEND_FUNCTION(cubrid_fetch_lengths);
ZEND_FUNCTION(cubrid_field_seek);
ZEND_FUNCTION(cubrid_result);
ZEND_FUNCTION(cubrid_unbuffered_query);
ZEND_FUNCTION(cubrid_query);
ZEND_FUNCTION(cubrid_get_charset);
ZEND_FUNCTION(cubrid_client_encoding);
ZEND_FUNCTION(cubrid_get_client_info);
ZEND_FUNCTION(cubrid_get_server_info);
ZEND_FUNCTION(cubrid_real_escape_string);
ZEND_FUNCTION(cubrid_get_db_parameter);
ZEND_FUNCTION(cubrid_set_db_parameter);
ZEND_FUNCTION(cubrid_list_dbs);
ZEND_FUNCTION(cubrid_db_name);
ZEND_FUNCTION(cubrid_insert_id);
ZEND_FUNCTION(cubrid_ping);
ZEND_FUNCTION(cubrid_lob2_new);
ZEND_FUNCTION(cubrid_lob2_bind);
ZEND_FUNCTION(cubrid_lob2_export);
ZEND_FUNCTION(cubrid_lob2_import);
ZEND_FUNCTION(cubrid_lob2_read);
ZEND_FUNCTION(cubrid_lob2_write);
ZEND_FUNCTION(cubrid_lob2_tell);
ZEND_FUNCTION(cubrid_lob2_tell64);
ZEND_FUNCTION(cubrid_lob2_seek);
ZEND_FUNCTION(cubrid_lob2_seek64);
ZEND_FUNCTION(cubrid_lob2_size);
ZEND_FUNCTION(cubrid_lob2_size64);
ZEND_FUNCTION(cubrid_lob2_close);
ZEND_FUNCTION(cubrid_lob_get);
ZEND_FUNCTION(cubrid_lob_size);
ZEND_FUNCTION(cubrid_lob_export);
ZEND_FUNCTION(cubrid_lob_send);
ZEND_FUNCTION(cubrid_lob_close);
ZEND_FUNCTION(cubrid_get_query_timeout);
ZEND_FUNCTION(cubrid_set_query_timeout);
ZEND_BEGIN_MODULE_GLOBALS(cubrid)
T_CUBRID_ERROR recent_error;
int last_connect_id;
int last_request_id;
char *default_userid, *default_passwd;
zend_resource *default_link; /* default link when connection is omitted */
zend_resource *default_request;
ZEND_END_MODULE_GLOBALS(cubrid)
#ifdef ZTS
#define CUBRID_G(v) TSRMG(cubrid_globals_id, zend_cubrid_globals *, v)
#else
#define CUBRID_G(v) (cubrid_globals.v)
#endif
#define FETCH_DEFAULT_LINK() CUBRID_G(default_link)
#define FETCH_DEFAULT_REQUEST() CUBRID_G(default_request)
#define CHECK_DEFAULT_LINK(x) if ((x) == NULL) { php_error_docref(NULL, E_WARNING, "No Cubrid link opened yet"); }
#define CHECK_DEFAULT_REQUEST(x) if ((x) == NULL) { php_error_docref(NULL, E_WARNING, "No Cubrid request opened yet"); }
#define CHECK_REQUEST(x) if ((x) == NULL) {RETURN_FALSE;}
#define CHECK_CONNECT(x) if ((x) == NULL) {RETURN_FALSE;}
#define phpext_cubrid_ptr cubrid_module_ptr
#define zend_rsrc_list_entry zend_resource
#define Z_TYPE_RESOURCE(res) res.type
#define Z_TYPE_PP(zval_pp) Z_TYPE(**zval_pp)
#define Z_STRLEN_PP(zval_pp) Z_STRLEN(**zval_pp)
#define Z_STRVAL_PP(zval_pp) Z_STRVAL(**zval_pp)
#define Z_RES_VAL_PP(zval_pp) Z_RES_VAL(**zval_pp)
#endif /* PHP_CUBRID_H */