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;
}
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
}
#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
{
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__);
+ }
+ }
}
} /* }}} */
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;
}
}
/* 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) {
}
}
}
-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.
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;
}
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;
}
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;
}
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;
}
{
time_t timestamp;
php_oci_connection *connection;
+ int rsrc_type;
timestamp = time(NULL);
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;
}
/* 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;
} /* }}} */
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;
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;
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;
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;
}
);
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;
}
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;
}
);
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;
}
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;
}
);
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;
}
);
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;
}
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;
}
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;
}
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;
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;
}
);
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;
}
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;
}
);
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;
}
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;
}
);
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;
}
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;
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);
}
}
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;
}
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;
}
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;
}
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 */
}
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;
}
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;
}
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;
}
#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);
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);
);
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;
}
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;
}
);
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;
}
}
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;
}
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;
}
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;
}
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;
}
);
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;
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;
}
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;
}
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;
}
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;
}
);
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;
}
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;
}
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));
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;
}
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;
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;
}
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;
}
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;
}
PHP_OCI_CALL_RETURN(statement->errcode, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)¶m, 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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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) */
)
);
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;
}
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);
} 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);
);
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;
}
);
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;
}
);
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
} 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) \
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 */
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);
--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
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));