]> granicus.if.org Git - php/commitdiff
MFH: fix PECL bug #8112 (OCI8 persistent connections misbehave when Apache process...
authorAntony Dovgal <tony2001@php.net>
Mon, 21 Aug 2006 16:41:13 +0000 (16:41 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 21 Aug 2006 16:41:13 +0000 (16:41 +0000)
NEWS
ext/oci8/oci8.c
ext/oci8/oci8_collection.c
ext/oci8/oci8_lob.c
ext/oci8/oci8_statement.c
ext/oci8/php_oci8_int.h

diff --git a/NEWS b/NEWS
index 71d7bbbaa6d58abafab7329422b301d5585ce04e..8042d8f0baa14f0b7d942e05ab35acba8922a183 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP                                                                        NEWS
 ?? Sep 2006, PHP 5.2.0
 - Fixed bug #38524 (strptime() does not initialize the internal date storage
   structure). (Ilia)
+- Fixed PECL bug #8112 (OCI8 persistent connections misbehave when Apache 
+  process times out). (Tony)
 
 17 Aug 2006, PHP 5.2.0RC2
 - Increased default memory limit to 16 megabytes to accommodate for a more
index 5204321336ebddd36fe277af77f2d5c9416ee254..b488524ae4b6de74357f6c7d378f29857a49ee96 100644 (file)
@@ -916,14 +916,14 @@ int php_oci_fetch_sqltext_offset(php_oci_statement *statement, text **sqltext, u
        *sqltext = NULL;
        *error_offset = 0;
 
-       statement->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (text *) sqltext, (ub4 *)0, OCI_ATTR_STATEMENT, statement->err));
+       PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (text *) sqltext, (ub4 *)0, OCI_ATTR_STATEMENT, statement->err));
        
        if (statement->errcode != OCI_SUCCESS) { 
                php_oci_error(statement->err, statement->errcode TSRMLS_CC);
                return 1;
        }
 
-       statement->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)error_offset, (ub4 *)0, OCI_ATTR_PARSE_ERROR_OFFSET, statement->err));
+       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);
@@ -1014,7 +1014,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
 
 #if HAVE_OCI_ENV_NLS_CREATE
        if (charset && *charset) {
-               charsetid = PHP_OCI_CALL(OCINlsCharSetNameToId, (OCI_G(env), charset));
+               PHP_OCI_CALL_RETURN(charsetid, OCINlsCharSetNameToId, (OCI_G(env), charset));
                if (!charsetid) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid character set name: %s", charset);
                } else {
@@ -1027,7 +1027,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
                size_t rsize = 0;
                sword result;
 
-               result = PHP_OCI_CALL(OCINlsEnvironmentVariableGet, (&charsetid_nls_lang, 0, OCI_NLS_CHARSET_ID, 0, &rsize))
+               PHP_OCI_CALL_RETURN(result, OCINlsEnvironmentVariableGet, (&charsetid_nls_lang, 0, OCI_NLS_CHARSET_ID, 0, &rsize))
                if (result != OCI_SUCCESS) {
                        charsetid_nls_lang = 0;
                }
@@ -1176,18 +1176,18 @@ open:
        }
 
        /* create an environment using the character set id, Oracle 9i+ ONLY */
-       OCI_G(errcode) = PHP_OCI_CALL(OCIEnvNlsCreate, (&(connection->env), PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL, connection->charset, connection->charset));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIEnvNlsCreate, (&(connection->env), PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL, connection->charset, connection->charset));
 
 #elif HAVE_OCI_ENV_CREATE
 #define PHP_OCI_INIT_FUNC_NAME "OCIEnvCreate"
        
        /* allocate env handle without NLS support */
-       OCI_G(errcode) = PHP_OCI_CALL(OCIEnvCreate, (&(connection->env), PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIEnvCreate, (&(connection->env), PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL));
 #else
 #define PHP_OCI_INIT_FUNC_NAME "OCIEnvInit"
        
        /* the simpliest way */
-       OCI_G(errcode) = PHP_OCI_CALL(OCIEnvInit, (&(connection->env), OCI_DEFAULT, 0, NULL));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIEnvInit, (&(connection->env), OCI_DEFAULT, 0, NULL));
 #endif
 
        if (OCI_G(errcode) != OCI_SUCCESS) {
@@ -1205,7 +1205,7 @@ open:
        }
        
        /* allocate our server handle {{{ */    
-       OCI_G(errcode) = PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(connection->server), OCI_HTYPE_SERVER, 0, NULL));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->server), OCI_HTYPE_SERVER, 0, NULL));
        
        if (OCI_G(errcode) != OCI_SUCCESS) {
                php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1214,7 +1214,7 @@ open:
        } /* }}} */
 
        /* attach to the server {{{ */
-       OCI_G(errcode) = PHP_OCI_CALL(OCIServerAttach, (connection->server, OCI_G(err), (text*)dbname, dbname_len, (ub4) OCI_DEFAULT));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIServerAttach, (connection->server, OCI_G(err), (text*)dbname, dbname_len, (ub4) OCI_DEFAULT));
        
        if (OCI_G(errcode) != OCI_SUCCESS) {
                php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1224,7 +1224,7 @@ open:
        connection->is_attached = 1;
 
        /* allocate our session handle {{{ */
-       OCI_G(errcode) = PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(connection->session), OCI_HTYPE_SESSION, 0, NULL));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->session), OCI_HTYPE_SESSION, 0, NULL));
        
        if (OCI_G(errcode) != OCI_SUCCESS) {
                php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1233,7 +1233,7 @@ open:
        } /* }}} */
 
        /* allocate our private error-handle {{{ */
-       OCI_G(errcode) = PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(connection->err), OCI_HTYPE_ERROR, 0, NULL));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->err), OCI_HTYPE_ERROR, 0, NULL));
 
        if (OCI_G(errcode) != OCI_SUCCESS) {
                php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1242,7 +1242,7 @@ open:
        } /* }}} */
 
        /* allocate our service-context {{{ */
-       OCI_G(errcode) = PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(connection->svc), OCI_HTYPE_SVCCTX, 0, NULL));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (connection->env, (dvoid **)&(connection->svc), OCI_HTYPE_SVCCTX, 0, NULL));
 
        if (OCI_G(errcode) != OCI_SUCCESS) {
                php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1252,7 +1252,7 @@ open:
 
        /* set the username {{{ */
        if (username) {
-               OCI_G(errcode) = PHP_OCI_CALL(OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) username, (ub4) username_len, (ub4) OCI_ATTR_USERNAME, OCI_G(err)));
+               PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) username, (ub4) username_len, (ub4) OCI_ATTR_USERNAME, OCI_G(err)));
                
                if (OCI_G(errcode) != OCI_SUCCESS) {
                        php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1263,7 +1263,7 @@ open:
 
        /* set the password {{{ */
        if (password) {
-               OCI_G(errcode) = PHP_OCI_CALL(OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) password, (ub4) password_len, (ub4) OCI_ATTR_PASSWORD, OCI_G(err)));
+               PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) password, (ub4) password_len, (ub4) OCI_ATTR_PASSWORD, OCI_G(err)));
                
                if (OCI_G(errcode) != OCI_SUCCESS) {
                        php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1273,7 +1273,7 @@ open:
        }/* }}} */
 
        /* set the server handle in the service handle {{{ */ 
-       OCI_G(errcode) = PHP_OCI_CALL(OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->server, 0, OCI_ATTR_SERVER, OCI_G(err)));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->server, 0, OCI_ATTR_SERVER, OCI_G(err)));
 
        if (OCI_G(errcode) != OCI_SUCCESS) {
                php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1282,7 +1282,7 @@ open:
        } /* }}} */
 
        /* set the authentication handle in the service handle {{{ */
-       OCI_G(errcode) = PHP_OCI_CALL(OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->session, 0, OCI_ATTR_SESSION, OCI_G(err)));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, (connection->svc, OCI_HTYPE_SVCCTX, connection->session, 0, OCI_ATTR_SESSION, OCI_G(err)));
 
        if (OCI_G(errcode) != OCI_SUCCESS) {
                php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1292,7 +1292,7 @@ open:
 
        if (new_password) {
                /* try to change password if new one was provided {{{ */
-               OCI_G(errcode) = PHP_OCI_CALL(OCIPasswordChange, (connection->svc, OCI_G(err), (text *)username, username_len, (text *)password, password_len, (text *)new_password, new_password_len, OCI_AUTH));
+               PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPasswordChange, (connection->svc, OCI_G(err), (text *)username, username_len, (text *)password, password_len, (text *)new_password, new_password_len, OCI_AUTH));
 
                if (OCI_G(errcode) != OCI_SUCCESS) {
                        php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1300,7 +1300,7 @@ open:
                        return NULL;
                }
 
-               OCI_G(errcode) = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->session), (ub4 *)0, OCI_ATTR_SESSION, OCI_G(err)));
+               PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->svc, OCI_HTYPE_SVCCTX, (dvoid *)&(connection->session), (ub4 *)0, OCI_ATTR_SESSION, OCI_G(err)));
 
                if (OCI_G(errcode) != OCI_SUCCESS) {
                        php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1313,19 +1313,19 @@ open:
                        case OCI_DEFAULT:
 #if HAVE_OCI_STMT_PREPARE2
                                /* statement caching is suported only in Oracle 9+ */
-                               OCI_G(errcode) = PHP_OCI_CALL(OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_RDBMS, (ub4) OCI_STMT_CACHE));
+                               PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_RDBMS, (ub4) OCI_STMT_CACHE));
 #else
                                /* others cannot use stmt caching, so we call OCISessionBegin() with OCI_DEFAULT */
-                               OCI_G(errcode) = PHP_OCI_CALL(OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_RDBMS, (ub4) OCI_DEFAULT));
+                               PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_RDBMS, (ub4) OCI_DEFAULT));
 #endif
                                break;
                        case OCI_SYSDBA:
                        case OCI_SYSOPER:
                        default:
                                if (username_len == 1 && username[0] == '/' && password_len == 0) {
-                                       OCI_G(errcode) = PHP_OCI_CALL(OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_EXT, (ub4) session_mode));
+                                       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_EXT, (ub4) session_mode));
                                } else {
-                                       OCI_G(errcode) = PHP_OCI_CALL(OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_RDBMS, (ub4) session_mode));
+                                       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionBegin, (connection->svc, OCI_G(err), connection->session, (ub4) OCI_CRED_RDBMS, (ub4) session_mode));
                                }
                                break;
                }
@@ -1346,7 +1346,7 @@ open:
        if (connection->is_persistent) {
                ub4 statement_cache_size = (OCI_G(statement_cache_size) > 0) ? OCI_G(statement_cache_size) : 0;
 
-               OCI_G(errcode) = PHP_OCI_CALL(OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err)));
+               PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->svc, (ub4) OCI_HTYPE_SVCCTX, (ub4 *) &statement_cache_size, 0, (ub4) OCI_ATTR_STMTCACHESIZE, OCI_G(err)));
                
                if (OCI_G(errcode) != OCI_SUCCESS) {
                        php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -1387,11 +1387,11 @@ static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC)
 {
        /* OCIPing() crashes Oracle servers older than 10.2 */
 #if 0
-       OCI_G(errcode) = PHP_OCI_CALL(OCIPing, (connection->svc, OCI_G(err), OCI_DEFAULT));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPing, (connection->svc, OCI_G(err), OCI_DEFAULT));
 #else
        char version[256];
        /* use good old OCIServerVersion() by default */
-       OCI_G(errcode) = PHP_OCI_CALL(OCIServerVersion, (connection->server, OCI_G(err), (text*)version, sizeof(version), OCI_HTYPE_SERVER));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIServerVersion, (connection->server, OCI_G(err), (text*)version, sizeof(version), OCI_HTYPE_SERVER));
 #endif
        
        if (OCI_G(errcode) == OCI_SUCCESS) {
@@ -1411,7 +1411,7 @@ static int php_oci_connection_status(php_oci_connection *connection TSRMLS_DC)
        ub4 ss = 0;
 
        /* get OCI_ATTR_SERVER_STATUS */
-       OCI_G(errcode) = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)connection->server, OCI_HTYPE_SERVER, (dvoid *)&ss, (ub4 *)0, OCI_ATTR_SERVER_STATUS, OCI_G(err)));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrGet, ((dvoid *)connection->server, OCI_HTYPE_SERVER, (dvoid *)&ss, (ub4 *)0, OCI_ATTR_SERVER_STATUS, OCI_G(err)));
        
        if (OCI_G(errcode) == OCI_SUCCESS && ss == OCI_SERVER_NORMAL) {
                return 1;
@@ -1427,7 +1427,7 @@ static int php_oci_connection_status(php_oci_connection *connection TSRMLS_DC)
  Rollback connection */
 int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC)
 {
-       connection->errcode = PHP_OCI_CALL(OCITransRollback, (connection->svc, connection->err, (ub4) 0));
+       PHP_OCI_CALL_RETURN(connection->errcode, OCITransRollback, (connection->svc, connection->err, (ub4) 0));
        connection->needs_commit = 0;
 
        if (connection->errcode != OCI_SUCCESS) {
@@ -1442,7 +1442,7 @@ int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC)
  Commit connection */
 int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC)
 {
-       connection->errcode = PHP_OCI_CALL(OCITransCommit, (connection->svc, connection->err, (ub4) 0));
+       PHP_OCI_CALL_RETURN(connection->errcode, OCITransCommit, (connection->svc, connection->err, (ub4) 0));
        connection->needs_commit = 0;
 
        if (connection->errcode != OCI_SUCCESS) {
@@ -1458,6 +1458,7 @@ int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC)
 static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC)
 {
        int result = 0;
+       zend_bool in_call_save = OCI_G(in_call);
 
        if (connection->descriptors) {
                zend_hash_destroy(connection->descriptors);
@@ -1514,6 +1515,7 @@ static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC)
                efree(connection);
        }
        connection = NULL;
+       OCI_G(in_call) = in_call_save;
        return result;
 } /* }}} */
 
@@ -1521,7 +1523,7 @@ static int php_oci_connection_close(php_oci_connection *connection TSRMLS_DC)
  Change password for the user with the username given */
 int php_oci_password_change(php_oci_connection *connection, char *user, int user_len, char *pass_old, int pass_old_len, char *pass_new, int pass_new_len TSRMLS_DC)
 {
-       connection->errcode = PHP_OCI_CALL(OCIPasswordChange, (connection->svc, connection->err, (text *)user, user_len, (text *)pass_old, pass_old_len, (text *)pass_new, pass_new_len, OCI_DEFAULT));
+       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);
@@ -1537,7 +1539,7 @@ int php_oci_server_get_version(php_oci_connection *connection, char **version TS
 {
        char version_buff[256];
 
-       connection->errcode = PHP_OCI_CALL(OCIServerVersion, (connection->svc, connection->err, (text*)version_buff, sizeof(version_buff), OCI_HTYPE_SVCCTX));
+       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);
@@ -1746,7 +1748,7 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC)
                connection = (php_oci_connection *)le->ptr;
 
                if (connection->used_this_request) {
-                       if ((PG(connection_status) & PHP_CONNECTION_TIMEOUT)) {
+                       if ((PG(connection_status) & PHP_CONNECTION_TIMEOUT) || OCI_G(in_call)) {
                                return 1;
                        }
 
index 3f01457aacad5330dce5ac2d407edac04eb64300..dbbaff618415edf44ddbd6b3361135ad737df16a 100644 (file)
@@ -57,7 +57,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
        collection->collection = NULL;
        
        /* get type handle by name */
-       connection->errcode = PHP_OCI_CALL(OCITypeByName,
+       PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByName,
                        (
                         connection->env,
                         connection->err,
@@ -79,14 +79,14 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
        }
 
        /* allocate describe handle */
-       connection->errcode = PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0));
+       PHP_OCI_CALL_RETURN(connection->errcode, OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0));
 
        if (connection->errcode) {
                goto CLEANUP;
        }
 
        /* describe TDO */
-       connection->errcode = PHP_OCI_CALL(OCIDescribeAny, 
+       PHP_OCI_CALL_RETURN(connection->errcode, OCIDescribeAny, 
                        (
                         connection->svc,
                         connection->err,
@@ -104,14 +104,14 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
        }
 
        /* get first parameter handle */
-       connection->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM,    connection->err));
+       PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM,      connection->err));
 
        if (connection->errcode) {
                goto CLEANUP;
        }
 
        /* get the collection type code of the attribute */
-       connection->errcode = PHP_OCI_CALL(OCIAttrGet, 
+       PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, 
                        (
                         (dvoid*) parmp1,
                         (ub4) OCI_DTYPE_PARAM,
@@ -130,7 +130,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
                case OCI_TYPECODE_TABLE:
                case OCI_TYPECODE_VARRAY:
                        /* get collection element handle */
-                       connection->errcode = PHP_OCI_CALL(OCIAttrGet, 
+                       PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, 
                                        (
                                         (dvoid*) parmp1,
                                         (ub4) OCI_DTYPE_PARAM,
@@ -146,7 +146,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
                        }
 
                        /* get REF of the TDO for the type */
-                       connection->errcode = PHP_OCI_CALL(OCIAttrGet, 
+                       PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, 
                                        (
                                         (dvoid*) parmp2,
                                         (ub4) OCI_DTYPE_PARAM,
@@ -162,7 +162,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
                        }
 
                        /* get the TDO (only header) */
-                       connection->errcode = PHP_OCI_CALL(OCITypeByRef, 
+                       PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByRef, 
                                        (
                                         connection->env,
                                         connection->err,
@@ -178,7 +178,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
                        }
 
                        /* get typecode */
-                       connection->errcode = PHP_OCI_CALL(OCIAttrGet, 
+                       PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, 
                                        (
                                         (dvoid*) parmp2,
                                         (ub4) OCI_DTYPE_PARAM,
@@ -200,7 +200,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection* connection, c
        }       
 
        /* Create object to hold return table */
-       connection->errcode = PHP_OCI_CALL(OCIObjectNew, 
+       PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectNew, 
                (
                        connection->env, 
                        connection->err, 
@@ -234,7 +234,7 @@ int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC)
 {
        php_oci_connection *connection = collection->connection;
        
-       connection->errcode = PHP_OCI_CALL(OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size));
+       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);
@@ -249,7 +249,7 @@ int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC)
 {
        php_oci_connection *connection = collection->connection;
        
-       *max = PHP_OCI_CALL(OCICollMax, (connection->env, collection->collection));
+       PHP_OCI_CALL_RETURN(*max, OCICollMax, (connection->env, collection->collection));
 
        /* error handling is not necessary here? */
        return 0;
@@ -261,7 +261,7 @@ int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRML
 {
        php_oci_connection *connection = collection->connection;
        
-       connection->errcode = PHP_OCI_CALL(OCICollTrim, (connection->env, connection->err, trim_size, collection->collection));
+       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);
@@ -278,7 +278,7 @@ int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC)
        php_oci_connection *connection = collection->connection;
 
        /* append NULL element */
-       connection->errcode = PHP_OCI_CALL(OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection));
+       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);
@@ -296,7 +296,7 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i
        php_oci_connection *connection = collection->connection;
 
        /* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */
-       connection->errcode = PHP_OCI_CALL(OCIDateFromText, (connection->err, date, date_len, NULL, 0, NULL, 0, &oci_date));
+       PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, date, date_len, NULL, 0, NULL, 0, &oci_date));
 
        if (connection->errcode != OCI_SUCCESS) {
                /* failed to convert string to date */
@@ -304,7 +304,7 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i
                return 1;
        }
 
-       connection->errcode = PHP_OCI_CALL(OCICollAppend, 
+       PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, 
                        (
                         connection->env,
                         connection->err,
@@ -333,14 +333,14 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe
 
        element_double = zend_strtod(number, NULL);
                        
-       connection->errcode = PHP_OCI_CALL(OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_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);
                return 1;
        }
 
-       connection->errcode = PHP_OCI_CALL(OCICollAppend, 
+       PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, 
                        (
                         connection->env,
                         connection->err,
@@ -366,14 +366,14 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme
        OCIString *ocistr = (OCIString *)0;
        php_oci_connection *connection = collection->connection;
                        
-       connection->errcode = PHP_OCI_CALL(OCIStringAssignText, (connection->env, connection->err, element, element_len, &ocistr));
+       PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, element, element_len, &ocistr));
 
        if (connection->errcode != OCI_SUCCESS) {
                php_oci_error(connection->err, connection->errcode TSRMLS_CC);
                return 1;
        }
 
-       connection->errcode = PHP_OCI_CALL(OCICollAppend, 
+       PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, 
                        (
                         connection->env,
                         connection->err,
@@ -445,7 +445,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
        MAKE_STD_ZVAL(*result_element);
        ZVAL_NULL(*result_element);
 
-       connection->errcode = PHP_OCI_CALL(OCICollGetElem, 
+       PHP_OCI_CALL_RETURN(connection->errcode, OCICollGetElem, 
                        (
                         connection->env,
                         connection->err,
@@ -476,7 +476,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
 
        switch (collection->element_typecode) {
                case OCI_TYPECODE_DATE:
-                       connection->errcode = PHP_OCI_CALL(OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff));
+                       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);
@@ -495,7 +495,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
                        OCIString *oci_string = *(OCIString **)element;
                        text *str;
                        
-                       str = (text *)PHP_OCI_CALL(OCIStringPtr, (connection->env, oci_string));
+                       PHP_OCI_CALL_RETURN(str, OCIStringPtr, (connection->env, oci_string));
                        
                        if (str) {
                                ZVAL_STRING(*result_element, str, 1);
@@ -518,7 +518,7 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z
                {
                        double double_number;
                        
-                       connection->errcode = PHP_OCI_CALL(OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number));
+                       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);
@@ -549,7 +549,7 @@ int php_oci_collection_element_set_null(php_oci_collection *collection, long ind
        php_oci_connection *connection = collection->connection;
 
        /* set NULL element */
-       connection->errcode = PHP_OCI_CALL(OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection));
+       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);
@@ -567,7 +567,7 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind
        php_oci_connection *connection = collection->connection;
 
        /* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */
-       connection->errcode = PHP_OCI_CALL(OCIDateFromText, (connection->err, date, date_len, NULL, 0, NULL, 0, &oci_date));
+       PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, date, date_len, NULL, 0, NULL, 0, &oci_date));
 
        if (connection->errcode != OCI_SUCCESS) {
                /* failed to convert string to date */
@@ -575,7 +575,7 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind
                return 1;
        }
 
-       connection->errcode = PHP_OCI_CALL(OCICollAssignElem, 
+       PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, 
                        (
                         connection->env,
                         connection->err,
@@ -605,14 +605,14 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i
 
        element_double = zend_strtod(number, NULL);
                        
-       connection->errcode = PHP_OCI_CALL(OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_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);
                return 1;
        }
 
-       connection->errcode = PHP_OCI_CALL(OCICollAssignElem, 
+       PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, 
                        (
                         connection->env,
                         connection->err,
@@ -639,14 +639,14 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i
        OCIString *ocistr = (OCIString *)0;
        php_oci_connection *connection = collection->connection;
                        
-       connection->errcode = PHP_OCI_CALL(OCIStringAssignText, (connection->env, connection->err, element, element_len, &ocistr));
+       PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, element, element_len, &ocistr));
 
        if (connection->errcode != OCI_SUCCESS) {
                php_oci_error(connection->err, connection->errcode TSRMLS_CC);
                return 1;
        }
 
-       connection->errcode = PHP_OCI_CALL(OCICollAssignElem, 
+       PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, 
                        (
                         connection->env,
                         connection->err,
@@ -711,7 +711,7 @@ int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_colle
 {
        php_oci_connection *connection = collection_dest->connection;
        
-       connection->errcode = PHP_OCI_CALL(OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection));
+       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);
@@ -727,7 +727,7 @@ void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC)
        php_oci_connection *connection = collection->connection;
 
        if (collection->collection) {
-               connection->errcode = PHP_OCI_CALL(OCIObjectFree, (connection->env, connection->err, (dvoid *)collection->collection, (ub2)OCI_OBJECTFREE_FORCE));
+               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);
index a7b1fdf890f7194fd8cb755510de1d8ba927aa35..c19b9c6ced960ff788c381f6a4c30b7fe8732c9c 100644 (file)
@@ -70,7 +70,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ
        descriptor = ecalloc(1, sizeof(php_oci_descriptor));
        descriptor->type = type;
 
-       OCI_G(errcode) = PHP_OCI_CALL(OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0));
+       PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0));
 
        if (OCI_G(errcode) != OCI_SUCCESS) {
                connection->errcode = php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC);
@@ -115,7 +115,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D
                return 0;
        } else {
                if (descriptor->type == OCI_DTYPE_FILE) {
-                       connection->errcode = PHP_OCI_CALL(OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
+                       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);
                                PHP_OCI_HANDLE_ERROR(connection, connection->errcode);
@@ -123,7 +123,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D
                        }
                }
                
-               connection->errcode = PHP_OCI_CALL(OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length));
+               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);
@@ -134,7 +134,7 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D
                descriptor->lob_size = *length;
 
                if (descriptor->type == OCI_DTYPE_FILE) {
-                       connection->errcode = PHP_OCI_CALL(OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
+                       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);
@@ -192,7 +192,7 @@ static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, l
        ub4 chunk_size;
                
        if (!descriptor->chunk_size) {
-               connection->errcode = PHP_OCI_CALL(OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size));
+               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);
@@ -261,7 +261,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
        offset = initial_offset;
 
        if (descriptor->type == OCI_DTYPE_FILE) {
-               connection->errcode = PHP_OCI_CALL(OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY));
+               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);
@@ -273,7 +273,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
        else {
                ub2 charset_id = 0;
 
-               connection->errcode = PHP_OCI_CALL(OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id));
+               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);
@@ -298,7 +298,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
        buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC);  /* use chunk size */
 
        bufp = (ub1 *) ecalloc(1, buffer_size);
-       connection->errcode = PHP_OCI_CALL(OCILobRead2,
+       PHP_OCI_CALL_RETURN(connection->errcode, OCILobRead2,
                (
                        connection->svc,
                        connection->err,
@@ -331,7 +331,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
        buffer_size = php_oci_lob_calculate_buffer(descriptor, buffer_size TSRMLS_CC);  /* use chunk size */
 
        bufp = (ub1 *) ecalloc(1, buffer_size);
-       connection->errcode = PHP_OCI_CALL(OCILobRead,
+       PHP_OCI_CALL_RETURN(connection->errcode, OCILobRead,
                (
                         connection->svc,
                         connection->err,
@@ -366,7 +366,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini
        descriptor->lob_current_position = (int)offset; 
 
        if (descriptor->type == OCI_DTYPE_FILE) {
-               connection->errcode = PHP_OCI_CALL(OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor));
+               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);
@@ -408,7 +408,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i
                offset = descriptor->lob_current_position;
        }
        
-       connection->errcode = PHP_OCI_CALL(OCILobWrite, 
+       PHP_OCI_CALL_RETURN(connection->errcode, OCILobWrite, 
                        (
                                connection->svc, 
                                connection->err, 
@@ -463,9 +463,9 @@ int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS
        }
        
        if (on_off) {
-               connection->errcode = PHP_OCI_CALL(OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor));
+               PHP_OCI_CALL_RETURN(connection->errcode, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor));
        } else {
-               connection->errcode = PHP_OCI_CALL(OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor));
+               PHP_OCI_CALL_RETURN(connection->errcode, OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor));
        }
 
        if (connection->errcode != OCI_SUCCESS) {
@@ -514,7 +514,7 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d
                return 1;
        }
 
-       connection->errcode = PHP_OCI_CALL(OCILobCopy, 
+       PHP_OCI_CALL_RETURN(connection->errcode, OCILobCopy, 
                        (
                         connection->svc,
                         connection->err,
@@ -542,7 +542,7 @@ int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
        php_oci_connection *connection = descriptor->connection;
        int is_temporary;
        
-       connection->errcode = PHP_OCI_CALL(OCILobClose, (connection->svc, connection->err, descriptor->descriptor));
+       PHP_OCI_CALL_RETURN(connection->errcode, OCILobClose, (connection->svc, connection->err, descriptor->descriptor));
 
        if (connection->errcode != OCI_SUCCESS) {
                php_oci_error(connection->err, connection->errcode TSRMLS_CC);
@@ -550,7 +550,7 @@ int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
                return 1;
        }
        
-       connection->errcode = PHP_OCI_CALL(OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary));
+       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);
@@ -560,7 +560,7 @@ int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC)
        
        if (is_temporary) {
                
-               connection->errcode = PHP_OCI_CALL(OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor));
+               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);
@@ -600,7 +600,7 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, int flush_flag TSRMLS_DC)
                return 0;
        }
 
-       connection->errcode = PHP_OCI_CALL(OCILobFlushBuffer, (connection->svc, connection->err, lob, flush_flag));
+       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);
@@ -658,7 +658,7 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC
        }
 
        while ((loblen = read(fp, &buf, sizeof(buf))) > 0) {    
-               connection->errcode = PHP_OCI_CALL(
+               PHP_OCI_CALL_RETURN(connection->errcode, 
                                OCILobWrite,
                                (
                                        connection->svc, 
@@ -710,7 +710,7 @@ int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor
                return 0;
        }
 
-       connection->errcode = PHP_OCI_CALL(OCILobAppend, (connection->svc, connection->err, lob_dest, lob_from));
+       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);
@@ -746,7 +746,7 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TS
                return 1;
        }
        
-       connection->errcode = PHP_OCI_CALL(OCILobTrim, (connection->svc, connection->err, lob, new_lob_length));
+       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);
@@ -780,7 +780,7 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, long length,
                length = lob_length;
        }
        
-       connection->errcode = PHP_OCI_CALL(OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+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);
@@ -800,7 +800,7 @@ int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descript
        OCILobLocator *first_lob   = descriptor_first->descriptor;
        OCILobLocator *second_lob  = descriptor_second->descriptor;
 
-       connection->errcode = PHP_OCI_CALL(OCILobIsEqual, (connection->env, first_lob, second_lob, result));
+       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);
@@ -834,7 +834,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data,
                return 1;
        }
 
-       connection->errcode = PHP_OCI_CALL(OCILobCreateTemporary, 
+       PHP_OCI_CALL_RETURN(connection->errcode, OCILobCreateTemporary, 
                        (
                         connection->svc,
                         connection->err,
@@ -853,7 +853,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, ub1 type, char *data,
                return 1;
        }
 
-       connection->errcode = PHP_OCI_CALL(OCILobOpen, (connection->svc, connection->err, lob, OCI_LOB_READWRITE));
+       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);
index 1348ffb8e5021e3ac0ddba6f684249e20b1eda17..c504b8db36fa1b7d788011339cc54ff57dc54ee5 100644 (file)
@@ -62,7 +62,7 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha
        
        if (query_len > 0) {
 #if HAVE_OCI_STMT_PREPARE2
-               connection->errcode = PHP_OCI_CALL(OCIStmtPrepare2, 
+               PHP_OCI_CALL_RETURN(connection->errcode, OCIStmtPrepare2, 
                                (
                                 connection->svc,
                                 &(statement->stmt),
@@ -76,7 +76,7 @@ php_oci_statement *php_oci_statement_create (php_oci_connection *connection, cha
                                )
                );
 #else
-               connection->errcode = PHP_OCI_CALL(OCIStmtPrepare, (statement->stmt, connection->err, (text *)query, query_len, OCI_NTV_SYNTAX, OCI_DEFAULT));
+               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);
@@ -129,7 +129,7 @@ int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 size TSRMLS
                return 1;
        }
        
-       statement->errcode = PHP_OCI_CALL (OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_MEMORY, statement->err));
+       PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_MEMORY, statement->err));
 
        if (statement->errcode != OCI_SUCCESS) {
                php_oci_error(statement->err, statement->errcode TSRMLS_CC);
@@ -138,7 +138,7 @@ int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 size TSRMLS
        }
 
        prefetch = size;
-       statement->errcode = PHP_OCI_CALL (OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err));
+       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);
@@ -157,7 +157,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
        int i;
        php_oci_out_column *column;
 
-       statement->errcode = PHP_OCI_CALL(OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT));
+       PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT));
 
        if ( statement->errcode == OCI_NO_DATA || nrows == 0 ) {
                if (statement->last_query == NULL) {
@@ -216,7 +216,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC)
                        }
                }
 
-               statement->errcode = PHP_OCI_CALL( OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT));
+               PHP_OCI_CALL_RETURN(statement->errcode,  OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT));
 
                for (i = 0; i < statement->ncolumns; i++) {
                        column = php_oci_statement_get_column(statement, i + 1, NULL, 0 TSRMLS_CC);
@@ -318,7 +318,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
        
        if (!statement->stmttype) {
                /* get statement type */
-               statement->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, OCI_ATTR_STMT_TYPE,     statement->err));
+               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);
@@ -342,7 +342,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                }
 
                /* execute statement */
-               statement->errcode = PHP_OCI_CALL(OCIStmtExecute, (statement->connection->svc,  statement->stmt, statement->err, iters, 0, NULL, NULL, mode));
+               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);
@@ -371,7 +371,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                counter = 1;
 
                /* get number of columns */
-               statement->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_ATTR_PARAM_COUNT, statement->err));
+               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);
@@ -393,7 +393,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                        outcol->statement = statement;
 
                        /* get column */
-                       statement->errcode = PHP_OCI_CALL(OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)&param, counter));
+                       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);
@@ -402,7 +402,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                        }
 
                        /* get column datatype */
-                       statement->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_type, (ub4 *)0, OCI_ATTR_DATA_TYPE, statement->err));
+                       PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_type, (ub4 *)0, OCI_ATTR_DATA_TYPE, statement->err));
 
                        if (statement->errcode != OCI_SUCCESS) {
                                PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
@@ -412,7 +412,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                        }
 
                        /* get character set form  */
-                       statement->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_form, (ub4 *)0, OCI_ATTR_CHARSET_FORM, statement->err));
+                       PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_form, (ub4 *)0, OCI_ATTR_CHARSET_FORM, statement->err));
 
                        if (statement->errcode != OCI_SUCCESS) {
                                PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
@@ -422,7 +422,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                        }
        
                        /* get character set id  */
-                       statement->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err));
+                       PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err));
 
                        if (statement->errcode != OCI_SUCCESS) {
                                PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
@@ -432,7 +432,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                        }
        
                        /* get size of the column */
-                       statement->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err));
+                       PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err));
                        
                        if (statement->errcode != OCI_SUCCESS) {
                                PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
@@ -445,7 +445,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                        outcol->retlen = outcol->data_size;
 
                        /* get scale of the column */
-                       statement->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err));
+                       PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err));
                        
                        if (statement->errcode != OCI_SUCCESS) {
                                PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
@@ -455,7 +455,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                        }
 
                        /* get precision of the column */
-                       statement->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err));
+                       PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err));
                        
                        if (statement->errcode != OCI_SUCCESS) {
                                PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
@@ -465,7 +465,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                        }
                        
                        /* get name of the column */
-                       statement->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err));
+                       PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err));
                        
                        if (statement->errcode != OCI_SUCCESS) {
                                PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM));
@@ -568,7 +568,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                        }
 
                        if (dynamic == OCI_DYNAMIC_FETCH) {
-                               statement->errcode = PHP_OCI_CALL(
+                               PHP_OCI_CALL_RETURN(statement->errcode, 
                                        OCIDefineByPos,
                                        (
                                                statement->stmt,                           /* IN/OUT handle to the requested SQL query */
@@ -586,7 +586,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
                                );
 
                        } else {
-                               statement->errcode = PHP_OCI_CALL(
+                               PHP_OCI_CALL_RETURN(statement->errcode, 
                                        OCIDefineByPos,
                                        (
                                                statement->stmt,                           /* IN/OUT handle to the requested SQL query */ 
@@ -742,7 +742,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
                                        memset((void*)buff,0,sizeof(buff));
                                                        
                                        if ((i < bind->array.old_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
-                                               connection->errcode = PHP_OCI_CALL(OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
+                                               PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
                                                zval_dtor(*entry);
 
                                                if (connection->errcode != OCI_SUCCESS) {
@@ -753,7 +753,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC)
                                                }
                                                zend_hash_move_forward(hash);
                                        } else {
-                                               connection->errcode = PHP_OCI_CALL(OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff));
+                                               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);
                                                        add_next_index_null(bind->zval);
@@ -908,7 +908,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
        bindp->zval = var;
        zval_add_ref(&var); 
        
-       statement->errcode = PHP_OCI_CALL(
+       PHP_OCI_CALL_RETURN(statement->errcode, 
                OCIBindByName,
                (
                        statement->stmt,                /* statement handle */
@@ -935,7 +935,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
        }
 
        if (mode == OCI_DATA_AT_EXEC) {
-               statement->errcode = PHP_OCI_CALL(OCIBindDynamic, 
+               PHP_OCI_CALL_RETURN(statement->errcode, OCIBindDynamic, 
                                (
                                 bindp->bind,
                                 statement->err,
@@ -956,7 +956,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
 #ifdef PHP_OCI8_HAVE_COLLECTIONS
        if (type == SQLT_NTY) {
                /* Bind object */
-               statement->errcode = PHP_OCI_CALL(OCIBindObject, 
+               PHP_OCI_CALL_RETURN(statement->errcode, OCIBindObject, 
                                (
                                 bindp->bind,
                                 statement->err,
@@ -1122,7 +1122,7 @@ int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC
        
        *type = 0;
        
-       statement->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err));
+       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);
@@ -1143,7 +1143,7 @@ int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSR
        
        *numrows = 0;
        
-       statement->errcode = PHP_OCI_CALL(OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, OCI_ATTR_ROW_COUNT, statement->err));
+       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);
@@ -1221,7 +1221,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam
        bindp->array.type = type;
        zval_add_ref(&var);
 
-       statement->errcode = PHP_OCI_CALL(
+       PHP_OCI_CALL_RETURN(statement->errcode, 
                                                        OCIBindByName, 
                                                        (
                                                                statement->stmt,
@@ -1413,7 +1413,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, p
                if ((i < bind->array.current_length) && (zend_hash_get_current_data(hash, (void **) &entry) != FAILURE)) {
                        
                        convert_to_string_ex(entry);
-                       connection->errcode = PHP_OCI_CALL(OCIDateFromText, (connection->err, Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date));
+                       PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date));
 
                        if (connection->errcode != OCI_SUCCESS) {
                                /* failed to convert string to date */
@@ -1427,7 +1427,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval* var, long max_table_length, p
                        ((OCIDate *)bind->array.elements)[i] = oci_date;
                        zend_hash_move_forward(hash);
                } else {
-                       connection->errcode = PHP_OCI_CALL(OCIDateFromText, (connection->err, "01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date));
+                       PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, "01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date));
 
                        if (connection->errcode != OCI_SUCCESS) {
                                /* failed to convert string to date */
index 3f12b49737cb59b027c7e9442aa3644a3f0b7482..b3b902347f39e1d5631a83641a77e7d064e626a3 100644 (file)
@@ -221,7 +221,17 @@ typedef struct { /* php_oci_out_column {{{ */
 /* {{{ macros */
 
 #define PHP_OCI_CALL(func, params) \
+       OCI_G(in_call) = 1; \
        func params; \
+       OCI_G(in_call) = 0; \
+       if (OCI_G(debug_mode)) { \
+               php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
+       }
+
+#define PHP_OCI_CALL_RETURN(__retval, func, params) \
+       OCI_G(in_call) = 1; \
+       __retval = func params; \
+       OCI_G(in_call) = 0; \
        if (OCI_G(debug_mode)) { \
                php_printf ("OCI8 DEBUG: " #func " at (%s:%d) \n", __FILE__, __LINE__); \
        }
@@ -412,6 +422,8 @@ ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ */
 
        OCIEnv *env;                            /* global environment handle */
 
+       zend_bool in_call;
+
 ZEND_END_MODULE_GLOBALS(oci) /* }}} */ 
 
 #ifdef ZTS