1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 5 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 1997-2016 The PHP Group | 6 +----------------------------------------------------------------------+ 7 | This source file is subject to version 3.01 of the PHP license, | 8 | that is bundled with this package in the file LICENSE, and is | 9 | available through the world-wide-web at the following url: | 10 | http://www.php.net/license/3_01.txt | 11 | If you did not receive a copy of the PHP license and are unable to | 12 | obtain it through the world-wide-web, please send a note to | 13 | license@php.net so we can mail you a copy immediately. | 14 +----------------------------------------------------------------------+ 15 | Authors: Stig S�ther Bakken <ssb@php.net> | 16 | Thies C. Arntzen <thies@thieso.net> | 17 | | 18 | Collection support by Andy Sautins <asautins@veripost.net> | 19 | Temporary LOB support by David Benson <dbenson@mancala.com> | 20 | ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at> | 21 | | 22 | Redesigned by: Antony Dovgal <antony@zend.com> | 23 | Andi Gutmans <andi@zend.com> | 24 | Wez Furlong <wez@omniti.com> | 25 +----------------------------------------------------------------------+ 26 */ 27 28 /* $Id$ */ 29 30 #if HAVE_OCI8 31 # ifndef PHP_OCI8_INT_H 32 # define PHP_OCI8_INT_H 33 34 /* {{{ misc defines */ 35 # if (defined(__osf__) && defined(__alpha)) 36 # ifndef A_OSF 37 # define A_OSF 38 # endif 39 # ifndef OSF1 40 # define OSF1 41 # endif 42 # ifndef _INTRINSICS 43 # define _INTRINSICS 44 # endif 45 # endif /* osf alpha */ 46 47 #ifdef HAVE_OCI8_DTRACE 48 #include "oci8_dtrace_gen.h" 49 #endif 50 51 #if defined(min) 52 #undef min 53 #endif 54 #if defined(max) 55 #undef max 56 #endif 57 /* }}} */ 58 59 #include "ext/standard/php_string.h" 60 #include <oci.h> 61 62 extern int le_connection; 63 extern int le_pconnection; 64 extern int le_statement; 65 extern int le_descriptor; 66 extern int le_collection; 67 extern int le_server; 68 extern int le_session; 69 70 extern zend_class_entry *oci_lob_class_entry_ptr; 71 extern zend_class_entry *oci_coll_class_entry_ptr; 72 73 /* {{{ constants */ 74 #define PHP_OCI_SEEK_SET 0 75 #define PHP_OCI_SEEK_CUR 1 76 #define PHP_OCI_SEEK_END 2 77 78 #define PHP_OCI_MAX_NAME_LEN 64 79 #define PHP_OCI_MAX_DATA_SIZE INT_MAX 80 #define PHP_OCI_PIECE_SIZE ((64*1024)-1) 81 #define PHP_OCI_LOB_BUFFER_SIZE 1048576l /* 1Mb seems to be the most reasonable buffer size for LOB reading */ 82 83 #define PHP_OCI_ASSOC (1<<0) 84 #define PHP_OCI_NUM (1<<1) 85 #define PHP_OCI_BOTH (PHP_OCI_ASSOC|PHP_OCI_NUM) 86 87 #define PHP_OCI_RETURN_NULLS (1<<2) 88 #define PHP_OCI_RETURN_LOBS (1<<3) 89 90 #define PHP_OCI_FETCHSTATEMENT_BY_COLUMN (1<<4) 91 #define PHP_OCI_FETCHSTATEMENT_BY_ROW (1<<5) 92 #define PHP_OCI_FETCHSTATEMENT_BY (PHP_OCI_FETCHSTATEMENT_BY_COLUMN | PHP_OCI_FETCHSTATEMENT_BY_ROW) 93 94 #define PHP_OCI_LOB_BUFFER_DISABLED 0 95 #define PHP_OCI_LOB_BUFFER_ENABLED 1 96 #define PHP_OCI_LOB_BUFFER_USED 2 97 98 /* The mode parameter for oci_connect() is overloaded and accepts both 99 * privilege and external authentication flags OR'd together. 100 * PHP_OCI_CRED_EXT must be distinct from the OCI_xxx privilege 101 * values. 102 */ 103 #define PHP_OCI_CRED_EXT (1<<31) 104 #if ((PHP_OCI_CRED_EXT == OCI_DEFAULT) || (PHP_OCI_CRED_EXT & (OCI_SYSOPER | OCI_SYSDBA))) 105 #error Invalid value for PHP_OCI_CRED_EXT 106 #endif 107 108 #define PHP_OCI_IMPRES_UNKNOWN 0 109 #define PHP_OCI_IMPRES_NO_CHILDREN 1 110 #define PHP_OCI_IMPRES_HAS_CHILDREN 2 111 #define PHP_OCI_IMPRES_IS_CHILD 3 112 113 /* 114 * Name passed to Oracle for tracing. Note some DB views only show 115 * the first nine characters of the driver name. 116 */ 117 #define PHP_OCI8_DRIVER_NAME "PHP OCI8 " PHP_OCI8_VERSION 118 119 /* }}} */ 120 121 /* {{{ php_oci_spool */ 122 typedef struct { 123 int id; /* resource id */ 124 OCIEnv *env; /* env of this session pool */ 125 OCIError *err; /* pool's error handle */ 126 OCISPool *poolh; /* pool handle */ 127 void *poolname; /* session pool name */ 128 unsigned int poolname_len; /* length of session pool name */ 129 char *spool_hash_key; /* Hash key for session pool in plist */ 130 } php_oci_spool; 131 /* }}} */ 132 133 /* {{{ php_oci_connection */ 134 typedef struct { 135 int id; /* resource ID */ 136 OCIEnv *env; /* private env handle */ 137 ub2 charset; /* charset ID */ 138 OCIServer *server; /* private server handle */ 139 OCISvcCtx *svc; /* private service context handle */ 140 OCISession *session; /* private session handle */ 141 OCIAuthInfo *authinfo; /* Cached authinfo handle for OCISessionGet */ 142 OCIError *err; /* private error handle */ 143 php_oci_spool *private_spool; /* private session pool (for persistent) */ 144 sb4 errcode; /* last ORA- error number */ 145 146 HashTable *descriptors; /* descriptors hash, used to flush all the LOBs using this connection on commit */ 147 ulong descriptor_count; /* used to index the descriptors hash table. Not an accurate count */ 148 unsigned is_open:1; /* hels to determine if the connection is dead or not */ 149 unsigned is_attached:1; /* hels to determine if we should detach from the server when closing/freeing the connection */ 150 unsigned is_persistent:1; /* self-descriptive */ 151 unsigned used_this_request:1; /* helps to determine if we should reset connection's next ping time and check its timeout */ 152 unsigned rb_on_disconnect:1; /* helps to determine if we should rollback this connection on close/shutdown */ 153 unsigned passwd_changed:1; /* helps determine if a persistent connection hash should be invalidated after a password change */ 154 unsigned is_stub:1; /* flag to keep track whether the connection structure has a real OCI connection associated */ 155 unsigned using_spool:1; /* Is this connection from session pool? */ 156 time_t idle_expiry; /* time when the connection will be considered as expired */ 157 time_t *next_pingp; /* (pointer to) time of the next ping */ 158 char *hash_key; /* hashed details of the connection */ 159 #ifdef HAVE_OCI8_DTRACE 160 char *client_id; /* The oci_set_client_identifier() value */ 161 #endif 162 } php_oci_connection; 163 /* }}} */ 164 165 /* {{{ php_oci_descriptor */ 166 typedef struct { 167 int id; 168 ulong index; /* descriptors hash table index */ 169 php_oci_connection *connection; /* parent connection handle */ 170 dvoid *descriptor; /* OCI descriptor handle */ 171 ub4 type; /* descriptor type (FILE/LOB) */ 172 int lob_current_position; /* LOB internal pointer */ 173 int lob_size; /* cached LOB size. -1 = Lob wasn't initialized yet */ 174 int buffering; /* cached buffering flag. 0 - off, 1 - on, 2 - on and buffer was used */ 175 ub4 chunk_size; /* chunk size of the LOB. 0 - unknown */ 176 ub1 charset_form; /* charset form, required for NCLOBs */ 177 ub2 charset_id; /* charset ID */ 178 unsigned is_open:1; /* helps to determine if lob is open or not */ 179 } php_oci_descriptor; 180 /* }}} */ 181 182 /* {{{ php_oci_lob_ctx */ 183 typedef struct { 184 char **lob_data; /* address of pointer to LOB data */ 185 ub4 *lob_len; /* address of LOB length variable (bytes) */ 186 ub4 alloc_len; 187 } php_oci_lob_ctx; 188 /* }}} */ 189 190 /* {{{ php_oci_collection */ 191 typedef struct { 192 int id; 193 php_oci_connection *connection; /* parent connection handle */ 194 OCIType *tdo; /* collection's type handle */ 195 OCITypeCode coll_typecode; /* collection's typecode handle */ 196 OCIRef *elem_ref; /* element's reference handle */ 197 OCIType *element_type; /* element's type handle */ 198 OCITypeCode element_typecode; /* element's typecode handle */ 199 OCIColl *collection; /* collection handle */ 200 } php_oci_collection; 201 /* }}} */ 202 203 /* {{{ php_oci_define */ 204 typedef struct { 205 zval *zval; /* zval used in define */ 206 text *name; /* placeholder's name */ 207 ub4 name_len; /* placeholder's name length */ 208 ub4 type; /* define type */ 209 } php_oci_define; 210 /* }}} */ 211 212 /* {{{ php_oci_statement */ 213 typedef struct { 214 int id; 215 int parent_stmtid; /* parent statement id */ 216 struct php_oci_statement *impres_child_stmt;/* child of current Implicit Result Set statement handle */ 217 ub4 impres_count; /* count of remaining Implicit Result children on parent statement handle */ 218 php_oci_connection *connection; /* parent connection handle */ 219 sb4 errcode; /* last ORA- error number */ 220 OCIError *err; /* private error handle */ 221 OCIStmt *stmt; /* statement handle */ 222 char *last_query; /* last query issued. also used to determine if this is a statement or a refcursor received from Oracle */ 223 char impres_flag; /* PHP_OCI_IMPRES_*_ */ 224 long last_query_len; /* last query length */ 225 HashTable *columns; /* hash containing all the result columns */ 226 HashTable *binds; /* binds hash */ 227 HashTable *defines; /* defines hash */ 228 int ncolumns; /* number of columns in the result */ 229 unsigned executed:1; /* statement executed flag */ 230 unsigned has_data:1; /* statement has more data flag */ 231 unsigned has_descr:1; /* statement has at least one descriptor or cursor column */ 232 ub2 stmttype; /* statement type */ 233 ub4 prefetch_count; /* current prefetch count */ 234 } php_oci_statement; 235 /* }}} */ 236 237 /* {{{ php_oci_bind */ 238 typedef struct { 239 OCIBind *bind; /* bind handle */ 240 zval *zval; /* value */ 241 dvoid *descriptor; /* used for binding of LOBS etc */ 242 OCIStmt *statement; /* used for binding REFCURSORs */ 243 php_oci_statement *parent_statement; /* pointer to the parent statement */ 244 ub2 type; /* bind type */ 245 struct { 246 void *elements; 247 sb2 *indicators; 248 ub2 *element_lengths; 249 ub4 current_length; 250 ub4 old_length; 251 ub4 max_length; 252 long type; 253 } array; 254 sb2 indicator; /* -1 means NULL */ 255 ub2 retcode; 256 ub4 dummy_len; /* a dummy var to store alenpp value in bind OUT callback */ 257 } php_oci_bind; 258 /* }}} */ 259 260 /* {{{ php_oci_out_column */ 261 typedef struct { 262 php_oci_statement *statement; /* statement handle. used when fetching REFCURSORS */ 263 php_oci_statement *nested_statement; /* statement handle. used when fetching REFCURSORS */ 264 OCIDefine *oci_define; /* define handle */ 265 char *name; /* column name */ 266 ub4 name_len; /* column name length */ 267 ub2 data_type; /* column data type */ 268 ub2 data_size; /* data size */ 269 ub4 storage_size4; /* size used when allocating buffers */ 270 sb2 indicator; 271 ub2 retcode; /* code returned when fetching this particular column */ 272 ub2 retlen; 273 ub4 retlen4; 274 ub2 is_descr; /* column contains a descriptor */ 275 ub2 is_cursor; /* column contains a cursor */ 276 int stmtid; /* statement id for cursors */ 277 int descid; /* descriptor id for descriptors */ 278 void *data; 279 php_oci_define *define; /* define handle */ 280 int piecewise; /* column is fetched piece-by-piece */ 281 ub4 cb_retlen; 282 sb1 scale; /* column scale */ 283 sb2 precision; /* column precision */ 284 ub1 charset_form; /* charset form, required for NCLOBs */ 285 ub2 charset_id; /* charset ID */ 286 ub4 chunk_size; /* LOB chunk size */ 287 } php_oci_out_column; 288 /* }}} */ 289 290 /* {{{ macros */ 291 292 #define PHP_OCI_CALL(func, params) \ 293 do { \ 294 OCI_G(in_call) = 1; \ 295 func params; \ 296 OCI_G(in_call) = 0; \ 297 } while (0) 298 299 #define PHP_OCI_CALL_RETURN(__retval, func, params) \ 300 do { \ 301 OCI_G(in_call) = 1; \ 302 __retval = func params; \ 303 OCI_G(in_call) = 0; \ 304 } while (0) 305 306 /* Check for errors that indicate the connection to the DB is no 307 * longer valid. If it isn't, then the PHP connection is marked to be 308 * reopened by the next PHP OCI8 connect command. This is most useful 309 * for persistent connections. The error number list is not 310 * exclusive. The error number comparisons and the 311 * OCI_ATTR_SERVER_STATUS check are done for maximum cross-version 312 * compatibility. In the far future, only the attribute check will be 313 * needed. 314 */ 315 #define PHP_OCI_HANDLE_ERROR(connection, errcode) \ 316 do { \ 317 ub4 serverStatus = OCI_SERVER_NORMAL; \ 318 switch (errcode) { \ 319 case 1013: \ 320 zend_bailout(); \ 321 break; \ 322 case 22: \ 323 case 28: \ 324 case 378: \ 325 case 602: \ 326 case 603: \ 327 case 604: \ 328 case 609: \ 329 case 1012: \ 330 case 1033: \ 331 case 1041: \ 332 case 1043: \ 333 case 1089: \ 334 case 1090: \ 335 case 1092: \ 336 case 3113: \ 337 case 3114: \ 338 case 3122: \ 339 case 3135: \ 340 case 12153: \ 341 case 27146: \ 342 case 28511: \ 343 (connection)->is_open = 0; \ 344 break; \ 345 default: \ 346 { \ 347 PHP_OCI_CALL(OCIAttrGet, ((dvoid *)(connection)->server, OCI_HTYPE_SERVER, (dvoid *)&serverStatus, \ 348 (ub4 *)0, OCI_ATTR_SERVER_STATUS, (connection)->err)); \ 349 if (serverStatus != OCI_SERVER_NORMAL) { \ 350 (connection)->is_open = 0; \ 351 } \ 352 } \ 353 break; \ 354 } \ 355 php_oci_dtrace_check_connection(connection, errcode, serverStatus); \ 356 } while (0) 357 358 #define PHP_OCI_REGISTER_RESOURCE(resource, le_resource) \ 359 do { \ 360 resource->id = ZEND_REGISTER_RESOURCE(NULL, resource, le_resource); \ 361 } while (0) 362 363 #define PHP_OCI_ZVAL_TO_CONNECTION(zval, connection) \ 364 ZEND_FETCH_RESOURCE2(connection, php_oci_connection *, &zval, -1, "oci8 connection", le_connection, le_pconnection) 365 366 #define PHP_OCI_ZVAL_TO_STATEMENT(zval, statement) \ 367 ZEND_FETCH_RESOURCE(statement, php_oci_statement *, &zval, -1, "oci8 statement", le_statement) 368 369 #define PHP_OCI_ZVAL_TO_DESCRIPTOR(zval, descriptor) \ 370 ZEND_FETCH_RESOURCE(descriptor, php_oci_descriptor *, &zval, -1, "oci8 descriptor", le_descriptor) 371 372 #define PHP_OCI_ZVAL_TO_COLLECTION(zval, collection) \ 373 ZEND_FETCH_RESOURCE(collection, php_oci_collection *, &zval, -1, "oci8 collection", le_collection) 374 375 #define PHP_OCI_FETCH_RESOURCE_EX(zval, var, type, name, resource_type) \ 376 do { \ 377 var = (type) zend_fetch_resource(&zval TSRMLS_CC, -1, name, NULL, 1, resource_type); \ 378 if (!var) { \ 379 return 1; \ 380 } \ 381 } while (0) 382 383 #define PHP_OCI_ZVAL_TO_CONNECTION_EX(zval, connection) \ 384 PHP_OCI_FETCH_RESOURCE_EX(zval, connection, php_oci_connection *, "oci8 connection", le_connection) 385 386 #define PHP_OCI_ZVAL_TO_STATEMENT_EX(zval, statement) \ 387 PHP_OCI_FETCH_RESOURCE_EX(zval, statement, php_oci_statement *, "oci8 statement", le_statement) 388 389 #define PHP_OCI_ZVAL_TO_DESCRIPTOR_EX(zval, descriptor) \ 390 PHP_OCI_FETCH_RESOURCE_EX(zval, descriptor, php_oci_descriptor *, "oci8 descriptor", le_descriptor) 391 392 #define PHP_OCI_ZVAL_TO_COLLECTION_EX(zval, collection) \ 393 PHP_OCI_FETCH_RESOURCE_EX(zval, collection, php_oci_collection *, "oci8 collection", le_collection) 394 395 /* }}} */ 396 397 /* PROTOS */ 398 399 /* {{{ main prototypes */ 400 401 void php_oci_column_hash_dtor(void *data); 402 void php_oci_define_hash_dtor(void *data); 403 void php_oci_bind_hash_dtor(void *data); 404 void php_oci_descriptor_flush_hash_dtor(void *data); 405 void php_oci_connection_descriptors_free(php_oci_connection *connection TSRMLS_DC); 406 sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC); 407 sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC); 408 int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, ub2 *error_offset TSRMLS_DC); 409 void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclusive); 410 php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char *password, int password_len, char *new_password, int new_password_len, char *dbname, int dbname_len, char *charset, long session_mode, int persistent, int exclusive TSRMLS_DC); 411 int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC); 412 int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC); 413 int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC); 414 int php_oci_password_change(php_oci_connection *connection, char *user, int user_len, char *pass_old, int pass_old_len, char *pass_new, int pass_new_len TSRMLS_DC); 415 void php_oci_client_get_version(char **version TSRMLS_DC); 416 int php_oci_server_get_version(php_oci_connection *connection, char **version TSRMLS_DC); 417 void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_args); 418 int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSRMLS_DC); 419 void php_oci_dtrace_check_connection(php_oci_connection *connection, sb4 errcode, ub4 serverStatus); 420 421 /* }}} */ 422 423 /* {{{ lob related prototypes */ 424 425 php_oci_descriptor *php_oci_lob_create(php_oci_connection *connection, long type TSRMLS_DC); 426 int php_oci_lob_get_length(php_oci_descriptor *descriptor, ub4 *length TSRMLS_DC); 427 int php_oci_lob_read(php_oci_descriptor *descriptor, long read_length, long inital_offset, char **data, ub4 *data_len TSRMLS_DC); 428 int php_oci_lob_write(php_oci_descriptor *descriptor, ub4 offset, char *data, int data_len, ub4 *bytes_written TSRMLS_DC); 429 int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC); 430 int php_oci_lob_set_buffering(php_oci_descriptor *descriptor, int on_off TSRMLS_DC); 431 int php_oci_lob_get_buffering(php_oci_descriptor *descriptor); 432 int php_oci_lob_copy(php_oci_descriptor *descriptor, php_oci_descriptor *descriptor_from, long length TSRMLS_DC); 433 int php_oci_lob_close(php_oci_descriptor *descriptor TSRMLS_DC); 434 int php_oci_temp_lob_close(php_oci_descriptor *descriptor TSRMLS_DC); 435 int php_oci_lob_write_tmp(php_oci_descriptor *descriptor, long type, char *data, int data_len TSRMLS_DC); 436 void php_oci_lob_free(php_oci_descriptor *descriptor TSRMLS_DC); 437 int php_oci_lob_import(php_oci_descriptor *descriptor, char *filename TSRMLS_DC); 438 int php_oci_lob_append(php_oci_descriptor *descriptor_dest, php_oci_descriptor *descriptor_from TSRMLS_DC); 439 int php_oci_lob_truncate(php_oci_descriptor *descriptor, long new_lob_length TSRMLS_DC); 440 int php_oci_lob_erase(php_oci_descriptor *descriptor, long offset, ub4 length, ub4 *bytes_erased TSRMLS_DC); 441 int php_oci_lob_is_equal(php_oci_descriptor *descriptor_first, php_oci_descriptor *descriptor_second, boolean *result TSRMLS_DC); 442 sb4 php_oci_lob_callback(dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp); 443 /* }}} */ 444 445 /* {{{ collection related prototypes */ 446 447 php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC); 448 int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC); 449 int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC); 450 int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRMLS_DC); 451 int php_oci_collection_append(php_oci_collection *collection, char *element, int element_len TSRMLS_DC); 452 int php_oci_collection_element_get(php_oci_collection *collection, long index, zval **result_element TSRMLS_DC); 453 int php_oci_collection_element_set(php_oci_collection *collection, long index, char *value, int value_len TSRMLS_DC); 454 int php_oci_collection_element_set_null(php_oci_collection *collection, long index TSRMLS_DC); 455 int php_oci_collection_element_set_date(php_oci_collection *collection, long index, char *date, int date_len TSRMLS_DC); 456 int php_oci_collection_element_set_number(php_oci_collection *collection, long index, char *number, int number_len TSRMLS_DC); 457 int php_oci_collection_element_set_string(php_oci_collection *collection, long index, char *element, int element_len TSRMLS_DC); 458 int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_collection *collection_from TSRMLS_DC); 459 void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC); 460 int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC); 461 int php_oci_collection_append_date(php_oci_collection *collection, char *date, int date_len TSRMLS_DC); 462 int php_oci_collection_append_number(php_oci_collection *collection, char *number, int number_len TSRMLS_DC); 463 int php_oci_collection_append_string(php_oci_collection *collection, char *element, int element_len TSRMLS_DC); 464 465 466 /* }}} */ 467 468 /* {{{ statement related prototypes */ 469 470 php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, int query_len TSRMLS_DC); 471 php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement TSRMLS_DC); 472 int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch TSRMLS_DC); 473 int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC); 474 php_oci_out_column *php_oci_statement_get_column(php_oci_statement *statement, long column_index, char *column_name, int column_name_len TSRMLS_DC); 475 int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC); 476 int php_oci_statement_cancel(php_oci_statement *statement TSRMLS_DC); 477 void php_oci_statement_free(php_oci_statement *statement TSRMLS_DC); 478 int php_oci_bind_pre_exec(void *data, void *result TSRMLS_DC); 479 int php_oci_bind_post_exec(void *data TSRMLS_DC); 480 int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long maxlength, ub2 type TSRMLS_DC); 481 sb4 php_oci_bind_in_callback(dvoid *ictxp, OCIBind *bindp, ub4 iter, ub4 index, dvoid **bufpp, ub4 *alenp, ub1 *piecep, dvoid **indpp); 482 sb4 php_oci_bind_out_callback(dvoid *octxp, OCIBind *bindp, ub4 iter, ub4 index, dvoid **bufpp, ub4 **alenpp, ub1 *piecep, dvoid **indpp, ub2 **rcodepp); 483 php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data); 484 int php_oci_cleanup_pre_fetch(void *data TSRMLS_DC); 485 int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC); 486 int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSRMLS_DC); 487 int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long max_table_length, long maxlength, long type TSRMLS_DC); 488 php_oci_bind *php_oci_bind_array_helper_number(zval *var, long max_table_length TSRMLS_DC); 489 php_oci_bind *php_oci_bind_array_helper_double(zval *var, long max_table_length TSRMLS_DC); 490 php_oci_bind *php_oci_bind_array_helper_string(zval *var, long max_table_length, long maxlength TSRMLS_DC); 491 php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, php_oci_connection *connection TSRMLS_DC); 492 493 /* }}} */ 494 495 ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ Module globals */ 496 sb4 errcode; /* global last ORA- error number. Used when connect fails, for example */ 497 OCIError *err; /* global error handle */ 498 499 long max_persistent; /* maximum number of persistent connections per process */ 500 long num_persistent; /* number of existing persistent connections */ 501 long num_links; /* non-persistent + persistent connections */ 502 long num_statements; /* number of statements open */ 503 long ping_interval; /* time interval between pings */ 504 long persistent_timeout; /* time period after which idle persistent connection is considered expired */ 505 long statement_cache_size; /* statement cache size. used with 9i+ clients only*/ 506 long default_prefetch; /* default prefetch setting */ 507 zend_bool privileged_connect; /* privileged connect flag (On/Off) */ 508 zend_bool old_oci_close_semantics; /* old_oci_close_semantics flag (to determine the way oci_close() should behave) */ 509 510 int shutdown; /* in shutdown flag */ 511 512 OCIEnv *env; /* global environment handle */ 513 514 zend_bool in_call; 515 char *connection_class; 516 zend_bool events; 517 char *edition; 518 ZEND_END_MODULE_GLOBALS(oci) /* }}} */ 519 520 #ifdef ZTS 521 #define OCI_G(v) TSRMG(oci_globals_id, zend_oci_globals *, v) 522 #else 523 #define OCI_G(v) (oci_globals.v) 524 #endif 525 526 ZEND_EXTERN_MODULE_GLOBALS(oci) 527 528 # endif /* !PHP_OCI8_INT_H */ 529 #else /* !HAVE_OCI8 */ 530 531 # define oci8_module_ptr NULL 532 533 #endif /* HAVE_OCI8 */ 534 535 /* 536 * Local variables: 537 * tab-width: 4 538 * c-basic-offset: 4 539 * End: 540 */ 541