]> granicus.if.org Git - php/commitdiff
oci8: Sync with 5.3 - version macro updates and DRCP tweaks
authorChristopher Jones <sixd@php.net>
Tue, 25 Mar 2008 02:25:03 +0000 (02:25 +0000)
committerChristopher Jones <sixd@php.net>
Tue, 25 Mar 2008 02:25:03 +0000 (02:25 +0000)
12 files changed:
ext/oci8/config.m4
ext/oci8/config.w32
ext/oci8/oci8.c
ext/oci8/oci8_collection.c
ext/oci8/oci8_interface.c
ext/oci8/oci8_lob.c
ext/oci8/oci8_statement.c
ext/oci8/php_oci8.h
ext/oci8/php_oci8_int.h
ext/oci8/tests/drcp_cclass1.phpt
ext/oci8/tests/drcp_connect1.phpt
main/build-defs.h.in

index 6cfb167edea3d23be1efb32e33119d33fe945ce8..6dfc647a26909440b02e0ac94cf7fbd4b5e7f6f9 100644 (file)
@@ -214,7 +214,6 @@ if test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
     9.0)
       PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
       PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD)
-      AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])
 
       dnl These functions are only available in version >= 9.2
       PHP_CHECK_LIBRARY(clntsh, OCIEnvNlsCreate,
@@ -256,7 +255,6 @@ if test "$PHP_OCI8" != "no" && test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then
     11.1|10.1)
       PHP_ADD_LIBRARY(clntsh, 1, OCI8_SHARED_LIBADD)
       PHP_ADD_LIBPATH($OCI8_DIR/$OCI8_LIB_DIR, OCI8_SHARED_LIBADD)
-      AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])
       AC_DEFINE(HAVE_OCI_ENV_NLS_CREATE,1,[ ])
       AC_DEFINE(HAVE_OCI_ENV_CREATE,1,[ ])
       AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ])
@@ -376,7 +374,6 @@ dnl Header directory for manual installation
   esac
 
   AC_DEFINE(HAVE_OCI_INSTANT_CLIENT,1,[ ])
-  AC_DEFINE(HAVE_OCI8_ATTR_STATEMENT,1,[ ])
   AC_DEFINE(HAVE_OCI_ENV_NLS_CREATE,1,[ ])
   AC_DEFINE(HAVE_OCI_ENV_CREATE,1,[ ])
   AC_DEFINE(HAVE_OCI_STMT_PREPARE2,1,[ ])
index f12cb25e7eafc454b1faf32893a317c3545a42d7..580e3ff80b439ab439eaaa9b382a711d210d3aaf 100644 (file)
@@ -13,7 +13,6 @@ if (PHP_OCI8 != "no") {
        
                AC_DEFINE('HAVE_OCI8', 1);
                AC_DEFINE('HAVE_OCI_INSTANT_CLIENT', 1);
-               AC_DEFINE('HAVE_OCI8_ATTR_STATEMENT', 1);
                AC_DEFINE('HAVE_OCI_ENV_NLS_CREATE', 1);
                AC_DEFINE('HAVE_OCI_ENV_CREATE', 1);
                AC_DEFINE('HAVE_OCI_STMT_PREPARE2', 1);
index f27607d40413faadfe4f269ea1ed711ff963e7fb..d48d78996859c01bfcf7e7c83902da785d1b20ad 100644 (file)
@@ -622,6 +622,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;
 }
@@ -645,6 +646,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
@@ -655,7 +659,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
@@ -672,7 +676,7 @@ PHP_MINFO_FUNCTION(oci)
 
        php_info_print_table_start();
        php_info_print_table_row(2, "OCI8 Support", "enabled");
-       php_info_print_table_row(2, "Version", "1.3.1 Beta");
+       php_info_print_table_row(2, "Version", PHP_OCI8_VERSION);
        php_info_print_table_row(2, "Revision", "$Revision$");
 
        snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent));
@@ -681,7 +685,7 @@ PHP_MINFO_FUNCTION(oci)
        php_info_print_table_row(2, "Active Connections", buf);
 
 #if !defined(PHP_WIN32) && !defined(HAVE_OCI_INSTANT_CLIENT)
-       php_info_print_table_row(2, "Oracle Version", PHP_OCI8_VERSION );
+       php_info_print_table_row(2, "Oracle Version", PHP_OCI8_ORACLE_VERSION );
        php_info_print_table_row(2, "Compile-time ORACLE_HOME", PHP_OCI8_DIR );
        php_info_print_table_row(2, "Libraries Used", PHP_OCI8_SHARED_LIBADD );
 #else
@@ -742,10 +746,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, connection->hash_key_len + 1, (void **) &le)== SUCCESS) && (le->type == le_pconnection) && (le->ptr == connection)) {
+                               zend_hash_del(&EG(persistent_list), connection->hash_key, connection->hash_key_len + 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__);
+                       }
+               }
        }
 } /* }}} */
 
@@ -975,7 +1006,6 @@ sb4 php_oci_fetch_errmsg(OCIError *error_handle, text **error_buf TSRMLS_DC)
        return error_code;
 } /* }}} */
 
-#ifdef HAVE_OCI8_ATTR_STATEMENT
 /* {{{ php_oci_fetch_sqltext_offset()
  Compute offset in the SQL statement */
 int php_oci_fetch_sqltext_offset(php_oci_statement *statement, zstr *sqltext, ub2 *error_offset TSRMLS_DC)
@@ -992,19 +1022,20 @@ int php_oci_fetch_sqltext_offset(php_oci_statement *statement,   zstr *sqltext, ub
        }
 
        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;
 } /* }}} */
-#endif
 
 /* {{{ php_oci_do_connect()
  Connect wrapper */
@@ -1243,33 +1274,32 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
                                                }
                                        }
                                        /* 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;
-                                       connection->hash_key_len = 0;
-
-                                       /* 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) {
@@ -1279,7 +1309,6 @@ php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr
                        }
                }
        }
-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.
@@ -1461,7 +1490,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;
        }
@@ -1476,7 +1505,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;
        }
@@ -1639,7 +1668,7 @@ int php_oci_password_change(php_oci_connection *connection, zstr user, int user_
        PHP_OCI_CALL_RETURN(connection->errcode, OCIPasswordChange, (connection->svc, connection->err, (text *)user.s, USTR_BYTES(type, user_len), (text *)pass_old.s, USTR_BYTES(type, pass_old_len), (text *)pass_new.s, USTR_BYTES(type, 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;
        }
@@ -1656,7 +1685,7 @@ int php_oci_server_get_version(php_oci_connection *connection, zstr *version TSR
        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;
        }
@@ -1878,6 +1907,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);
 
@@ -1885,7 +1915,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;
                        }
index 528c574bcebd7899d03d0ef39d11346314f6b702..02810bf577efeb6c5a9a0834ebe382fe192027b2 100644 (file)
@@ -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, zstr date, in
 
        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, zstr date, in
        );
 
        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;
        }
                        
@@ -347,7 +353,8 @@ int php_oci_collection_append_number(php_oci_collection *collection, zstr number
        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;
        }
 
@@ -362,7 +369,8 @@ int php_oci_collection_append_number(php_oci_collection *collection, zstr 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;
        }
 
@@ -380,7 +388,8 @@ int php_oci_collection_append_string(php_oci_collection *collection, zstr elemen
        PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element.s, TEXT_BYTES(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;
        }
 
@@ -395,7 +404,8 @@ int php_oci_collection_append_string(php_oci_collection *collection, zstr elemen
        );
 
        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;
        }
 
@@ -469,7 +479,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;
        }
@@ -490,7 +501,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;
                        }
@@ -544,7 +556,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;
                        }
@@ -575,7 +588,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;
@@ -594,7 +608,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;
        }
 
@@ -610,7 +625,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;
        }
                        
@@ -635,7 +651,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;
        }
 
@@ -651,7 +668,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;
        }
 
@@ -669,7 +687,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.s, TEXT_BYTES(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;
        }
 
@@ -685,7 +704,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;
        }
 
@@ -741,7 +761,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;
@@ -757,7 +778,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);
                }
        }
        
index 485692c5dc75489e4b12505f97863425367ac9e9..419327cfe13adc2d417805f17e7f67b135e26b77 100644 (file)
@@ -1637,10 +1637,8 @@ PHP_FUNCTION(oci_error)
        sb4 errcode = 0;
        sword error = OCI_SUCCESS;
        dvoid *errh = NULL;
-#ifdef HAVE_OCI8_ATTR_STATEMENT
        ub2 error_offset = 0;
        zstr sqltext = NULL_ZSTR;
-#endif
 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &arg) == FAILURE) {
                return;
@@ -1653,11 +1651,9 @@ PHP_FUNCTION(oci_error)
                        errh = statement->err;
                        error = statement->errcode;
 
-#ifdef HAVE_OCI8_ATTR_STATEMENT
                        if (php_oci_fetch_sqltext_offset(statement, &sqltext, &error_offset TSRMLS_CC)) {
                                RETURN_FALSE;
                        }
-#endif
                        goto go_out;
                }
 
@@ -1695,14 +1691,12 @@ go_out:
                array_init(return_value);
                add_ascii_assoc_long(return_value, "code", errcode);
                add_ascii_assoc_text(return_value, "message", ZSTR((char *)errbuf), 0);
-#ifdef HAVE_OCI8_ATTR_STATEMENT
                add_ascii_assoc_long(return_value, "offset", error_offset);
                if (sqltext.v) {
                        add_ascii_assoc_text(return_value, "sqltext", sqltext, 1);
                } else {
                        add_ascii_assoc_ascii_string(return_value, "sqltext", "", 1);
                }
-#endif
        } else {
                RETURN_FALSE;
        }
index 6ee516867d490a87a4d7c96c0ae4122ecf7c8898..cccad0dfe7b68df53db8d676bc21c0170f13962a 100644 (file)
@@ -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;
                        }
@@ -215,7 +215,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 */
                }
@@ -286,7 +286,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;
                }
@@ -300,7 +300,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;
                }
@@ -379,7 +379,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->s) {
                        efree(data->s);
@@ -395,7 +395,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->s) {
                                efree(data->s);
@@ -462,7 +462,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, zstr data, in
                );
 
        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;
@@ -505,7 +505,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;
        }
@@ -563,7 +563,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;
        }
@@ -582,7 +582,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;
        }
@@ -604,7 +604,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;
        }
@@ -613,7 +613,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;
                }
@@ -654,7 +654,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;
        }
@@ -734,7 +734,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;
@@ -770,7 +770,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;
        }
@@ -806,7 +806,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;
        }
@@ -840,7 +840,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;
        }
@@ -860,7 +860,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;
        }
@@ -904,7 +904,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, zstr 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;
        }
@@ -912,7 +912,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, zstr 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;
        }
@@ -945,7 +945,7 @@ int php_oci_lob_get_type(php_oci_descriptor *descriptor, php_oci_lob_type *lob_t
                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;
                }
index 4f6d21a854b928332c8049d930eb59f30a6c38d9..8963ada2c580b526903d395e11c4275d36fa9d40 100644 (file)
@@ -79,7 +79,7 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, zst
                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));
@@ -137,7 +137,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;
        }
@@ -270,7 +270,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;
@@ -417,7 +417,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;
                }
@@ -441,7 +441,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;
                }
@@ -470,7 +470,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; 
                }
@@ -490,7 +490,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;
                        }
@@ -500,7 +500,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;
                        }
@@ -510,7 +510,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;
                        }
@@ -520,7 +520,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;
                        }
@@ -530,7 +530,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; 
                        }
@@ -543,7 +543,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;
                        }
@@ -553,7 +553,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;
                        }
@@ -563,7 +563,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;
                        }
@@ -665,17 +665,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) */
                                        )
                                );
 
@@ -683,24 +683,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;
                        }
@@ -870,7 +870,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 {
                                                        zstr tmp;
@@ -883,7 +884,8 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
                                                PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
                                                tmp.s = (char *)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_textl(bind->zval, tmp, TEXT_CHARS(buff_len), 1);
@@ -1086,7 +1088,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr 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;
        }
@@ -1104,7 +1106,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr 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;
                }
@@ -1126,7 +1128,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, zstr 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;
                }
@@ -1321,7 +1323,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;
        }
@@ -1342,7 +1344,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;
        }
@@ -1440,7 +1442,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, zstr name, int name
                
        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;
        }
@@ -1642,7 +1644,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;
                        }
                        
@@ -1663,7 +1666,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;
                        }
        
index 80301773b26cb7e509c675f368e2a0393515a928..9058aacb7ef209dd170979870fba4020f9e67ed5 100644 (file)
 # include "TSRM.h"
 #endif
 
+
+/* 
+ * The version of the OCI8 extension.
+ */
+#define PHP_OCI8_VERSION "1.3.1 Beta"
+
 extern zend_module_entry oci8_module_entry;
 #define phpext_oci8_ptr &oci8_module_entry
 
index ff9d8962de331bc23c02e532b2ab9cb05cb97c83..8e4157d5d8bad6e7edda128a41742fd58e820a18 100644 (file)
@@ -268,34 +268,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) \
@@ -349,9 +359,7 @@ int php_oci_descriptor_delete_from_hash(void *data, void *id TSRMLS_DC);
 
 sb4 php_oci_error (OCIError *, sword TSRMLS_DC);
 sb4 php_oci_fetch_errmsg(OCIError *, text ** TSRMLS_DC);
-#ifdef HAVE_OCI8_ATTR_STATEMENT
 int php_oci_fetch_sqltext_offset(php_oci_statement *, zstr *, ub2 * TSRMLS_DC);
-#endif
 
 void php_oci_do_connect (INTERNAL_FUNCTION_PARAMETERS, int , int);
 php_oci_connection *php_oci_do_connect_ex(zstr username, int username_len, zstr password, int password_len, zstr new_password, int new_password_len, zstr dbname, int dbname_len, zstr charset, long session_mode, int persistent, int exclusive, zend_uchar type TSRMLS_DC);
@@ -464,6 +472,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 */
 
index c7166efd84af92d2c632de61eb49d1eecb7a053c..4036da773f2fc2e892ef2b500b3308d18ecef105 100644 (file)
@@ -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);
index a49885f1e43c5956466b1cb314f89c77a2a97244..d639d5684e71c9f593b6fc284d3f8d909de23d0a 100644 (file)
@@ -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
index 03105064103a76972a9406d19d307e06a0c8874f..41bba0d83590c9b5c2f01e6933464c530ed6338d 100644 (file)
@@ -53,7 +53,7 @@
 #define PHP_ODBC_TYPE          "@ODBC_TYPE@"
 #define PHP_OCI8_SHARED_LIBADD         "@OCI8_SHARED_LIBADD@"
 #define PHP_OCI8_DIR                   "@OCI8_DIR@"
-#define PHP_OCI8_VERSION               "@OCI8_VERSION@"
+#define PHP_OCI8_ORACLE_VERSION                "@OCI8_ORACLE_VERSION@"
 #define PHP_ORACLE_SHARED_LIBADD       "@ORACLE_SHARED_LIBADD@"
 #define PHP_ORACLE_DIR                         "@ORACLE_DIR@"
 #define PHP_ORACLE_VERSION                     "@ORACLE_VERSION@"