summaryrefslogtreecommitdiff
path: root/ext/oci8
diff options
context:
space:
mode:
authorChristopher Jones <sixd@php.net>2008-03-22 01:27:50 +0000
committerChristopher Jones <sixd@php.net>2008-03-22 01:27:50 +0000
commitc401491ca045e4ce7f5c5cd9a1db303692a6f44f (patch)
tree24f465e07aae387b4f61058ad49c563a29199275 /ext/oci8
parentf8f01a1fd1ef00c2797da5f2f8125a3b9d78f046 (diff)
downloadphp-git-c401491ca045e4ce7f5c5cd9a1db303692a6f44f.tar.gz
Further improvements to error handling
Diffstat (limited to 'ext/oci8')
-rw-r--r--ext/oci8/oci8.c103
-rw-r--r--ext/oci8/oci8_collection.c66
-rw-r--r--ext/oci8/oci8_lob.c46
-rw-r--r--ext/oci8/oci8_statement.c100
-rw-r--r--ext/oci8/php_oci8_int.h67
-rw-r--r--ext/oci8/tests/drcp_cclass1.phpt2
-rw-r--r--ext/oci8/tests/drcp_connect1.phpt8
7 files changed, 238 insertions, 154 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 9fd8917713..fea537934f 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -661,6 +661,7 @@ PHP_RINIT_FUNCTION(oci)
OCI_G(debug_mode) = 0; /* start "fresh" */
OCI_G(num_links) = OCI_G(num_persistent);
OCI_G(errcode) = 0;
+ OCI_G(request_shutdown) = 0;
return SUCCESS;
}
@@ -684,6 +685,9 @@ PHP_MSHUTDOWN_FUNCTION(oci)
PHP_RSHUTDOWN_FUNCTION(oci)
{
+ /* Set this to indicate request shutdown for all further processing */
+ OCI_G(request_shutdown) = 1;
+
#ifdef ZTS
zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_descriptor TSRMLS_CC);
#ifdef PHP_OCI8_HAVE_COLLECTIONS
@@ -694,7 +698,7 @@ PHP_RSHUTDOWN_FUNCTION(oci)
}
#endif
- /* check persistent connections and do the necessary actions if needed */
+ /* check persistent connections and do the necessary actions if needed. If persistent_helper is unable to process a pconnection because of a refcount, the processing would happen from np-destructor which is called when refcount goes to zero - php_oci_pconnection_list_np_dtor*/
zend_hash_apply(&EG(persistent_list), (apply_func_t) php_oci_persistent_helper TSRMLS_CC);
#ifdef ZTS
@@ -781,10 +785,37 @@ static void php_oci_pconnection_list_np_dtor(zend_rsrc_list_entry *entry TSRMLS_
{
php_oci_connection *connection = (php_oci_connection *)entry->ptr;
- /* If it is a bad connection, clean it up. This is the sole purpose of this dtor. We should ideally do a hash_del also, but this scenario is currently not possible. */
- if (connection && !connection->is_open && !connection->is_stub) {
- php_oci_connection_close(connection TSRMLS_CC);
- OCI_G(num_persistent)--;
+ /* We currently handle only session-pool using connections. TODO: Handle non-sessionpool connections as well */
+ if (connection && connection->using_spool && !connection->is_stub) {
+ zend_rsrc_list_entry *le;
+
+ if (!connection->is_open) {
+ /* Remove the hash entry if present */
+ if ((zend_hash_find(&EG(persistent_list), connection->hash_key, strlen(connection->hash_key)+1, (void **) &le)== SUCCESS) && (le->type == le_pconnection) && (le->ptr == connection)) {
+ zend_hash_del(&EG(persistent_list), connection->hash_key, strlen(connection->hash_key)+1);
+ }
+ else {
+ php_oci_connection_close(connection TSRMLS_CC);
+ }
+ OCI_G(num_persistent)--;
+
+ if (OCI_G(debug_mode)) {
+ php_printf ("OCI8 DEBUG L1: np_dtor cleaning up: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__);
+ }
+ }
+ else if (OCI_G(request_shutdown)){
+ /* Release the connection to underlying pool - same steps
+ * as the persistent helper. If we do this
+ * unconditionally, we would change existing behavior
+ * regarding out-of-scope pconnects. In future, we can
+ * enable this through a new flag
+ */
+ php_oci_connection_release(connection TSRMLS_CC);
+
+ if (OCI_G(debug_mode)) {
+ php_printf ("OCI8 DEBUG L1: np_dtor releasing: (%p) at (%s:%d) \n", connection, __FILE__, __LINE__);
+ }
+ }
}
} /* }}} */
@@ -999,14 +1030,16 @@ int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, u
PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *) sqltext, (ub4 *)0, OCI_ATTR_STATEMENT, statement->err));
if (statement->errcode != OCI_SUCCESS) {
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)error_offset, (ub4 *)0, OCI_ATTR_PARSE_ERROR_OFFSET, statement->err));
if (statement->errcode != OCI_SUCCESS) {
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
return 0;
@@ -1246,32 +1279,32 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
}
}
/* server died */
- connection->is_open = 0;
- connection->used_this_request = 1;
-
- /* Connection is no more part of the persistent list */
- free(connection->hash_key);
- connection->hash_key = NULL;
-
- /* We have to do a hash_del but need to preserve the resource if there is a positive refcount. Set the data pointer in the list entry to NULL */
- if (zend_list_find(connection->rsrc_id, &rsrc_type)) {
- le->ptr = NULL;
- }
-
- zend_hash_del(&EG(persistent_list), hashed_details.c, hashed_details.len+1);
- connection = NULL;
- goto open;
} else {
/* we do not ping non-persistent connections */
smart_str_free_ex(&hashed_details, 0);
zend_list_addref(connection->rsrc_id);
return connection;
}
+ } /* is_open is true? */
+
+ /* Server died - connection not usable. The is_open=true can also fall through to here, if ping fails */
+ if (persistent){
+ int rsrc_type;
+
+ connection->is_open = 0;
+ connection->used_this_request = 1;
+
+ /* We have to do a hash_del but need to preserve the resource if there is a positive refcount. Set the data pointer in the list entry to NULL */
+ if (connection == zend_list_find(connection->rsrc_id, &rsrc_type)) {
+ le->ptr = NULL;
+ }
+
+ zend_hash_del(&EG(persistent_list), hashed_details.c, hashed_details.len+1);
} else {
zend_hash_del(&EG(regular_list), hashed_details.c, hashed_details.len+1);
- connection = NULL;
- goto open;
}
+
+ connection = NULL;
} else if (found) {
/* found something, but it's not a connection, delete it */
if (persistent) {
@@ -1281,7 +1314,6 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
}
}
}
-open:
/* Check if we have reached max_persistent. If so, try to remove a few
* timed-out connections. As a last resort, return a non-persistent connection.
@@ -1460,7 +1492,7 @@ int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC)
connection->needs_commit = 0;
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -1475,7 +1507,7 @@ int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC)
connection->needs_commit = 0;
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -1638,7 +1670,7 @@ int php_oci_password_change(php_oci_connection *connection, char *user, int user
PHP_OCI_CALL_RETURN(connection->errcode, OCIPasswordChange, (connection->svc, connection->err, (text *)user, user_len, (text *)pass_old, pass_old_len, (text *)pass_new, pass_new_len, OCI_DEFAULT));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -1655,7 +1687,7 @@ int php_oci_server_get_version(php_oci_connection *connection, char **version TS
PHP_OCI_CALL_RETURN(connection->errcode, OCIServerVersion, (connection->svc, connection->err, (text *)version_buff, sizeof(version_buff), OCI_HTYPE_SVCCTX));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -1859,6 +1891,7 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC)
{
time_t timestamp;
php_oci_connection *connection;
+ int rsrc_type;
timestamp = time(NULL);
@@ -1866,7 +1899,17 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC)
if (le->type == le_pconnection) {
connection = (php_oci_connection *)le->ptr;
- if (connection->used_this_request) {
+ if (connection->using_spool && (connection == zend_list_find(connection->rsrc_id, &rsrc_type)) && rsrc_type == le_pconnection){
+ /* Do nothing - keep the connection as some one is referring to it. TODO: We should ideally have this for non-session_pool connections as well */
+ if (OCI_G(debug_mode)) {
+ php_printf ("OCI8 DEBUG L1: persistent_helper skipping : (%p) at (%s:%d) \n", connection, __FILE__, __LINE__);
+ }
+ }
+ else if (connection->used_this_request) {
+ if (OCI_G(debug_mode)) {
+ php_printf ("OCI8 DEBUG L1: persistent_helper processing : (%p stub=%d) at (%s:%d) \n", connection, connection->is_stub, __FILE__, __LINE__);
+ }
+
if ((PG(connection_status) & PHP_CONNECTION_TIMEOUT) || OCI_G(in_call)) {
return ZEND_HASH_APPLY_REMOVE;
}
diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c
index 5f56e376b1..d9cb796a9c 100644
--- a/ext/oci8/oci8_collection.c
+++ b/ext/oci8/oci8_collection.c
@@ -230,7 +230,8 @@ CLEANUP:
/* free the describe handle (Bug #44113) */
PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE));
}
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
php_oci_collection_close(collection TSRMLS_CC);
return NULL;
} /* }}} */
@@ -244,7 +245,8 @@ int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC)
PHP_OCI_CALL_RETURN(connection->errcode, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
return 0;
@@ -271,7 +273,8 @@ int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRML
PHP_OCI_CALL_RETURN(connection->errcode, OCICollTrim, (connection->env, connection->err, trim_size, collection->collection));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
return 0;
@@ -288,7 +291,8 @@ int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC)
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
return 0;
@@ -307,7 +311,8 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i
if (connection->errcode != OCI_SUCCESS) {
/* failed to convert string to date */
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -322,7 +327,8 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i
);
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -343,7 +349,8 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe
PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -358,7 +365,8 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe
);
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -376,7 +384,8 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme
PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -391,7 +400,8 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme
);
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -465,7 +475,8 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
);
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
FREE_ZVAL(*result_element);
return 1;
}
@@ -486,7 +497,8 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
FREE_ZVAL(*result_element);
return 1;
}
@@ -528,7 +540,8 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
PHP_OCI_CALL_RETURN(connection->errcode, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
FREE_ZVAL(*result_element);
return 1;
}
@@ -559,7 +572,8 @@ int php_oci_collection_element_set_null(php_oci_collection *collection, long ind
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
return 0;
@@ -578,7 +592,8 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind
if (connection->errcode != OCI_SUCCESS) {
/* failed to convert string to date */
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -594,7 +609,8 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind
);
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -615,7 +631,8 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i
PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -631,7 +648,8 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i
);
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -649,7 +667,8 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i
PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -665,7 +684,8 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i
);
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -721,7 +741,8 @@ int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_colle
PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
return 0;
@@ -737,7 +758,8 @@ void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC)
PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectFree, (connection->env, connection->err, (dvoid *)collection->collection, (ub2)OCI_OBJECTFREE_FORCE));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
}
}
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index 83a6719df0..99bf7211aa 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -118,7 +118,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D
if (descriptor->type == OCI_DTYPE_FILE) {
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -127,7 +127,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D
PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -138,7 +138,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -209,7 +209,7 @@ static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, l
PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return read_length; /* we have to return original length here */
}
@@ -281,7 +281,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -291,7 +291,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
PHP_OCI_CALL_RETURN(connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -305,7 +305,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
PHP_OCI_CALL_RETURN(connection->errcode, OCINlsNumericInfoGet, (connection->env, connection->err, &bytes_per_char, OCI_NLS_CHARSET_MAXBYTESZ));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -384,7 +384,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
#endif
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
if (*data) {
efree(*data);
@@ -400,7 +400,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
if (*data) {
efree(*data);
@@ -457,7 +457,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i
);
if (connection->errcode) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
*bytes_written = 0;
return 1;
@@ -500,7 +500,7 @@ int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS
}
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -558,7 +558,7 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d
);
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -577,7 +577,7 @@ int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
}
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -599,7 +599,7 @@ int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -608,7 +608,7 @@ int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -649,7 +649,7 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC)
PHP_OCI_CALL_RETURN(connection->errcode, OCILobFlushBuffer, (connection->svc, connection->err, lob, flush_flag));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -729,7 +729,7 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC
);
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
close(fp);
return 1;
@@ -765,7 +765,7 @@ int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor
PHP_OCI_CALL_RETURN(connection->errcode, OCILobAppend, (connection->svc, connection->err, lob_dest, lob_from));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -801,7 +801,7 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TS
PHP_OCI_CALL_RETURN(connection->errcode, OCILobTrim, (connection->svc, connection->err, lob, new_lob_length));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -835,7 +835,7 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length,
PHP_OCI_CALL_RETURN(connection->errcode, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+1));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -855,7 +855,7 @@ int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descript
PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsEqual, (connection->env, first_lob, second_lob, result));
if (connection->errcode) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -899,7 +899,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data,
);
if (connection->errcode) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
@@ -907,7 +907,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data,
PHP_OCI_CALL_RETURN(connection->errcode, OCILobOpen, (connection->svc, connection->err, lob, OCI_LOB_READWRITE));
if (connection->errcode) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return 1;
}
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index d95456f15f..f57ecce8b9 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -79,10 +79,10 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha
PHP_OCI_CALL_RETURN(connection->errcode, OCIStmtPrepare, (statement->stmt, connection->err, (text *)query, query_len, OCI_NTV_SYNTAX, OCI_DEFAULT));
#endif
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
#if HAVE_OCI_STMT_PREPARE2
- PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT));
+ PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_STRLS_CACHE_DELETE));
PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR));
#else
PHP_OCI_CALL(OCIHandleFree,(statement->stmt, OCI_HTYPE_STMT));
@@ -135,7 +135,7 @@ int php_oci_statement_set_prefetch(php_oci_statement *statement, long size TSRML
PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err));
if (statement->errcode != OCI_SUCCESS) {
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -266,7 +266,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
return 0;
}
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
statement->has_data = 0;
@@ -409,7 +409,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err));
if (statement->errcode != OCI_SUCCESS) {
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -433,7 +433,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtExecute, (statement->connection->svc, statement->stmt, statement->err, iters, 0, NULL, NULL, mode));
if (statement->errcode != OCI_SUCCESS) {
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -462,7 +462,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_ATTR_PARAM_COUNT, statement->err));
if (statement->errcode != OCI_SUCCESS) {
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -482,7 +482,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
PHP_OCI_CALL_RETURN(statement->errcode, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)&param, counter));
if (statement->errcode != OCI_SUCCESS) {
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -492,7 +492,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
if (statement->errcode != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -502,7 +502,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
if (statement->errcode != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -512,7 +512,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
if (statement->errcode != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -522,7 +522,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
if (statement->errcode != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -535,7 +535,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
if (statement->errcode != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -545,7 +545,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
if (statement->errcode != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -555,7 +555,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
if (statement->errcode != OCI_SUCCESS) {
PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -652,17 +652,17 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
PHP_OCI_CALL_RETURN(statement->errcode,
OCIDefineByPos,
(
- statement->stmt, /* IN/OUT handle to the requested SQL query */
- (OCIDefine **)&outcol->oci_define, /* IN/OUT pointer to a pointer to a define handle */
- statement->err, /* IN/OUT An error handle */
- counter, /* IN position in the select list */
- (dvoid *)NULL, /* IN/OUT pointer to a buffer */
- outcol->storage_size4, /* IN The size of each valuep buffer in bytes */
- define_type, /* IN The data type */
- (dvoid *)&outcol->indicator, /* IN pointer to an indicator variable or arr */
- (ub2 *)NULL, /* IN/OUT Pointer to array of length of data fetched */
- (ub2 *)NULL, /* OUT Pointer to array of column-level return codes */
- OCI_DYNAMIC_FETCH /* IN mode (OCI_DEFAULT, OCI_DYNAMIC_FETCH) */
+ statement->stmt, /* IN/OUT handle to the requested SQL query */
+ (OCIDefine **)&outcol->oci_define, /* IN/OUT pointer to a pointer to a define handle */
+ statement->err, /* IN/OUT An error handle */
+ counter, /* IN position in the select list */
+ (dvoid *)NULL, /* IN/OUT pointer to a buffer */
+ outcol->storage_size4, /* IN The size of each valuep buffer in bytes */
+ define_type, /* IN The data type */
+ (dvoid *)&outcol->indicator, /* IN pointer to an indicator variable or arr */
+ (ub2 *)NULL, /* IN/OUT Pointer to array of length of data fetched */
+ (ub2 *)NULL, /* OUT Pointer to array of column-level return codes */
+ OCI_DYNAMIC_FETCH /* IN mode (OCI_DEFAULT, OCI_DYNAMIC_FETCH) */
)
);
@@ -670,24 +670,24 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
PHP_OCI_CALL_RETURN(statement->errcode,
OCIDefineByPos,
(
- statement->stmt, /* IN/OUT handle to the requested SQL query */
- (OCIDefine **)&outcol->oci_define, /* IN/OUT pointer to a pointer to a define handle */
- statement->err, /* IN/OUT An error handle */
- counter, /* IN position in the select list */
- (dvoid *)buf, /* IN/OUT pointer to a buffer */
- outcol->storage_size4, /* IN The size of each valuep buffer in bytes */
- define_type, /* IN The data type */
- (dvoid *)&outcol->indicator, /* IN pointer to an indicator variable or arr */
- (ub2 *)&outcol->retlen, /* IN/OUT Pointer to array of length of data fetched */
- (ub2 *)&outcol->retcode, /* OUT Pointer to array of column-level return codes */
- OCI_DEFAULT /* IN mode (OCI_DEFAULT, OCI_DYNAMIC_FETCH) */
+ statement->stmt, /* IN/OUT handle to the requested SQL query */
+ (OCIDefine **)&outcol->oci_define, /* IN/OUT pointer to a pointer to a define handle */
+ statement->err, /* IN/OUT An error handle */
+ counter, /* IN position in the select list */
+ (dvoid *)buf, /* IN/OUT pointer to a buffer */
+ outcol->storage_size4, /* IN The size of each valuep buffer in bytes */
+ define_type, /* IN The data type */
+ (dvoid *)&outcol->indicator, /* IN pointer to an indicator variable or arr */
+ (ub2 *)&outcol->retlen, /* IN/OUT Pointer to array of length of data fetched */
+ (ub2 *)&outcol->retcode, /* OUT Pointer to array of column-level return codes */
+ OCI_DEFAULT /* IN mode (OCI_DEFAULT, OCI_DYNAMIC_FETCH) */
)
);
}
if (statement->errcode != OCI_SUCCESS) {
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 0;
}
@@ -849,7 +849,8 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
zval_dtor(*entry);
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
ZVAL_NULL(*entry);
} else {
ZVAL_STRINGL(*entry, (char *)buff, buff_len, 1);
@@ -858,7 +859,8 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
} else {
PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
if (connection->errcode != OCI_SUCCESS) {
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
add_next_index_null(bind->zval);
} else {
add_next_index_stringl(bind->zval, (char *)buff, buff_len, 1);
@@ -1041,7 +1043,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
);
if (statement->errcode != OCI_SUCCESS) {
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -1059,7 +1061,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
);
if (statement->errcode != OCI_SUCCESS) {
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -1081,7 +1083,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
);
if (statement->errcode) {
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -1261,7 +1263,7 @@ int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC
PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err));
if (statement->errcode != OCI_SUCCESS) {
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -1282,7 +1284,7 @@ int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSR
PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, OCI_ATTR_ROW_COUNT, statement->err));
if (statement->errcode != OCI_SUCCESS) {
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -1380,7 +1382,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam
if (statement->errcode != OCI_SUCCESS) {
efree(bind);
- php_oci_error(statement->err, statement->errcode TSRMLS_CC);
+ statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC);
PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode);
return 1;
}
@@ -1569,7 +1571,8 @@ php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, p
efree(bind->array.element_lengths);
efree(bind->array.elements);
efree(bind);
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return NULL;
}
@@ -1583,7 +1586,8 @@ php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, p
efree(bind->array.element_lengths);
efree(bind->array.elements);
efree(bind);
- php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC);
+ PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
return NULL;
}
diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index dfb3fb6e07..a80dcf6b2f 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -258,34 +258,44 @@ typedef struct { /* php_oci_out_column {{{ */
} while (0)
#define PHP_OCI_HANDLE_ERROR(connection, errcode) \
- do { \
- switch (errcode) { \
- case 1013: \
- zend_bailout(); \
- break; \
- case 22: \
- case 378: \
- case 602: \
- case 603: \
- case 604: \
- case 609: \
- case 1012: \
- 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; \
- } \
+ do { \
+ switch (errcode) { \
+ case 1013: \
+ zend_bailout(); \
+ break; \
+ case 22: \
+ case 378: \
+ case 602: \
+ case 603: \
+ case 604: \
+ case 609: \
+ case 1012: \
+ 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; \
+ default: \
+ { /* do both numeric checks (above) and the status check for maximum version compatibility */ \
+ ub4 serverStatus = OCI_SERVER_NORMAL; \
+ PHP_OCI_CALL(OCIAttrGet, ((dvoid *)(connection)->server, OCI_HTYPE_SERVER, (dvoid *)&serverStatus, \
+ (ub4 *)0, OCI_ATTR_SERVER_STATUS, (connection)->err)); \
+ if (serverStatus != OCI_SERVER_NORMAL) { \
+ (connection)->is_open = 0; \
+ } \
+ } \
+ break; \
+ } \
} while (0)
#define PHP_OCI_REGISTER_RESOURCE(resource, le_resource) \
@@ -453,6 +463,7 @@ ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ */
zend_bool old_oci_close_semantics; /* old_oci_close_semantics flag (to determine the way oci_close() should behave) */
int shutdown; /* in shutdown flag */
+ int request_shutdown; /* in request shutdown flag */
OCIEnv *env; /* global environment handle */
diff --git a/ext/oci8/tests/drcp_cclass1.phpt b/ext/oci8/tests/drcp_cclass1.phpt
index 333b6ca007..a37f4b37d7 100644
--- a/ext/oci8/tests/drcp_cclass1.phpt
+++ b/ext/oci8/tests/drcp_cclass1.phpt
@@ -40,7 +40,7 @@ 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'");
+$s = oci_parse($c, "select cclass_name from v\$cpool_cc_stats where cclass_name like '%.cc__$t' order by cclass_name");
oci_execute($s);
oci_fetch_all($s, $r);
var_dump($r);
diff --git a/ext/oci8/tests/drcp_connect1.phpt b/ext/oci8/tests/drcp_connect1.phpt
index a49885f1e4..aa7fab274c 100644
--- a/ext/oci8/tests/drcp_connect1.phpt
+++ b/ext/oci8/tests/drcp_connect1.phpt
@@ -1,7 +1,11 @@
--TEST--
DRCP: oci_connect()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension");
+require(dirname(__FILE__)."/details.inc");
+if (!$test_drcp) die("skip expected test results are only valid for DRCP Mode");
+?>
--INI--
oci8.connection_class=test
oci8.old_oci_close_semantics=0
@@ -50,7 +54,7 @@ drcp_set_packagevar($pconn1,1000);
oci_close($pconn1);
echo " Connection pconn1 closed....\n";
-// Second conenction with oci_pconnect should return the same session hence the
+// Second connection with oci_pconnect should return the same session hence the
// value returned is what is set by pconn1
var_dump($pconn2 = oci_pconnect($user,$password,$dbase));