mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
Cleaned up whitespace
Fixed bug #44372 (compilation with Oracle 10gR1 libraries) http://bugs.php.net/bug.php?id=44372 Updated updated error number list to improve re-connection behavior after a database restart. Guard against potential internal list corruption after ping removes old oci_pconnect() information. Fix ini_set("oci8.connection_class", "abc") to get an appropriate persistent connection. Ping at oci8.ping_interval for oci_connect() and oci_new_connect() when DRCP connections are used. This improves non-persistent connection reliability if a database gets restarted.
This commit is contained in:
parent
a25b1f6d6d
commit
7d41cd902b
4 changed files with 869 additions and 629 deletions
|
@ -166,7 +166,7 @@ directory will contain logs of any failures.
|
||||||
6. DRCP and FAN Support
|
6. DRCP and FAN Support
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
The PHP OCI8 Beta extension has support for the Oracle Database
|
The PHP 6 OCI8 Beta extension has support for the Oracle Database
|
||||||
Resident Connection Pool (DRCP) and Fast Application Notification
|
Resident Connection Pool (DRCP) and Fast Application Notification
|
||||||
(FAN).
|
(FAN).
|
||||||
|
|
||||||
|
@ -205,6 +205,25 @@ contains background information on DRCP.
|
||||||
After building PHP with the OCI8 extension and 11g libraries, follow
|
After building PHP with the OCI8 extension and 11g libraries, follow
|
||||||
these steps:
|
these steps:
|
||||||
|
|
||||||
|
6.2.0 Important: if Oracle Database 11.1.0.6 with DRCP connections is
|
||||||
|
used, then the Oracle database patch for bug 6474441 must be
|
||||||
|
applied (see section 6.5) or a workaround below used. Without
|
||||||
|
this patch, "ORA-01000: maximum open cursors exceeded", "ORA-01001
|
||||||
|
invalid cursor" or "ORA-01002 fetch out of sequence" errors may
|
||||||
|
occur.
|
||||||
|
|
||||||
|
If the Oracle 11.1.0.6 database patch cannot be applied, one of
|
||||||
|
the following three workarounds can be used to disable statement
|
||||||
|
caching instead:
|
||||||
|
|
||||||
|
(i) Connect using Oracle dedicated or shared servers instead of DRCP.
|
||||||
|
|
||||||
|
(ii) Set PHP's oci8.statement_cache_size to 0.
|
||||||
|
|
||||||
|
(iii) Set an event in the database initialization parameter file:
|
||||||
|
event="56699 trace name context forever, level 128".
|
||||||
|
|
||||||
|
|
||||||
6.2.1. As a privileged database administrator, use a program like
|
6.2.1. As a privileged database administrator, use a program like
|
||||||
SQL*Plus to start the connection pool in the database:
|
SQL*Plus to start the connection pool in the database:
|
||||||
|
|
||||||
|
@ -298,55 +317,15 @@ To enable FAN support in PHP, after building PHP with Oracle 10gR2 or
|
||||||
6.3.4. Run your application, connecting to a 10gR2 or 11g database.
|
6.3.4. Run your application, connecting to a 10gR2 or 11g database.
|
||||||
|
|
||||||
|
|
||||||
6.4. Changes in this release from PECL OCI8 1.3.0 Beta
|
6.4. Recommendations and Known Limitations
|
||||||
|
|
||||||
The initial release of OCI8 with DRCP and FAN support was PECL OCI8
|
6.4.1 Changing Password for DRCP connections
|
||||||
1.3.0 Beta. This section documents differences from that release.
|
|
||||||
|
|
||||||
6.4.1 Statement caching has been re-enabled.
|
Changing a password over DRCP connections will fail with the error
|
||||||
|
"ORA-56609: Usage not supported with DRCP". This is an documented
|
||||||
|
restriction of Oracle Database 11g.
|
||||||
|
|
||||||
Important: if Oracle Database 11.1.0.6 with DRCP connections is used,
|
6.4.2 LOGON Triggers can be used to set session properties
|
||||||
then the Oracle database patch for bug 6474441 must be applied (see
|
|
||||||
section 6.5) or a workaround below used. Without this patch,
|
|
||||||
"ORA-01000: maximum open cursors exceeded", "ORA-01001 invalid cursor"
|
|
||||||
or "ORA-01002 fetch out of sequence" errors may occur.
|
|
||||||
|
|
||||||
If the Oracle 11.1.0.6 database patch cannot be applied, one of the
|
|
||||||
following three workarounds can be used to disable statement caching
|
|
||||||
instead:
|
|
||||||
|
|
||||||
(i) Connect using Oracle dedicated or shared servers instead of DRCP.
|
|
||||||
|
|
||||||
(ii) Set PHP's oci8.statement_cache_size to 0.
|
|
||||||
|
|
||||||
(iii) Set an event in the database initialization parameter file:
|
|
||||||
event="56699 trace name context forever, level 128".
|
|
||||||
|
|
||||||
6.4.2 Changing Password for non-DRCP connections has been re-enabled.
|
|
||||||
|
|
||||||
When oci_password_change() is successfully performed for non-DRCP
|
|
||||||
connections in a PHP script, subsequent connections with the new
|
|
||||||
password from this PHP instance no longer fail with "ORA-1017 invalid
|
|
||||||
username/password".
|
|
||||||
|
|
||||||
Changing a password over DRCP connections will continue to fail with
|
|
||||||
the error "ORA-56609: Usage not supported with DRCP". This is an
|
|
||||||
documented restriction of Oracle Database 11g.
|
|
||||||
|
|
||||||
6.4.3 Oci8.max_persistent setting is re-enabled.
|
|
||||||
|
|
||||||
The php.ini parameter oci8.max_persistent will limit the number of
|
|
||||||
persistent connections that each PHP process will keep open between
|
|
||||||
HTTP requests. Any further oci_pconnect() calls once this limit is
|
|
||||||
reached will be treated as oci_connect() calls.
|
|
||||||
|
|
||||||
It is still recommended that DRCP users modify the connection pool
|
|
||||||
settings of the database to control resource usage. Non-DRCP users
|
|
||||||
should consider setting oci8.persistent_timeout to close idle
|
|
||||||
connections.
|
|
||||||
|
|
||||||
|
|
||||||
6.4.4 LOGON Triggers can be used to set session properties
|
|
||||||
|
|
||||||
The patch for Oracle Database 11.1.0.6 bug 6474441 (see section 6.5)
|
The patch for Oracle Database 11.1.0.6 bug 6474441 (see section 6.5)
|
||||||
allows PHP applications with DRCP connection to use a database LOGON
|
allows PHP applications with DRCP connection to use a database LOGON
|
||||||
|
@ -364,9 +343,9 @@ application code.
|
||||||
With DRCP there is an connection management relationship between (i)
|
With DRCP there is an connection management relationship between (i)
|
||||||
DRCP's automatic pool expansion and reduction, (ii) PHP's persistent
|
DRCP's automatic pool expansion and reduction, (ii) PHP's persistent
|
||||||
connection caching, (iii) with the way LOGON triggers fire with DRCP
|
connection caching, (iii) with the way LOGON triggers fire with DRCP
|
||||||
authentication. Because of this interplay, LOGON triggers in PHP when
|
authentication. Because of this interplay, LOGON triggers in PHP
|
||||||
DRCP is used are only recommended for setting session attributes and
|
(when DRCP is used) are only recommended for setting session
|
||||||
not for per-PHP connection events.
|
attributes and not for per-PHP connection events.
|
||||||
|
|
||||||
|
|
||||||
6.5. Patching Oracle Database 11g
|
6.5. Patching Oracle Database 11g
|
||||||
|
|
672
ext/oci8/oci8.c
672
ext/oci8/oci8.c
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| PHP Version 5 |
|
| PHP Version 6 |
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| Copyright (c) 1997-2008 The PHP Group |
|
| Copyright (c) 1997-2008 The PHP Group |
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
|
@ -34,13 +34,13 @@
|
||||||
/* misc defines {{{ */
|
/* misc defines {{{ */
|
||||||
# if (defined(__osf__) && defined(__alpha))
|
# if (defined(__osf__) && defined(__alpha))
|
||||||
# ifndef A_OSF
|
# ifndef A_OSF
|
||||||
# define A_OSF
|
# define A_OSF
|
||||||
# endif
|
# endif
|
||||||
# ifndef OSF1
|
# ifndef OSF1
|
||||||
# define OSF1
|
# define OSF1
|
||||||
# endif
|
# endif
|
||||||
# ifndef _INTRINSICS
|
# ifndef _INTRINSICS
|
||||||
# define _INTRINSICS
|
# define _INTRINSICS
|
||||||
# endif
|
# endif
|
||||||
# endif /* osf alpha */
|
# endif /* osf alpha */
|
||||||
|
|
||||||
|
@ -77,19 +77,19 @@ extern zend_class_entry *oci_coll_class_entry_ptr;
|
||||||
|
|
||||||
#define PHP_OCI_MAX_NAME_LEN 64
|
#define PHP_OCI_MAX_NAME_LEN 64
|
||||||
#define PHP_OCI_MAX_DATA_SIZE INT_MAX
|
#define PHP_OCI_MAX_DATA_SIZE INT_MAX
|
||||||
#define PHP_OCI_PIECE_SIZE (64*1024)-1
|
#define PHP_OCI_PIECE_SIZE (64*1024)-1
|
||||||
#define PHP_OCI_LOB_BUFFER_SIZE 1048576l /* 1Mb seems to be the most reasonable buffer size for LOB reading */
|
#define PHP_OCI_LOB_BUFFER_SIZE 1048576l /* 1Mb seems to be the most reasonable buffer size for LOB reading */
|
||||||
|
|
||||||
#define PHP_OCI_ASSOC 1<<0
|
#define PHP_OCI_ASSOC 1<<0
|
||||||
#define PHP_OCI_NUM 1<<1
|
#define PHP_OCI_NUM 1<<1
|
||||||
#define PHP_OCI_BOTH (PHP_OCI_ASSOC|PHP_OCI_NUM)
|
#define PHP_OCI_BOTH (PHP_OCI_ASSOC|PHP_OCI_NUM)
|
||||||
|
|
||||||
#define PHP_OCI_RETURN_NULLS 1<<2
|
#define PHP_OCI_RETURN_NULLS 1<<2
|
||||||
#define PHP_OCI_RETURN_LOBS 1<<3
|
#define PHP_OCI_RETURN_LOBS 1<<3
|
||||||
|
|
||||||
#define PHP_OCI_FETCHSTATEMENT_BY_COLUMN 1<<4
|
#define PHP_OCI_FETCHSTATEMENT_BY_COLUMN 1<<4
|
||||||
#define PHP_OCI_FETCHSTATEMENT_BY_ROW 1<<5
|
#define PHP_OCI_FETCHSTATEMENT_BY_ROW 1<<5
|
||||||
#define PHP_OCI_FETCHSTATEMENT_BY (PHP_OCI_FETCHSTATEMENT_BY_COLUMN | PHP_OCI_FETCHSTATEMENT_BY_ROW)
|
#define PHP_OCI_FETCHSTATEMENT_BY (PHP_OCI_FETCHSTATEMENT_BY_COLUMN | PHP_OCI_FETCHSTATEMENT_BY_ROW)
|
||||||
|
|
||||||
#define PHP_OCI_LOB_BUFFER_DISABLED 0
|
#define PHP_OCI_LOB_BUFFER_DISABLED 0
|
||||||
#define PHP_OCI_LOB_BUFFER_ENABLED 1
|
#define PHP_OCI_LOB_BUFFER_ENABLED 1
|
||||||
|
@ -103,147 +103,146 @@ typedef enum {
|
||||||
} php_oci_lob_type;
|
} php_oci_lob_type;
|
||||||
|
|
||||||
typedef struct { /* php_oci_spool {{{ */
|
typedef struct { /* php_oci_spool {{{ */
|
||||||
OCIEnv *env; /*env of this session pool */
|
OCIEnv *env; /*env of this session pool */
|
||||||
OCIError *err; /* pool's error handle */
|
OCIError *err; /* pool's error handle */
|
||||||
OCISPool *poolh; /* pool handle */
|
OCISPool *poolh; /* pool handle */
|
||||||
void *poolname; /* session pool name */
|
void *poolname; /* session pool name */
|
||||||
unsigned int poolname_len; /* length of session pool name */
|
unsigned int poolname_len; /* length of session pool name */
|
||||||
char *spool_hash_key; /* Hash key for session pool in plist */
|
char *spool_hash_key; /* Hash key for session pool in plist */
|
||||||
int spool_hash_key_len; /* Hash key length */
|
int spool_hash_key_len; /* Hash key length */
|
||||||
} php_oci_spool; /* }}} */
|
} php_oci_spool; /* }}} */
|
||||||
|
|
||||||
typedef struct { /* php_oci_connection {{{ */
|
typedef struct { /* php_oci_connection {{{ */
|
||||||
OCIEnv *env; /* private env handle */
|
OCIEnv *env; /* private env handle */
|
||||||
ub2 charset; /* charset ID */
|
ub2 charset; /* charset ID */
|
||||||
OCIServer *server; /* private server handle */
|
OCIServer *server; /* private server handle */
|
||||||
OCISvcCtx *svc; /* private service context handle */
|
OCISvcCtx *svc; /* private service context handle */
|
||||||
OCISession *session; /* private session handle */
|
OCISession *session; /* private session handle */
|
||||||
OCIAuthInfo *authinfo; /* Cached authinfo handle for OCISessionGet */
|
OCIAuthInfo *authinfo; /* Cached authinfo handle for OCISessionGet */
|
||||||
OCIError *err; /* private error handle */
|
OCIError *err; /* private error handle */
|
||||||
php_oci_spool *private_spool; /* private session pool (for persistent) */
|
php_oci_spool *private_spool; /* private session pool (for persistent) */
|
||||||
sword errcode; /* last errcode */
|
sword errcode; /* last errcode */
|
||||||
|
|
||||||
HashTable *descriptors; /* descriptors hash, used to flush all the LOBs using this connection on commit */
|
HashTable *descriptors; /* descriptors hash, used to flush all the LOBs using this connection on commit */
|
||||||
unsigned is_open:1; /* hels to determine if the connection is dead or not */
|
unsigned is_open:1; /* hels to determine if the connection is dead or not */
|
||||||
unsigned is_attached:1; /* hels to determine if we should detach from the server when closing/freeing the connection */
|
unsigned is_attached:1; /* hels to determine if we should detach from the server when closing/freeing the connection */
|
||||||
unsigned is_persistent:1; /* self-descriptive */
|
unsigned is_persistent:1; /* self-descriptive */
|
||||||
unsigned used_this_request:1; /* helps to determine if we should reset connection's next ping time and check its timeout */
|
unsigned used_this_request:1; /* helps to determine if we should reset connection's next ping time and check its timeout */
|
||||||
unsigned needs_commit:1; /* helps to determine if we should rollback this connection on close/shutdown */
|
unsigned needs_commit:1; /* helps to determine if we should rollback this connection on close/shutdown */
|
||||||
unsigned passwd_changed:1; /* helps determine if a persistent connection hash should be invalidated after a password change */
|
unsigned passwd_changed:1; /* helps determine if a persistent connection hash should be invalidated after a password change */
|
||||||
unsigned is_stub:1; /* flag to keep track whether the connection structure has a real OCI connection associated */
|
unsigned is_stub:1; /* flag to keep track whether the connection structure has a real OCI connection associated */
|
||||||
unsigned using_spool:1; /* Is this connection from session pool? */
|
unsigned using_spool:1; /* Is this connection from session pool? */
|
||||||
int rsrc_id; /* resource ID */
|
int rsrc_id; /* resource ID */
|
||||||
time_t idle_expiry; /* time when the connection will be considered as expired */
|
time_t idle_expiry; /* time when the connection will be considered as expired */
|
||||||
time_t next_ping; /* time of the next ping */
|
time_t *next_pingp; /* (pointer to) time of the next ping */
|
||||||
char *hash_key; /* hashed details of the connection */
|
char *hash_key; /* hashed details of the connection */
|
||||||
int hash_key_len;
|
int hash_key_len;
|
||||||
} php_oci_connection; /* }}} */
|
} php_oci_connection; /* }}} */
|
||||||
|
|
||||||
typedef struct { /* php_oci_descriptor {{{ */
|
typedef struct { /* php_oci_descriptor {{{ */
|
||||||
int id;
|
int id;
|
||||||
php_oci_connection *connection; /* parent connection handle */
|
php_oci_connection *connection; /* parent connection handle */
|
||||||
dvoid *descriptor; /* OCI descriptor handle */
|
dvoid *descriptor; /* OCI descriptor handle */
|
||||||
ub4 type; /* descriptor type (FILE/LOB) */
|
ub4 type; /* descriptor type (FILE/LOB) */
|
||||||
int lob_current_position; /* LOB internal pointer */
|
int lob_current_position; /* LOB internal pointer */
|
||||||
int lob_size; /* cached LOB size. -1 = Lob wasn't initialized yet */
|
int lob_size; /* cached LOB size. -1 = Lob wasn't initialized yet */
|
||||||
int buffering; /* cached buffering flag. 0 - off, 1 - on, 2 - on and buffer was used */
|
int buffering; /* cached buffering flag. 0 - off, 1 - on, 2 - on and buffer was used */
|
||||||
ub4 chunk_size; /* chunk size of the LOB. 0 - unknown */
|
ub4 chunk_size; /* chunk size of the LOB. 0 - unknown */
|
||||||
ub1 charset_form; /* charset form, required for NCLOBs */
|
ub1 charset_form; /* charset form, required for NCLOBs */
|
||||||
ub2 charset_id; /* charset ID */
|
ub2 charset_id; /* charset ID */
|
||||||
unsigned is_open:1; /* helps to determine if lob is open or not */
|
unsigned is_open:1; /* helps to determine if lob is open or not */
|
||||||
php_oci_lob_type lob_type; /* CLOB/BLOB */
|
php_oci_lob_type lob_type; /* CLOB/BLOB */
|
||||||
} php_oci_descriptor; /* }}} */
|
} php_oci_descriptor; /* }}} */
|
||||||
|
|
||||||
typedef struct { /* php_oci_lob_ctx {{{ */
|
typedef struct { /* php_oci_lob_ctx {{{ */
|
||||||
char **lob_data; /* address of pointer to LOB data */
|
char **lob_data; /* address of pointer to LOB data */
|
||||||
ub4 *lob_len; /* address of LOB length variable (bytes) */
|
ub4 *lob_len; /* address of LOB length variable (bytes) */
|
||||||
ub4 alloc_len;
|
ub4 alloc_len;
|
||||||
} php_oci_lob_ctx; /* }}} */
|
} php_oci_lob_ctx; /* }}} */
|
||||||
|
|
||||||
typedef struct { /* php_oci_collection {{{ */
|
typedef struct { /* php_oci_collection {{{ */
|
||||||
int id;
|
int id;
|
||||||
php_oci_connection *connection; /* parent connection handle */
|
php_oci_connection *connection; /* parent connection handle */
|
||||||
OCIType *tdo; /* collection's type handle */
|
OCIType *tdo; /* collection's type handle */
|
||||||
OCITypeCode coll_typecode; /* collection's typecode handle */
|
OCITypeCode coll_typecode; /* collection's typecode handle */
|
||||||
OCIRef *elem_ref; /* element's reference handle */
|
OCIRef *elem_ref; /* element's reference handle */
|
||||||
OCIType *element_type; /* element's type handle */
|
OCIType *element_type; /* element's type handle */
|
||||||
OCITypeCode element_typecode; /* element's typecode handle */
|
OCITypeCode element_typecode; /* element's typecode handle */
|
||||||
OCIColl *collection; /* collection handle */
|
OCIColl *collection; /* collection handle */
|
||||||
} php_oci_collection; /* }}} */
|
} php_oci_collection; /* }}} */
|
||||||
|
|
||||||
typedef struct { /* php_oci_define {{{ */
|
typedef struct { /* php_oci_define {{{ */
|
||||||
zval *zval; /* zval used in define */
|
zval *zval; /* zval used in define */
|
||||||
zstr name; /* placeholder's name */
|
zstr name; /* placeholder's name */
|
||||||
zend_uchar name_type; /* unicode or not */
|
zend_uchar name_type; /* unicode or not */
|
||||||
ub4 name_len; /* placeholder's name length */
|
ub4 name_len; /* placeholder's name length */
|
||||||
ub4 type; /* define type */
|
ub4 type; /* define type */
|
||||||
} php_oci_define; /* }}} */
|
} php_oci_define; /* }}} */
|
||||||
|
|
||||||
typedef struct { /* php_oci_statement {{{ */
|
typedef struct { /* php_oci_statement {{{ */
|
||||||
int id;
|
int id;
|
||||||
int parent_stmtid; /* parent statement id */
|
int parent_stmtid; /* parent statement id */
|
||||||
php_oci_connection *connection; /* parent connection handle */
|
php_oci_connection *connection; /* parent connection handle */
|
||||||
sword errcode; /* last errcode*/
|
sword errcode; /* last errcode*/
|
||||||
OCIError *err; /* private error handle */
|
OCIError *err; /* private error handle */
|
||||||
OCIStmt *stmt; /* statement handle */
|
OCIStmt *stmt; /* statement handle */
|
||||||
char *last_query; /* last query issued. also used to determine if this is a statement or a refcursor recieved from Oracle */
|
char *last_query; /* last query issued. also used to determine if this is a statement or a refcursor recieved from Oracle */
|
||||||
long last_query_len; /* last query length */
|
long last_query_len; /* last query length */
|
||||||
HashTable *columns; /* hash containing all the result columns */
|
HashTable *columns; /* hash containing all the result columns */
|
||||||
HashTable *binds; /* binds hash */
|
HashTable *binds; /* binds hash */
|
||||||
HashTable *defines; /* defines hash */
|
HashTable *defines; /* defines hash */
|
||||||
int ncolumns; /* number of columns in the result */
|
int ncolumns; /* number of columns in the result */
|
||||||
unsigned executed:1; /* statement executed flag */
|
unsigned executed:1; /* statement executed flag */
|
||||||
unsigned has_data:1; /* statement has more data flag */
|
unsigned has_data:1; /* statement has more data flag */
|
||||||
ub2 stmttype; /* statement type */
|
ub2 stmttype; /* statement type */
|
||||||
} php_oci_statement; /* }}} */
|
} php_oci_statement; /* }}} */
|
||||||
|
|
||||||
typedef struct { /* php_oci_bind {{{ */
|
typedef struct { /* php_oci_bind {{{ */
|
||||||
OCIBind *bind; /* bind handle */
|
OCIBind *bind; /* bind handle */
|
||||||
zval *zval; /* value */
|
zval *zval; /* value */
|
||||||
dvoid *descriptor; /* used for binding of LOBS etc */
|
dvoid *descriptor; /* used for binding of LOBS etc */
|
||||||
OCIStmt *statement; /* used for binding REFCURSORs */
|
OCIStmt *statement; /* used for binding REFCURSORs */
|
||||||
php_oci_statement *parent_statement; /* pointer to the parent statement */
|
php_oci_statement *parent_statement; /* pointer to the parent statement */
|
||||||
struct {
|
struct {
|
||||||
void *elements;
|
void *elements;
|
||||||
sb2 *indicators;
|
sb2 *indicators;
|
||||||
ub2 *element_lengths;
|
ub2 *element_lengths;
|
||||||
/* ub2 *retcodes; */
|
ub4 current_length;
|
||||||
ub4 current_length;
|
ub4 old_length;
|
||||||
ub4 old_length;
|
ub4 max_length;
|
||||||
ub4 max_length;
|
long type;
|
||||||
long type;
|
|
||||||
} array;
|
} array;
|
||||||
sb2 indicator; /* -1 means NULL */
|
sb2 indicator; /* -1 means NULL */
|
||||||
ub2 retcode; /* */
|
ub2 retcode;
|
||||||
zend_bool out; /* OUT bind or not */
|
zend_bool out; /* OUT bind or not */
|
||||||
ub4 dummy_len; /* a dummy var to store alenpp value in bind OUT callback */
|
ub4 dummy_len; /* a dummy var to store alenpp value in bind OUT callback */
|
||||||
} php_oci_bind; /* }}} */
|
} php_oci_bind; /* }}} */
|
||||||
|
|
||||||
typedef struct { /* php_oci_out_column {{{ */
|
typedef struct { /* php_oci_out_column {{{ */
|
||||||
php_oci_statement *statement; /* statement handle. used when fetching REFCURSORS */
|
php_oci_statement *statement; /* statement handle. used when fetching REFCURSORS */
|
||||||
php_oci_statement *nested_statement; /* statement handle. used when fetching REFCURSORS */
|
php_oci_statement *nested_statement; /* statement handle. used when fetching REFCURSORS */
|
||||||
OCIDefine *oci_define; /* define handle */
|
OCIDefine *oci_define; /* define handle */
|
||||||
zstr name; /* column name */
|
zstr name; /* column name */
|
||||||
ub4 name_len; /* column name length */
|
ub4 name_len; /* column name length */
|
||||||
ub2 data_type; /* column data type */
|
ub2 data_type; /* column data type */
|
||||||
ub2 data_size; /* data size */
|
ub2 data_size; /* data size */
|
||||||
ub4 storage_size4; /* size used when allocating buffers */
|
ub4 storage_size4; /* size used when allocating buffers */
|
||||||
sb2 indicator; /* */
|
sb2 indicator;
|
||||||
ub2 retcode; /* code returned when fetching this particular column */
|
ub2 retcode; /* code returned when fetching this particular column */
|
||||||
ub2 retlen; /* */
|
ub2 retlen;
|
||||||
ub4 retlen4; /* */
|
ub4 retlen4;
|
||||||
ub2 is_descr; /* column contains a descriptor */
|
ub2 is_descr; /* column contains a descriptor */
|
||||||
ub2 is_cursor; /* column contains a cursor */
|
ub2 is_cursor; /* column contains a cursor */
|
||||||
int stmtid; /* statement id for cursors */
|
int stmtid; /* statement id for cursors */
|
||||||
int descid; /* descriptor id for descriptors */
|
int descid; /* descriptor id for descriptors */
|
||||||
void *data; /* */
|
void *data;
|
||||||
php_oci_define *define; /* define handle */
|
php_oci_define *define; /* define handle */
|
||||||
int piecewise; /* column is fetched piece-by-piece */
|
int piecewise; /* column is fetched piece-by-piece */
|
||||||
ub4 cb_retlen; /* */
|
ub4 cb_retlen;
|
||||||
sb1 scale; /* column scale */
|
sb1 scale; /* column scale */
|
||||||
sb2 precision; /* column precision */
|
sb2 precision; /* column precision */
|
||||||
ub1 charset_form; /* charset form, required for NCLOBs */
|
ub1 charset_form; /* charset form, required for NCLOBs */
|
||||||
ub2 charset_id; /* charset ID */
|
ub2 charset_id; /* charset ID */
|
||||||
} php_oci_out_column; /* }}} */
|
} php_oci_out_column; /* }}} */
|
||||||
|
|
||||||
/* {{{ macros */
|
/* {{{ macros */
|
||||||
|
@ -271,17 +270,31 @@ typedef struct { /* php_oci_out_column {{{ */
|
||||||
#define PHP_OCI_HANDLE_ERROR(connection, errcode) \
|
#define PHP_OCI_HANDLE_ERROR(connection, errcode) \
|
||||||
do { \
|
do { \
|
||||||
switch (errcode) { \
|
switch (errcode) { \
|
||||||
case 1013: \
|
case 1013: \
|
||||||
zend_bailout(); \
|
zend_bailout(); \
|
||||||
break; \
|
break; \
|
||||||
case 22: \
|
case 22: \
|
||||||
case 1012: \
|
case 378: \
|
||||||
case 3113: \
|
case 602: \
|
||||||
case 604: \
|
case 603: \
|
||||||
case 1041: \
|
case 604: \
|
||||||
case 3114: \
|
case 609: \
|
||||||
connection->is_open = 0; \
|
case 1012: \
|
||||||
break; \
|
case 1033: \
|
||||||
|
case 1041: \
|
||||||
|
case 1043: \
|
||||||
|
case 1089: \
|
||||||
|
case 1090: \
|
||||||
|
case 1092: \
|
||||||
|
case 3113: \
|
||||||
|
case 3114: \
|
||||||
|
case 3122: \
|
||||||
|
case 3135: \
|
||||||
|
case 12153: \
|
||||||
|
case 27146: \
|
||||||
|
case 28511: \
|
||||||
|
connection->is_open = 0; \
|
||||||
|
break; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -302,11 +315,11 @@ typedef struct { /* php_oci_out_column {{{ */
|
||||||
#define PHP_OCI_ZVAL_TO_COLLECTION(zval, collection) \
|
#define PHP_OCI_ZVAL_TO_COLLECTION(zval, collection) \
|
||||||
ZEND_FETCH_RESOURCE(collection, php_oci_collection *, &zval, -1, "oci8 collection", le_collection)
|
ZEND_FETCH_RESOURCE(collection, php_oci_collection *, &zval, -1, "oci8 collection", le_collection)
|
||||||
|
|
||||||
#define PHP_OCI_FETCH_RESOURCE_EX(zval, var, type, name, resource_type) \
|
#define PHP_OCI_FETCH_RESOURCE_EX(zval, var, type, name, resource_type) \
|
||||||
do { \
|
do { \
|
||||||
var = (type) zend_fetch_resource(&zval TSRMLS_CC, -1, name, NULL, 1, resource_type); \
|
var = (type) zend_fetch_resource(&zval TSRMLS_CC, -1, name, NULL, 1, resource_type); \
|
||||||
if (!var) { \
|
if (!var) { \
|
||||||
return 1; \
|
return 1; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -434,35 +447,29 @@ php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, p
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ */
|
ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ */
|
||||||
sword errcode; /* global last error code (used when connect fails, for example) */
|
sword errcode; /* global last error code (used when connect fails, for example) */
|
||||||
OCIError *err; /* global error handle */
|
OCIError *err; /* global error handle */
|
||||||
|
|
||||||
/*
|
zend_bool debug_mode; /* debug mode flag */
|
||||||
char *default_username;
|
|
||||||
char *default_password;
|
|
||||||
char *default_dbname;
|
|
||||||
*/
|
|
||||||
|
|
||||||
zend_bool debug_mode; /* debug mode flag */
|
long max_persistent; /* maximum number of persistent connections per process */
|
||||||
|
long num_persistent; /* number of existing persistent connections */
|
||||||
|
long num_links; /* non-persistent + persistent connections */
|
||||||
|
long num_statements; /* number of statements open */
|
||||||
|
long ping_interval; /* time interval between pings */
|
||||||
|
long persistent_timeout; /* time period after which idle persistent connection is considered expired */
|
||||||
|
long statement_cache_size; /* statement cache size. used with 9i+ clients only*/
|
||||||
|
long default_prefetch; /* default prefetch setting */
|
||||||
|
zend_bool privileged_connect; /* privileged connect flag (On/Off) */
|
||||||
|
zend_bool old_oci_close_semantics; /* old_oci_close_semantics flag (to determine the way oci_close() should behave) */
|
||||||
|
|
||||||
long max_persistent; /* maximum number of persistent connections per process */
|
int shutdown; /* in shutdown flag */
|
||||||
long num_persistent; /* number of existing persistent connections */
|
|
||||||
long num_links; /* non-persistent + persistent connections */
|
|
||||||
long num_statements; /* number of statements open */
|
|
||||||
long ping_interval; /* time interval between pings */
|
|
||||||
long persistent_timeout; /* time period after which idle persistent connection is considered expired */
|
|
||||||
long statement_cache_size; /* statement cache size. used with 9i+ clients only*/
|
|
||||||
long default_prefetch; /* default prefetch setting */
|
|
||||||
zend_bool privileged_connect; /* privileged connect flag (On/Off) */
|
|
||||||
zend_bool old_oci_close_semantics; /* old_oci_close_semantics flag (to determine the way oci_close() should behave) */
|
|
||||||
|
|
||||||
int shutdown; /* in shutdown flag */
|
OCIEnv *env; /* global environment handle */
|
||||||
|
|
||||||
OCIEnv *env; /* global environment handle */
|
zend_bool in_call;
|
||||||
|
char *connection_class;
|
||||||
zend_bool in_call;
|
zend_bool events;
|
||||||
char *connection_class;
|
|
||||||
zend_bool events;
|
|
||||||
ZEND_END_MODULE_GLOBALS(oci) /* }}} */
|
ZEND_END_MODULE_GLOBALS(oci) /* }}} */
|
||||||
|
|
||||||
#ifdef ZTS
|
#ifdef ZTS
|
||||||
|
@ -486,5 +493,3 @@ ZEND_EXTERN_MODULE_GLOBALS(oci)
|
||||||
* c-basic-offset: 4
|
* c-basic-offset: 4
|
||||||
* End:
|
* End:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
108
ext/oci8/tests/drcp_cclass1.phpt
Normal file
108
ext/oci8/tests/drcp_cclass1.phpt
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
--TEST--
|
||||||
|
DRCP: Test setting connection class inline
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
|
||||||
|
require(__DIR__."/details.inc");
|
||||||
|
if (!$test_drcp) die("skip testing DRCP connection class only works in DRCP mode");
|
||||||
|
if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require(__DIR__."/details.inc");
|
||||||
|
|
||||||
|
// Initialization
|
||||||
|
|
||||||
|
$t = time();
|
||||||
|
$cc1 = 'cc1_'.$t;
|
||||||
|
$cc2 = 'cc2_'.$t;
|
||||||
|
|
||||||
|
// Run Test
|
||||||
|
|
||||||
|
echo "Test 1\n";
|
||||||
|
|
||||||
|
ini_set('oci8.connection_class', $cc1);
|
||||||
|
$c = oci_pconnect($user, $password, $dbase);
|
||||||
|
$s = oci_parse($c, "select * from dual");
|
||||||
|
oci_execute($s);
|
||||||
|
oci_fetch_all($s, $r);
|
||||||
|
var_dump($r);
|
||||||
|
|
||||||
|
echo "Test 2\n";
|
||||||
|
|
||||||
|
ini_set('oci8.connection_class', $cc2);
|
||||||
|
$c = oci_pconnect($user, $password, $dbase);
|
||||||
|
$s = oci_parse($c, "select * from dual");
|
||||||
|
oci_execute($s);
|
||||||
|
oci_fetch_all($s, $r);
|
||||||
|
var_dump($r);
|
||||||
|
|
||||||
|
echo "Test 3\n";
|
||||||
|
|
||||||
|
$s = oci_parse($c, "select cclass_name from v\$cpool_cc_stats where cclass_name like '%.cc__$t'");
|
||||||
|
oci_execute($s);
|
||||||
|
oci_fetch_all($s, $r);
|
||||||
|
var_dump($r);
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
|
||||||
|
echo "Done\n";
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Test 1
|
||||||
|
array(1) {
|
||||||
|
["DUMMY"]=>
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
string(1) "X"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Test 2
|
||||||
|
array(1) {
|
||||||
|
["DUMMY"]=>
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
string(1) "X"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Test 3
|
||||||
|
array(1) {
|
||||||
|
["CCLASS_NAME"]=>
|
||||||
|
array(2) {
|
||||||
|
[0]=>
|
||||||
|
string(21) "%s.cc1_%d"
|
||||||
|
[1]=>
|
||||||
|
string(21) "%s.cc2_%d"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Done
|
||||||
|
--UEXPECTF--
|
||||||
|
Test 1
|
||||||
|
array(1) {
|
||||||
|
[u"DUMMY"]=>
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
unicode(1) "X"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Test 2
|
||||||
|
array(1) {
|
||||||
|
[u"DUMMY"]=>
|
||||||
|
array(1) {
|
||||||
|
[0]=>
|
||||||
|
unicode(1) "X"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Test 3
|
||||||
|
array(1) {
|
||||||
|
[u"CCLASS_NAME"]=>
|
||||||
|
array(2) {
|
||||||
|
[0]=>
|
||||||
|
unicode(21) "%s.cc1_%d"
|
||||||
|
[1]=>
|
||||||
|
unicode(21) "%s.cc2_%d"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Done
|
Loading…
Add table
Add a link
Reference in a new issue