Back to index

php5  5.3.10
php_oci8_int.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Authors: Stig Sæther Bakken <ssb@php.net>                            |
00016    |          Thies C. Arntzen <thies@thieso.net>                         |
00017    |                                                                      |
00018    | Collection support by Andy Sautins <asautins@veripost.net>           |
00019    | Temporary LOB support by David Benson <dbenson@mancala.com>          |
00020    | ZTS per process OCIPLogon by Harald Radi <harald.radi@nme.at>        |
00021    |                                                                      |
00022    | Redesigned by: Antony Dovgal <antony@zend.com>                       |
00023    |                Andi Gutmans <andi@zend.com>                          |
00024    |                Wez Furlong <wez@omniti.com>                          |
00025    +----------------------------------------------------------------------+
00026 */
00027 
00028 /* $Id: php_oci8_int.h 321634 2012-01-01 13:15:04Z felipe $ */
00029 
00030 #if HAVE_OCI8
00031 # ifndef PHP_OCI8_INT_H
00032 #  define PHP_OCI8_INT_H
00033 
00034 /* misc defines {{{ */
00035 # if (defined(__osf__) && defined(__alpha))
00036 #  ifndef A_OSF
00037 #      define A_OSF
00038 #  endif
00039 #  ifndef OSF1
00040 #      define OSF1
00041 #  endif
00042 #  ifndef _INTRINSICS
00043 #      define _INTRINSICS
00044 #  endif
00045 # endif /* osf alpha */
00046 
00047 #if defined(min)
00048 #undef min
00049 #endif
00050 #if defined(max)
00051 #undef max
00052 #endif
00053 /* }}} */
00054 
00055 #include "ext/standard/php_string.h"
00056 #include <oci.h>
00057 
00058 extern int le_connection;
00059 extern int le_pconnection;
00060 extern int le_statement;
00061 extern int le_descriptor;
00062 extern int le_collection;
00063 extern int le_server;
00064 extern int le_session;
00065 
00066 extern zend_class_entry *oci_lob_class_entry_ptr;
00067 extern zend_class_entry *oci_coll_class_entry_ptr;
00068 
00069 /* constants {{{ */
00070 #define PHP_OCI_SEEK_SET 0
00071 #define PHP_OCI_SEEK_CUR 1
00072 #define PHP_OCI_SEEK_END 2
00073 
00074 #define PHP_OCI_MAX_NAME_LEN  64
00075 #define PHP_OCI_MAX_DATA_SIZE INT_MAX
00076 #define PHP_OCI_PIECE_SIZE    ((64*1024)-1)
00077 #define PHP_OCI_LOB_BUFFER_SIZE 1048576l  /* 1Mb seems to be the most reasonable buffer size for LOB reading */
00078 
00079 #define PHP_OCI_ASSOC                            (1<<0)
00080 #define PHP_OCI_NUM                              (1<<1)
00081 #define PHP_OCI_BOTH                      (PHP_OCI_ASSOC|PHP_OCI_NUM)
00082 
00083 #define PHP_OCI_RETURN_NULLS              (1<<2)
00084 #define PHP_OCI_RETURN_LOBS               (1<<3)
00085 
00086 #define PHP_OCI_FETCHSTATEMENT_BY_COLUMN  (1<<4)
00087 #define PHP_OCI_FETCHSTATEMENT_BY_ROW            (1<<5)
00088 #define PHP_OCI_FETCHSTATEMENT_BY                (PHP_OCI_FETCHSTATEMENT_BY_COLUMN | PHP_OCI_FETCHSTATEMENT_BY_ROW)
00089 
00090 #define PHP_OCI_LOB_BUFFER_DISABLED 0
00091 #define PHP_OCI_LOB_BUFFER_ENABLED  1
00092 #define PHP_OCI_LOB_BUFFER_USED     2
00093 
00094 /* The mode parameter for oci_connect() is overloaded and accepts both
00095  * privilege and external authentication flags OR'd together.
00096  * PHP_OCI_CRED_EXT must be distinct from the OCI_xxx privilege
00097  * values.
00098  */
00099 #define PHP_OCI_CRED_EXT                    (1<<31)
00100 #if ((PHP_OCI_CRED_EXT == OCI_DEFAULT) || (PHP_OCI_CRED_EXT & (OCI_SYSOPER | OCI_SYSDBA)))
00101 #error Invalid value for PHP_OCI_CRED_EXT
00102 #endif
00103 
00104 /*
00105  * Name passed to Oracle for tracing.  Note some DB views only show
00106  * the first nine characters of the driver name.
00107  */
00108 #define PHP_OCI8_DRIVER_NAME "PHP OCI8 " PHP_OCI8_VERSION
00109 
00110 /* }}} */
00111 
00112 typedef struct { /* php_oci_spool {{{ */
00113        OCIEnv         *env;                             /*env of this session pool */
00114        OCIError       *err;                             /* pool's error handle      */
00115        OCISPool       *poolh;                           /* pool handle */
00116        void           *poolname;                        /* session pool name */
00117        unsigned int  poolname_len;               /* length of session pool name */
00118        char           *spool_hash_key;           /* Hash key for session pool in plist */
00119 } php_oci_spool; /* }}} */
00120 
00121 typedef struct { /* php_oci_connection {{{ */
00122        OCIEnv           *env;                                         /* private env handle */
00123        ub2                         charset;                                  /* charset ID */
00124        OCIServer        *server;                                      /* private server handle */
00125        OCISvcCtx        *svc;                                         /* private service context handle */
00126        OCISession       *session;                              /* private session handle */
00127        OCIAuthInfo      *authinfo;                             /* Cached authinfo handle for OCISessionGet */
00128        OCIError         *err;                                         /* private error handle */
00129        php_oci_spool  *private_spool;                          /* private session pool (for persistent) */
00130        sword                errcode;                                  /* last errcode */
00131 
00132        HashTable        *descriptors;                          /* descriptors hash, used to flush all the LOBs using this connection on commit */
00133        ulong                descriptor_count;                  /* used to index the descriptors hash table.  Not an accurate count */
00134        unsigned             is_open:1;                                /* hels to determine if the connection is dead or not */
00135        unsigned             is_attached:1;                            /* hels to determine if we should detach from the server when closing/freeing the connection */
00136        unsigned             is_persistent:1;                   /* self-descriptive */
00137        unsigned             used_this_request:1;        /* helps to determine if we should reset connection's next ping time and check its timeout */
00138        unsigned             needs_commit:1;                           /* helps to determine if we should rollback this connection on close/shutdown */
00139        unsigned             passwd_changed:1;                  /* helps determine if a persistent connection hash should be invalidated after a password change */
00140        unsigned             is_stub:1;                                /* flag to keep track whether the connection structure has a real OCI connection associated */
00141        unsigned             using_spool:1;                            /* Is this connection from session pool? */
00142        int                         rsrc_id;                                  /* resource ID */
00143        time_t               idle_expiry;                       /* time when the connection will be considered as expired */
00144        time_t           *next_pingp;                                  /* (pointer to) time of the next ping */
00145        char             *hash_key;                             /* hashed details of the connection */
00146 } php_oci_connection; /* }}} */
00147 
00148 typedef struct { /* php_oci_descriptor {{{ */
00149        int                                 id;
00150        ulong                        index;                          /* descriptors hash table index */
00151        php_oci_connection   *connection;                /* parent connection handle */
00152        dvoid                       *descriptor;                /* OCI descriptor handle */
00153        ub4                                 type;                             /* descriptor type (FILE/LOB) */
00154        int                                 lob_current_position;      /* LOB internal pointer */
00155        int                                 lob_size;                         /* cached LOB size. -1 = Lob wasn't initialized yet */
00156        int                                 buffering;                        /* cached buffering flag. 0 - off, 1 - on, 2 - on and buffer was used */
00157        ub4                                 chunk_size;                /* chunk size of the LOB. 0 - unknown */
00158        ub1                                 charset_form;                     /* charset form, required for NCLOBs */
00159        ub2                                 charset_id;                /* charset ID */
00160        unsigned                     is_open:1;                        /* helps to determine if lob is open or not */
00161 } php_oci_descriptor; /* }}} */
00162 
00163 typedef struct { /* php_oci_lob_ctx {{{ */
00164        char                    **lob_data;                            /* address of pointer to LOB data */
00165        ub4                                *lob_len;                          /* address of LOB length variable (bytes) */
00166        ub4                                 alloc_len;
00167 } php_oci_lob_ctx; /* }}} */
00168 
00169 typedef struct { /* php_oci_collection {{{ */
00170        int                                 id;
00171        php_oci_connection   *connection;                /* parent connection handle */
00172        OCIType                            *tdo;                              /* collection's type handle */
00173        OCITypeCode                  coll_typecode;                    /* collection's typecode handle */
00174        OCIRef                      *elem_ref;                         /* element's reference handle */
00175        OCIType                            *element_type;                     /* element's type handle */
00176        OCITypeCode                  element_typecode;          /* element's typecode handle */
00177        OCIColl                            *collection;                /* collection handle */
00178 } php_oci_collection; /* }}} */
00179 
00180 typedef struct { /* php_oci_define {{{ */
00181        zval          *zval;               /* zval used in define */
00182        text          *name;               /* placeholder's name */
00183        ub4                   name_len;           /* placeholder's name length */
00184        ub4                   type;               /* define type */
00185 } php_oci_define; /* }}} */
00186 
00187 typedef struct { /* php_oci_statement {{{ */
00188        int                                 id;
00189        int                                 parent_stmtid;                    /* parent statement id */
00190        php_oci_connection   *connection;                /* parent connection handle */
00191        sword                        errcode;                          /* last errcode*/
00192        OCIError                    *err;                              /* private error handle */
00193        OCIStmt                            *stmt;                             /* statement handle */
00194        char                        *last_query;                /* last query issued. also used to determine if this is a statement or a refcursor recieved from Oracle */
00195        long                         last_query_len;            /* last query length */
00196        HashTable                   *columns;                          /* hash containing all the result columns */
00197        HashTable                   *binds;                                   /* binds hash */
00198        HashTable                   *defines;                          /* defines hash */
00199        int                                 ncolumns;                         /* number of columns in the result */
00200        unsigned                     executed:1;                /* statement executed flag */
00201        unsigned                     has_data:1;                /* statement has more data flag */
00202        unsigned                     has_descr:1;               /* statement has at least one descriptor or cursor column */
00203        ub2                                 stmttype;                         /* statement type */
00204 } php_oci_statement; /* }}} */
00205 
00206 typedef struct { /* php_oci_bind {{{ */
00207        OCIBind                            *bind;                             /* bind handle */
00208        zval                        *zval;                             /* value */
00209        dvoid                       *descriptor;                /* used for binding of LOBS etc */
00210        OCIStmt                            *statement;                        /* used for binding REFCURSORs */
00211        php_oci_statement    *parent_statement;          /* pointer to the parent statement */
00212        ub2 type;                                        /* bind type */
00213        struct {
00214               void   *elements;
00215               sb2           *indicators;
00216               ub2           *element_lengths;
00217               ub4            current_length;
00218               ub4            old_length;
00219               ub4            max_length;
00220               long    type;
00221        } array;
00222        sb2                                 indicator;                        /* -1 means NULL */
00223        ub2                                 retcode;
00224        ub4                                 dummy_len;                        /* a dummy var to store alenpp value in bind OUT callback */
00225 } php_oci_bind; /* }}} */
00226 
00227 typedef struct { /* php_oci_out_column {{{ */
00228        php_oci_statement    *statement;                        /* statement handle. used when fetching REFCURSORS */
00229        php_oci_statement    *nested_statement;          /* statement handle. used when fetching REFCURSORS */
00230        OCIDefine                   *oci_define;                /* define handle */
00231        char                        *name;                             /* column name */
00232        ub4                                 name_len;                         /* column name length */
00233        ub2                                 data_type;                        /* column data type */
00234        ub2                                 data_size;                        /* data size */
00235        ub4                                 storage_size4;                    /* size used when allocating buffers */
00236        sb2                                 indicator;
00237        ub2                                 retcode;                          /* code returned when fetching this particular column */
00238        ub2                                 retlen;
00239        ub4                                 retlen4;
00240        ub2                                 is_descr;                         /* column contains a descriptor */
00241        ub2                                 is_cursor;                        /* column contains a cursor */
00242        int                                 stmtid;                           /* statement id for cursors */
00243        int                                 descid;                           /* descriptor id for descriptors */
00244        void                        *data;
00245        php_oci_define              *define;                           /* define handle */
00246        int                                 piecewise;                        /* column is fetched piece-by-piece */
00247        ub4                                 cb_retlen;
00248        sb1                                 scale;                                   /* column scale */
00249        sb2                                 precision;                        /* column precision */
00250        ub1                                 charset_form;                     /* charset form, required for NCLOBs */
00251        ub2                                 charset_id;                /* charset ID */
00252 } php_oci_out_column; /* }}} */
00253 
00254 /* {{{ macros */
00255 
00256 #define PHP_OCI_CALL(func, params) \
00257        do { \
00258               if (OCI_G(debug_mode)) { \
00259                      php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
00260               } \
00261               OCI_G(in_call) = 1; \
00262               func params; \
00263               OCI_G(in_call) = 0; \
00264        } while (0)
00265 
00266 #define PHP_OCI_CALL_RETURN(__retval, func, params) \
00267        do { \
00268               if (OCI_G(debug_mode)) { \
00269                      php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
00270               } \
00271               OCI_G(in_call) = 1; \
00272               __retval = func params; \
00273               OCI_G(in_call) = 0; \
00274        } while (0)
00275 
00276 /* Check for errors that indicate the connection to the DB is no
00277  * longer valid.  If it isn't, then the PHP connection is marked to be
00278  * reopened by the next PHP OCI8 connect command.  This is most useful
00279  * for persistent connections.     The error number list is not
00280  * exclusive.  The error number comparisons and the
00281  * OCI_ATTR_SERVER_STATUS check are done for maximum cross-version
00282  * compatibility. In the far future, only the attribute check will be
00283  * needed.
00284  */
00285 #define PHP_OCI_HANDLE_ERROR(connection, errcode) \
00286        do {                                                                    \
00287               switch (errcode) {                                        \
00288                      case  1013:                                               \
00289                             zend_bailout();                                    \
00290                             break;                                             \
00291                      case   22:                                                \
00292                      case   378:                                               \
00293                      case   602:                                               \
00294                      case   603:                                               \
00295                      case   604:                                               \
00296                      case   609:                                               \
00297                      case  1012:                                               \
00298                      case  1033:                                               \
00299                      case  1041:                                               \
00300                      case  1043:                                               \
00301                      case  1089:                                               \
00302                      case  1090:                                               \
00303                      case  1092:                                               \
00304                      case  3113:                                               \
00305                      case  3114:                                               \
00306                      case  3122:                                               \
00307                      case  3135:                                               \
00308                      case 12153:                                               \
00309                      case 27146:                                               \
00310                      case 28511:                                               \
00311                             (connection)->is_open = 0;           \
00312                             break;                                             \
00313                      default:                                                                     \
00314                      {                                                                                   \
00315                             ub4 serverStatus = OCI_SERVER_NORMAL;            \
00316                             PHP_OCI_CALL(OCIAttrGet, ((dvoid *)(connection)->server, OCI_HTYPE_SERVER, (dvoid *)&serverStatus, \
00317                                                                         (ub4 *)0, OCI_ATTR_SERVER_STATUS, (connection)->err)); \
00318                             if (serverStatus != OCI_SERVER_NORMAL) {  \
00319                                    (connection)->is_open = 0;                       \
00320                             }                                                                            \
00321                      }                                                                                   \
00322                      break;                                                                       \
00323               }                                                                                          \
00324        } while (0)
00325 
00326 #define PHP_OCI_REGISTER_RESOURCE(resource, le_resource) \
00327        do { \
00328               resource->id = ZEND_REGISTER_RESOURCE(NULL, resource, le_resource); \
00329        } while (0)
00330 
00331 #define PHP_OCI_ZVAL_TO_CONNECTION(zval, connection) \
00332        ZEND_FETCH_RESOURCE2(connection, php_oci_connection *, &zval, -1, "oci8 connection", le_connection, le_pconnection)
00333 
00334 #define PHP_OCI_ZVAL_TO_STATEMENT(zval, statement) \
00335        ZEND_FETCH_RESOURCE(statement, php_oci_statement *, &zval, -1, "oci8 statement", le_statement)
00336 
00337 #define PHP_OCI_ZVAL_TO_DESCRIPTOR(zval, descriptor) \
00338        ZEND_FETCH_RESOURCE(descriptor, php_oci_descriptor *, &zval, -1, "oci8 descriptor", le_descriptor)
00339 
00340 #define PHP_OCI_ZVAL_TO_COLLECTION(zval, collection) \
00341        ZEND_FETCH_RESOURCE(collection, php_oci_collection *, &zval, -1, "oci8 collection", le_collection)
00342 
00343 #define PHP_OCI_FETCH_RESOURCE_EX(zval, var, type, name, resource_type)                                          \
00344        do { \
00345               var = (type) zend_fetch_resource(&zval TSRMLS_CC, -1, name, NULL, 1, resource_type); \
00346               if (!var) {                                                                                                                                  \
00347                      return 1;                                                                                                                             \
00348               } \
00349        } while (0)
00350 
00351 #define PHP_OCI_ZVAL_TO_CONNECTION_EX(zval, connection) \
00352        PHP_OCI_FETCH_RESOURCE_EX(zval, connection, php_oci_connection *, "oci8 connection", le_connection)
00353 
00354 #define PHP_OCI_ZVAL_TO_STATEMENT_EX(zval, statement) \
00355        PHP_OCI_FETCH_RESOURCE_EX(zval, statement, php_oci_statement *, "oci8 statement", le_statement)
00356 
00357 #define PHP_OCI_ZVAL_TO_DESCRIPTOR_EX(zval, descriptor) \
00358        PHP_OCI_FETCH_RESOURCE_EX(zval, descriptor, php_oci_descriptor *, "oci8 descriptor", le_descriptor)
00359 
00360 #define PHP_OCI_ZVAL_TO_COLLECTION_EX(zval, collection) \
00361        PHP_OCI_FETCH_RESOURCE_EX(zval, collection, php_oci_collection *, "oci8 collection", le_collection)
00362 
00363 /* }}} */
00364 
00365 /* PROTOS */
00366 
00367 /* main prototypes {{{ */
00368 
00369 void php_oci_column_hash_dtor (void *data);
00370 void php_oci_define_hash_dtor (void *data);
00371 void php_oci_bind_hash_dtor (void *data);
00372 void php_oci_descriptor_flush_hash_dtor (void *data);
00373 
00374 void php_oci_connection_descriptors_free(php_oci_connection *connection TSRMLS_DC);
00375 
00376 sb4 php_oci_error (OCIError *, sword TSRMLS_DC);
00377 sb4 php_oci_fetch_errmsg(OCIError *, text ** TSRMLS_DC);
00378 int php_oci_fetch_sqltext_offset(php_oci_statement *, text **, ub2 * TSRMLS_DC);
00379 
00380 void php_oci_do_connect (INTERNAL_FUNCTION_PARAMETERS, int , int);
00381 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);
00382 
00383 int php_oci_connection_rollback(php_oci_connection * TSRMLS_DC);
00384 int php_oci_connection_commit(php_oci_connection * TSRMLS_DC);
00385 int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC);
00386 
00387 int php_oci_password_change(php_oci_connection *, char *, int, char *, int, char *, int TSRMLS_DC);
00388 void php_oci_client_get_version(char ** TSRMLS_DC);
00389 int php_oci_server_get_version(php_oci_connection *, char ** TSRMLS_DC);
00390 
00391 void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int, int);
00392 int php_oci_column_to_zval(php_oci_out_column *, zval *, int TSRMLS_DC);
00393 
00394 /* }}} */
00395 
00396 /* lob related prototypes {{{ */
00397 
00398 php_oci_descriptor * php_oci_lob_create (php_oci_connection *, long TSRMLS_DC);
00399 int php_oci_lob_get_length (php_oci_descriptor *, ub4 * TSRMLS_DC);
00400 int php_oci_lob_read (php_oci_descriptor *, long, long, char **, ub4 * TSRMLS_DC);
00401 int php_oci_lob_write (php_oci_descriptor *, ub4, char *, int, ub4 * TSRMLS_DC);
00402 int php_oci_lob_flush (php_oci_descriptor *, long TSRMLS_DC);
00403 int php_oci_lob_set_buffering (php_oci_descriptor *, int TSRMLS_DC);
00404 int php_oci_lob_get_buffering (php_oci_descriptor *);
00405 int php_oci_lob_copy (php_oci_descriptor *, php_oci_descriptor *, long TSRMLS_DC);
00406 int php_oci_lob_close (php_oci_descriptor * TSRMLS_DC);
00407 int php_oci_temp_lob_close (php_oci_descriptor * TSRMLS_DC);
00408 int php_oci_lob_write_tmp (php_oci_descriptor *, long, char *, int TSRMLS_DC);
00409 void php_oci_lob_free(php_oci_descriptor * TSRMLS_DC);
00410 int php_oci_lob_import(php_oci_descriptor *descriptor, char * TSRMLS_DC);
00411 int php_oci_lob_append (php_oci_descriptor *, php_oci_descriptor * TSRMLS_DC);
00412 int php_oci_lob_truncate (php_oci_descriptor *, long TSRMLS_DC);
00413 int php_oci_lob_erase (php_oci_descriptor *, long, ub4, ub4 * TSRMLS_DC);
00414 int php_oci_lob_is_equal (php_oci_descriptor *, php_oci_descriptor *, boolean * TSRMLS_DC);
00415 #if defined(HAVE_OCI_LOB_READ2)
00416 sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, oraub8 len, ub1 piece, dvoid **changed_bufpp, oraub8 *changed_lenp);
00417 #else
00418 sb4 php_oci_lob_callback (dvoid *ctxp, CONST dvoid *bufxp, ub4 len, ub1 piece);
00419 #endif
00420 /* }}} */
00421 
00422 /* collection related prototypes {{{ */
00423 
00424 php_oci_collection * php_oci_collection_create(php_oci_connection *, char *, int, char *, int TSRMLS_DC);
00425 int php_oci_collection_size(php_oci_collection *, sb4 * TSRMLS_DC);
00426 int php_oci_collection_max(php_oci_collection *, long * TSRMLS_DC);
00427 int php_oci_collection_trim(php_oci_collection *, long TSRMLS_DC);
00428 int php_oci_collection_append(php_oci_collection *, char *, int TSRMLS_DC);
00429 int php_oci_collection_element_get(php_oci_collection *, long, zval** TSRMLS_DC);
00430 int php_oci_collection_element_set(php_oci_collection *, long, char *, int TSRMLS_DC);
00431 int php_oci_collection_element_set_null(php_oci_collection *, long TSRMLS_DC);
00432 int php_oci_collection_element_set_date(php_oci_collection *, long, char *, int TSRMLS_DC);
00433 int php_oci_collection_element_set_number(php_oci_collection *, long, char *, int TSRMLS_DC);
00434 int php_oci_collection_element_set_string(php_oci_collection *, long, char *, int TSRMLS_DC);
00435 int php_oci_collection_assign(php_oci_collection *, php_oci_collection * TSRMLS_DC);
00436 void php_oci_collection_close(php_oci_collection * TSRMLS_DC);
00437 int php_oci_collection_append_null(php_oci_collection * TSRMLS_DC);
00438 int php_oci_collection_append_date(php_oci_collection *, char *, int TSRMLS_DC);
00439 int php_oci_collection_append_number(php_oci_collection *, char *, int TSRMLS_DC);
00440 int php_oci_collection_append_string(php_oci_collection *, char *, int TSRMLS_DC);
00441 
00442 
00443 /* }}} */
00444 
00445 /* statement related prototypes {{{ */
00446 
00447 php_oci_statement * php_oci_statement_create (php_oci_connection *, char *, int TSRMLS_DC);
00448 int php_oci_statement_set_prefetch (php_oci_statement *, long TSRMLS_DC);
00449 int php_oci_statement_fetch (php_oci_statement *, ub4 TSRMLS_DC);
00450 php_oci_out_column * php_oci_statement_get_column (php_oci_statement *, long, char *, int TSRMLS_DC);
00451 int php_oci_statement_execute (php_oci_statement *, ub4 TSRMLS_DC);
00452 int php_oci_statement_cancel (php_oci_statement * TSRMLS_DC);
00453 void php_oci_statement_free (php_oci_statement * TSRMLS_DC);
00454 int php_oci_bind_pre_exec(void *data, void *result TSRMLS_DC);
00455 int php_oci_bind_post_exec(void *data TSRMLS_DC);
00456 int php_oci_bind_by_name(php_oci_statement *, char *, int, zval*, long, ub2 TSRMLS_DC);
00457 sb4 php_oci_bind_in_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 *, ub1 *, dvoid **);
00458 sb4 php_oci_bind_out_callback(dvoid *, OCIBind *, ub4, ub4, dvoid **, ub4 **, ub1 *, dvoid **, ub2 **);
00459 php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAMETERS, int need_data);
00460 int php_oci_cleanup_pre_fetch(void *data TSRMLS_DC);
00461 
00462 int php_oci_statement_get_type(php_oci_statement *, ub2 * TSRMLS_DC);
00463 int php_oci_statement_get_numrows(php_oci_statement *, ub4 * TSRMLS_DC);
00464 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);
00465 php_oci_bind *php_oci_bind_array_helper_number(zval* var, long max_table_length TSRMLS_DC);
00466 php_oci_bind *php_oci_bind_array_helper_double(zval* var, long max_table_length TSRMLS_DC);
00467 php_oci_bind *php_oci_bind_array_helper_string(zval* var, long max_table_length, long maxlength TSRMLS_DC);
00468 php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, php_oci_connection *connection TSRMLS_DC);
00469 
00470 /* }}} */
00471 
00472 ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ */
00473        sword          errcode;                                        /* global last error code (used when connect fails, for example) */
00474        OCIError      *err;                                            /* global error handle */
00475 
00476        zend_bool      debug_mode;                              /* debug mode flag */
00477 
00478        long           max_persistent;                          /* maximum number of persistent connections per process */
00479        long           num_persistent;                          /* number of existing persistent connections */
00480        long           num_links;                                      /* non-persistent + persistent connections */
00481        long           num_statements;                          /* number of statements open */
00482        long           ping_interval;                                  /* time interval between pings */
00483        long           persistent_timeout;               /* time period after which idle persistent connection is considered expired */
00484        long           statement_cache_size;                    /* statement cache size. used with 9i+ clients only*/
00485        long           default_prefetch;                        /* default prefetch setting */
00486        zend_bool      privileged_connect;               /* privileged connect flag (On/Off) */
00487        zend_bool      old_oci_close_semantics;          /* old_oci_close_semantics flag (to determine the way oci_close() should behave) */
00488 
00489        int                   shutdown;                                       /* in shutdown flag */
00490 
00491        OCIEnv        *env;                                            /* global environment handle */
00492 
00493        zend_bool      in_call;
00494        char          *connection_class;
00495        zend_bool      events;
00496        char          *edition;
00497 ZEND_END_MODULE_GLOBALS(oci) /* }}} */
00498 
00499 #ifdef ZTS
00500 #define OCI_G(v) TSRMG(oci_globals_id, zend_oci_globals *, v)
00501 #else
00502 #define OCI_G(v) (oci_globals.v)
00503 #endif
00504 
00505 ZEND_EXTERN_MODULE_GLOBALS(oci)
00506 
00507 # endif /* !PHP_OCI8_INT_H */
00508 #else /* !HAVE_OCI8 */
00509 
00510 # define oci8_module_ptr NULL
00511 
00512 #endif /* HAVE_OCI8 */
00513 
00514 /*
00515  * Local variables:
00516  * tab-width: 4
00517  * c-basic-offset: 4
00518  * End:
00519  */