File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / oci8 / php_oci8_int.h
Revision 1.1.1.4 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Sun Jun 15 20:03:52 2014 UTC (10 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29, HEAD
php 5.4.29

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>