diff options
-rw-r--r-- | ext/oci8/oci8.c | 114 | ||||
-rw-r--r-- | ext/oci8/oci8_collection.c | 203 | ||||
-rw-r--r-- | ext/oci8/oci8_dtrace.d | 2 | ||||
-rw-r--r-- | ext/oci8/oci8_interface.c | 40 | ||||
-rw-r--r-- | ext/oci8/oci8_lob.c | 194 | ||||
-rw-r--r-- | ext/oci8/oci8_statement.c | 213 | ||||
-rw-r--r-- | ext/oci8/package.xml | 155 | ||||
-rw-r--r-- | ext/oci8/php_oci8_int.h | 8 |
8 files changed, 527 insertions, 402 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 2ff52b8eda..468bdaf610 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -1643,12 +1643,12 @@ void php_oci_connection_descriptors_free(php_oci_connection *connection TSRMLS_D * Fetch & print out error message if we get an error * Returns an Oracle error number */ -sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC) +sb4 php_oci_error(OCIError *err_p, sword errstatus TSRMLS_DC) { text *errbuf = (text *)NULL; - sb4 errcode = 0; + sb4 errcode = 0; /* Oracle error number */ - switch (status) { + switch (errstatus) { case OCI_SUCCESS: break; case OCI_SUCCESS_WITH_INFO: @@ -1691,13 +1691,13 @@ sb4 php_oci_error(OCIError *err_p, sword status TSRMLS_DC) php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCI_CONTINUE"); break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown OCI error code: %d", status); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown OCI error code: %d", errstatus); break; } #ifdef HAVE_OCI8_DTRACE if (DTRACE_OCI8_ERROR_ENABLED()) { - DTRACE_OCI8_ERROR(status, errcode); + DTRACE_OCI8_ERROR((int)errstatus, (long)errcode); } #endif /* HAVE_OCI8_DTRACE */ @@ -2210,20 +2210,24 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char */ static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC) { + sword errstatus; + + OCI_G(errcode) = 0; /* assume ping is successful */ + /* Use OCIPing instead of OCIServerVersion. If OCIPing returns ORA-1010 (invalid OCI operation) * such as from Pre-10.1 servers, the error is still from the server and we would have * successfully performed a roundtrip and validated the connection. Use OCIServerVersion for * Pre-10.2 clients */ #if ((OCI_MAJOR_VERSION > 10) || ((OCI_MAJOR_VERSION == 10) && (OCI_MINOR_VERSION >= 2))) /* OCIPing available 10.2 onwards */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIPing, (connection->svc, OCI_G(err), OCI_DEFAULT)); + PHP_OCI_CALL_RETURN(errstatus, OCIPing, (connection->svc, OCI_G(err), OCI_DEFAULT)); #else char version[256]; /* use good old OCIServerVersion() */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIServerVersion, (connection->svc, OCI_G(err), (text *)version, sizeof(version), OCI_HTYPE_SVCCTX)); + PHP_OCI_CALL_RETURN(errstatus, OCIServerVersion, (connection->svc, OCI_G(err), (text *)version, sizeof(version), OCI_HTYPE_SVCCTX)); #endif - if (OCI_G(errcode) == OCI_SUCCESS) { + if (errstatus == OCI_SUCCESS) { return 1; } else { sb4 error_code = 0; @@ -2234,10 +2238,9 @@ static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC) if (error_code == 1010) { return 1; } + OCI_G(errcode) = error_code; } - /* ignore errors here, just return failure - * php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); */ return 0; } /* }}} */ @@ -2248,17 +2251,17 @@ static int php_oci_connection_ping(php_oci_connection *connection TSRMLS_DC) */ static int php_oci_connection_status(php_oci_connection *connection TSRMLS_DC) { - ub4 ss = 0; + ub4 ss = OCI_SERVER_NOT_CONNECTED; + sword errstatus; /* get OCI_ATTR_SERVER_STATUS */ - 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))); + PHP_OCI_CALL_RETURN(errstatus, 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) { + if (errstatus == OCI_SUCCESS && ss == OCI_SERVER_NORMAL) { return 1; } - /* ignore errors here, just return failure - * php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); */ + /* ignore errors here, just return failure */ return 0; } /* }}} */ @@ -2269,14 +2272,17 @@ static int php_oci_connection_status(php_oci_connection *connection TSRMLS_DC) */ int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC) { - PHP_OCI_CALL_RETURN(connection->errcode, OCITransRollback, (connection->svc, connection->err, (ub4) 0)); + sword errstatus; + + PHP_OCI_CALL_RETURN(errstatus, OCITransRollback, (connection->svc, connection->err, (ub4) 0)); connection->rb_on_disconnect = 0; - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -2287,14 +2293,17 @@ int php_oci_connection_rollback(php_oci_connection *connection TSRMLS_DC) */ int php_oci_connection_commit(php_oci_connection *connection TSRMLS_DC) { - PHP_OCI_CALL_RETURN(connection->errcode, OCITransCommit, (connection->svc, connection->err, (ub4) 0)); + sword errstatus; + + PHP_OCI_CALL_RETURN(errstatus, OCITransCommit, (connection->svc, connection->err, (ub4) 0)); connection->rb_on_disconnect = 0; - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -2462,13 +2471,16 @@ int php_oci_connection_release(php_oci_connection *connection TSRMLS_DC) */ 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) { - 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)); + sword errstatus; + + PHP_OCI_CALL_RETURN(errstatus, 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) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ connection->passwd_changed = 1; return 0; } @@ -2503,12 +2515,13 @@ void php_oci_client_get_version(char **version TSRMLS_DC) */ int php_oci_server_get_version(php_oci_connection *connection, char **version TSRMLS_DC) { + sword errstatus; char version_buff[256]; - PHP_OCI_CALL_RETURN(connection->errcode, OCIServerVersion, (connection->svc, connection->err, (text *)version_buff, sizeof(version_buff), OCI_HTYPE_SVCCTX)); + PHP_OCI_CALL_RETURN(errstatus, OCIServerVersion, (connection->svc, connection->err, (text *)version_buff, sizeof(version_buff), OCI_HTYPE_SVCCTX)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } @@ -2806,6 +2819,7 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha zend_bool iserror = 0; ub4 poolmode = OCI_DEFAULT; /* Mode to be passed to OCISessionPoolCreate */ OCIAuthInfo *spoolAuth = NULL; + sword errstatus; /* Allocate sessionpool out of persistent memory */ session_pool = (php_oci_spool *) calloc(1, sizeof(php_oci_spool)); @@ -2830,10 +2844,10 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha } /* Allocate the pool handle */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (session_pool->env, (dvoid **) &session_pool->poolh, OCI_HTYPE_SPOOL, (size_t) 0, (dvoid **) 0)); + PHP_OCI_CALL_RETURN(errstatus, OCIHandleAlloc, (session_pool->env, (dvoid **) &session_pool->poolh, OCI_HTYPE_SPOOL, (size_t) 0, (dvoid **) 0)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); iserror = 1; goto exit_create_spool; } @@ -2842,10 +2856,10 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha * generic bug which can free up the OCI_G(err) variable before destroying connections. We * cannot use this for other roundtrip calls as there is no way the user can access this error */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, ((dvoid *) session_pool->env, (dvoid **)&(session_pool->err), (ub4) OCI_HTYPE_ERROR,(size_t) 0, (dvoid **) 0)); + PHP_OCI_CALL_RETURN(errstatus, OCIHandleAlloc, ((dvoid *) session_pool->env, (dvoid **)&(session_pool->err), (ub4) OCI_HTYPE_ERROR,(size_t) 0, (dvoid **) 0)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); iserror = 1; goto exit_create_spool; } @@ -2859,10 +2873,10 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha #if ((OCI_MAJOR_VERSION > 11) || ((OCI_MAJOR_VERSION == 11) && (OCI_MINOR_VERSION >= 2))) /* {{{ Allocate auth handle for session pool */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIHandleAlloc, (session_pool->env, (dvoid **)&(spoolAuth), OCI_HTYPE_AUTHINFO, 0, NULL)); + PHP_OCI_CALL_RETURN(errstatus, OCIHandleAlloc, (session_pool->env, (dvoid **)&(spoolAuth), OCI_HTYPE_AUTHINFO, 0, NULL)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); iserror = 1; goto exit_create_spool; } @@ -2870,10 +2884,10 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha /* {{{ Set the edition attribute on the auth handle */ if (OCI_G(edition)) { - PHP_OCI_CALL_RETURN(OCI_G(errcode),OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) OCI_G(edition), (ub4)(strlen(OCI_G(edition))), (ub4)OCI_ATTR_EDITION, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) OCI_G(edition), (ub4)(strlen(OCI_G(edition))), (ub4)OCI_ATTR_EDITION, OCI_G(err))); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); iserror = 1; goto exit_create_spool; } @@ -2881,20 +2895,20 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha /* }}} */ /* {{{ Set the driver name attribute on the auth handle */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) PHP_OCI8_DRIVER_NAME, (ub4) sizeof(PHP_OCI8_DRIVER_NAME)-1, (ub4) OCI_ATTR_DRIVER_NAME, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) spoolAuth, (ub4) OCI_HTYPE_AUTHINFO, (dvoid *) PHP_OCI8_DRIVER_NAME, (ub4) sizeof(PHP_OCI8_DRIVER_NAME)-1, (ub4) OCI_ATTR_DRIVER_NAME, OCI_G(err))); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); iserror = 1; goto exit_create_spool; } /* }}} */ /* {{{ Set the auth handle on the session pool */ - PHP_OCI_CALL_RETURN(OCI_G(errcode),OCIAttrSet, ((dvoid *) (session_pool->poolh),(ub4) OCI_HTYPE_SPOOL, (dvoid *) spoolAuth, (ub4)0, (ub4)OCI_ATTR_SPOOL_AUTH, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) (session_pool->poolh),(ub4) OCI_HTYPE_SPOOL, (dvoid *) spoolAuth, (ub4)0, (ub4)OCI_ATTR_SPOOL_AUTH, OCI_G(err))); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); iserror = 1; goto exit_create_spool; } @@ -2904,10 +2918,10 @@ static php_oci_spool *php_oci_create_spool(char *username, int username_len, cha /* Create the homogeneous session pool - We have different session pools for every different * username, password, charset and dbname. */ - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCISessionPoolCreate,(session_pool->env, OCI_G(err), session_pool->poolh, (OraText **)&session_pool->poolname, &session_pool->poolname_len, (OraText *)dbname, (ub4)dbname_len, 0, UB4MAXVAL, 1,(OraText *)username, (ub4)username_len, (OraText *)password,(ub4)password_len, poolmode)); + PHP_OCI_CALL_RETURN(errstatus, OCISessionPoolCreate,(session_pool->env, OCI_G(err), session_pool->poolh, (OraText **)&session_pool->poolname, &session_pool->poolname_len, (OraText *)dbname, (ub4)dbname_len, 0, UB4MAXVAL, 1,(OraText *)username, (ub4)username_len, (OraText *)password,(ub4)password_len, poolmode)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); iserror = 1; } @@ -3477,11 +3491,11 @@ static sword php_oci_ping_init(php_oci_connection *connection, OCIError *errh TS * * DTrace output for connections that may have become invalid and marked for reopening */ -void php_oci_dtrace_check_connection(php_oci_connection *connection, sword errcode, ub4 serverStatus) +void php_oci_dtrace_check_connection(php_oci_connection *connection, sb4 errcode, ub4 serverStatus) { #ifdef HAVE_OCI8_DTRACE if (DTRACE_OCI8_CHECK_CONNECTION_ENABLED()) { - DTRACE_OCI8_CHECK_CONNECTION(connection, connection && connection->is_open ? 1 : 0, (int)errcode, (unsigned long)serverStatus); + DTRACE_OCI8_CHECK_CONNECTION(connection, connection && connection->is_open ? 1 : 0, (long)errcode, (unsigned long)serverStatus); } #endif /* HAVE_OCI8_DTRACE */ } diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c index ae93614354..320e90a5b8 100644 --- a/ext/oci8/oci8_collection.c +++ b/ext/oci8/oci8_collection.c @@ -44,12 +44,13 @@ /* {{{ php_oci_collection_create() Create and return connection handle */ -php_oci_collection * php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC) +php_oci_collection *php_oci_collection_create(php_oci_connection *connection, char *tdo, int tdo_len, char *schema, int schema_len TSRMLS_DC) { dvoid *dschp1 = NULL; dvoid *parmp1; dvoid *parmp2; php_oci_collection *collection; + sword errstatus; collection = emalloc(sizeof(php_oci_collection)); @@ -58,7 +59,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c zend_list_addref(collection->connection->id); /* get type handle by name */ - PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByName, + PHP_OCI_CALL_RETURN(errstatus, OCITypeByName, ( connection->env, connection->err, @@ -75,19 +76,19 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* allocate describe handle */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0)); + PHP_OCI_CALL_RETURN(errstatus, OCIHandleAlloc, (connection->env, (dvoid **) &dschp1, (ub4) OCI_HTYPE_DESCRIBE, (size_t) 0, (dvoid **) 0)); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* describe TDO */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIDescribeAny, + PHP_OCI_CALL_RETURN(errstatus, OCIDescribeAny, ( connection->svc, connection->err, @@ -100,19 +101,19 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* get first parameter handle */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM, connection->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *) dschp1, (ub4) OCI_HTYPE_DESCRIBE, (dvoid *)&parmp1, (ub4 *)0, (ub4)OCI_ATTR_PARAM, connection->err)); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* get the collection type code of the attribute */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ( (dvoid*) parmp1, (ub4) OCI_DTYPE_PARAM, @@ -123,7 +124,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } @@ -131,7 +132,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 */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ( (dvoid*) parmp1, (ub4) OCI_DTYPE_PARAM, @@ -142,12 +143,12 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* get REF of the TDO for the type */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ( (dvoid*) parmp2, (ub4) OCI_DTYPE_PARAM, @@ -158,12 +159,12 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* get the TDO (only header) */ - PHP_OCI_CALL_RETURN(connection->errcode, OCITypeByRef, + PHP_OCI_CALL_RETURN(errstatus, OCITypeByRef, ( connection->env, connection->err, @@ -174,12 +175,12 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* get typecode */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIAttrGet, + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ( (dvoid*) parmp2, (ub4) OCI_DTYPE_PARAM, @@ -190,7 +191,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } break; @@ -201,7 +202,7 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c } /* Create object to hold return table */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectNew, + PHP_OCI_CALL_RETURN(errstatus, OCIObjectNew, ( connection->env, connection->err, @@ -215,13 +216,14 @@ php_oci_collection * php_oci_collection_create(php_oci_connection *connection, c ) ); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { goto CLEANUP; } /* free the describe handle (Bug #44113) */ PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE)); PHP_OCI_REGISTER_RESOURCE(collection, le_collection); + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return collection; CLEANUP: @@ -230,7 +232,7 @@ CLEANUP: /* free the describe handle (Bug #44113) */ PHP_OCI_CALL(OCIHandleFree, ((dvoid *) dschp1, OCI_HTYPE_DESCRIBE)); } - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); php_oci_collection_close(collection TSRMLS_CC); return NULL; @@ -242,14 +244,16 @@ CLEANUP: int php_oci_collection_size(php_oci_collection *collection, sb4 *size TSRMLS_DC) { php_oci_connection *connection = collection->connection; + sword errstatus; - PHP_OCI_CALL_RETURN(connection->errcode, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size)); + PHP_OCI_CALL_RETURN(errstatus, OCICollSize, (connection->env, connection->err, collection->collection, (sb4 *)size)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -272,14 +276,16 @@ int php_oci_collection_max(php_oci_collection *collection, long *max TSRMLS_DC) int php_oci_collection_trim(php_oci_collection *collection, long trim_size TSRMLS_DC) { php_oci_connection *connection = collection->connection; - - PHP_OCI_CALL_RETURN(connection->errcode, OCICollTrim, (connection->env, connection->err, trim_size, collection->collection)); + sword errstatus; + + PHP_OCI_CALL_RETURN(errstatus, OCICollTrim, (connection->env, connection->err, trim_size, collection->collection)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + errstatus = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -290,15 +296,17 @@ int php_oci_collection_append_null(php_oci_collection *collection TSRMLS_DC) { OCIInd null_index = OCI_IND_NULL; php_oci_connection *connection = collection->connection; + sword errstatus; /* append NULL element */ - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection)); + PHP_OCI_CALL_RETURN(errstatus, OCICollAppend, (connection->env, connection->err, (dvoid *)0, &null_index, collection->collection)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + errstatus = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -310,18 +318,19 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i OCIInd new_index = OCI_IND_NOTNULL; OCIDate oci_date; php_oci_connection *connection = collection->connection; + sword errstatus; /* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date)); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { /* failed to convert string to date */ - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, + PHP_OCI_CALL_RETURN(errstatus, OCICollAppend, ( connection->env, connection->err, @@ -331,12 +340,13 @@ int php_oci_collection_append_date(php_oci_collection *collection, char *date, i ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -349,6 +359,7 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe double element_double; OCINumber oci_number; php_oci_connection *connection = collection->connection; + sword errstatus; #if (PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION < 10) /* minimum PHP version ext/oci8/config.m4 accepts is 4.3.9 */ @@ -358,15 +369,15 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe element_double = zend_strtod(number, NULL); #endif - PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); + PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, + PHP_OCI_CALL_RETURN(errstatus, OCICollAppend, ( connection->env, connection->err, @@ -376,12 +387,13 @@ int php_oci_collection_append_number(php_oci_collection *collection, char *numbe ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -393,16 +405,17 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme OCIInd new_index = OCI_IND_NOTNULL; OCIString *ocistr = (OCIString *)0; php_oci_connection *connection = collection->connection; + sword errstatus; - PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr)); + PHP_OCI_CALL_RETURN(errstatus, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAppend, + PHP_OCI_CALL_RETURN(errstatus, OCICollAppend, ( connection->env, connection->err, @@ -412,12 +425,13 @@ int php_oci_collection_append_string(php_oci_collection *collection, char *eleme ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -473,11 +487,14 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z boolean exists; oratext buff[1024]; ub4 buff_len = 1024; + sword errstatus; MAKE_STD_ZVAL(*result_element); ZVAL_NULL(*result_element); - PHP_OCI_CALL_RETURN(connection->errcode, OCICollGetElem, + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ + + PHP_OCI_CALL_RETURN(errstatus, OCICollGetElem, ( connection->env, connection->err, @@ -489,8 +506,8 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); FREE_ZVAL(*result_element); return 1; @@ -509,10 +526,10 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z switch (collection->element_typecode) { case OCI_TYPECODE_DATE: - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, element, 0, 0, 0, 0, &buff_len, buff)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); FREE_ZVAL(*result_element); return 1; @@ -552,10 +569,10 @@ int php_oci_collection_element_get(php_oci_collection *collection, long index, z { double double_number; - PHP_OCI_CALL_RETURN(connection->errcode, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number)); + PHP_OCI_CALL_RETURN(errstatus, OCINumberToReal, (connection->err, (CONST OCINumber *) element, (uword) sizeof(double), (dvoid *) &double_number)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); FREE_ZVAL(*result_element); return 1; @@ -583,15 +600,17 @@ int php_oci_collection_element_set_null(php_oci_collection *collection, long ind { OCIInd null_index = OCI_IND_NULL; php_oci_connection *connection = collection->connection; + sword errstatus; /* set NULL element */ - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection)); + PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem, (connection->env, connection->err, (ub4) index, (dvoid *)"", &null_index, collection->collection)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -603,18 +622,19 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind OCIInd new_index = OCI_IND_NOTNULL; OCIDate oci_date; php_oci_connection *connection = collection->connection; + sword errstatus; /* format and language are NULLs, so format is "DD-MON-YY" and language is the default language of the session */ - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)date, date_len, NULL, 0, NULL, 0, &oci_date)); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { /* failed to convert string to date */ - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, + PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem, ( connection->env, connection->err, @@ -625,12 +645,13 @@ int php_oci_collection_element_set_date(php_oci_collection *collection, long ind ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -643,6 +664,7 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i double element_double; OCINumber oci_number; php_oci_connection *connection = collection->connection; + sword errstatus; #if (PHP_MAJOR_VERSION == 4 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION < 10) /* minimum PHP version ext/oci8/config.m4 accepts is 4.3.9 */ @@ -652,15 +674,15 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i element_double = zend_strtod(number, NULL); #endif - PHP_OCI_CALL_RETURN(connection->errcode, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); + PHP_OCI_CALL_RETURN(errstatus, OCINumberFromReal, (connection->err, &element_double, sizeof(double), &oci_number)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, + PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem, ( connection->env, connection->err, @@ -671,12 +693,13 @@ int php_oci_collection_element_set_number(php_oci_collection *collection, long i ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -688,16 +711,17 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i OCIInd new_index = OCI_IND_NOTNULL; OCIString *ocistr = (OCIString *)0; php_oci_connection *connection = collection->connection; + sword errstatus; - PHP_OCI_CALL_RETURN(connection->errcode, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr)); + PHP_OCI_CALL_RETURN(errstatus, OCIStringAssignText, (connection->env, connection->err, (CONST oratext *)element, element_len, &ocistr)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssignElem, + PHP_OCI_CALL_RETURN(errstatus, OCICollAssignElem, ( connection->env, connection->err, @@ -708,12 +732,13 @@ int php_oci_collection_element_set_string(php_oci_collection *collection, long i ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -764,14 +789,16 @@ int php_oci_collection_element_set(php_oci_collection *collection, long index, c int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_collection *collection_from TSRMLS_DC) { php_oci_connection *connection = collection_dest->connection; + sword errstatus; - PHP_OCI_CALL_RETURN(connection->errcode, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection)); + PHP_OCI_CALL_RETURN(errstatus, OCICollAssign, (connection->env, connection->err, collection_from->collection, collection_dest->collection)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -781,18 +808,20 @@ int php_oci_collection_assign(php_oci_collection *collection_dest, php_oci_colle void php_oci_collection_close(php_oci_collection *collection TSRMLS_DC) { php_oci_connection *connection = collection->connection; + sword errstatus; if (collection->collection) { - PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectFree, (connection->env, connection->err, (dvoid *)collection->collection, (ub2)OCI_OBJECTFREE_FORCE)); + PHP_OCI_CALL_RETURN(errstatus, OCIObjectFree, (connection->env, connection->err, (dvoid *)collection->collection, (ub2)OCI_OBJECTFREE_FORCE)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); + } else { + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } } zend_list_delete(collection->connection->id); - efree(collection); return; } diff --git a/ext/oci8/oci8_dtrace.d b/ext/oci8/oci8_dtrace.d index d6982f030c..15b4a96263 100644 --- a/ext/oci8/oci8_dtrace.d +++ b/ext/oci8/oci8_dtrace.d @@ -19,7 +19,7 @@ provider php { probe oci8__connect__entry(char *username, char *dbname, char *charset, long session_mode, int persistent, int exclusive); probe oci8__connect__return(void *connection); - probe oci8__check__connection(void *connection, int is_open, int errcode, unsigned long serverstatus); + probe oci8__check__connection(void *connection, int is_open, long errcode, unsigned long serverstatus); probe oci8__sqltext(char *sql); probe oci8__error(int status, long errcode); probe oci8__execute__mode(unsigned int mode); diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index aee876d736..6042ca5a73 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -1624,7 +1624,6 @@ PHP_FUNCTION(oci_error) php_oci_connection *connection; text *errbuf; sb4 errcode = 0; - sword error = OCI_SUCCESS; dvoid *errh = NULL; ub2 error_offset = 0; text *sqltext = NULL; @@ -1635,10 +1634,9 @@ PHP_FUNCTION(oci_error) if (ZEND_NUM_ARGS() > 0) { statement = (php_oci_statement *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_statement); - if (statement) { errh = statement->err; - error = statement->errcode; + errcode = statement->errcode; if (php_oci_fetch_sqltext_offset(statement, &sqltext, &error_offset TSRMLS_CC)) { RETURN_FALSE; @@ -1649,23 +1647,23 @@ PHP_FUNCTION(oci_error) connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_connection); if (connection) { errh = connection->err; - error = connection->errcode; + errcode = connection->errcode; goto go_out; } connection = (php_oci_connection *) zend_fetch_resource(&arg TSRMLS_CC, -1, NULL, NULL, 1, le_pconnection); if (connection) { errh = connection->err; - error = connection->errcode; + errcode = connection->errcode; goto go_out; } } else { errh = OCI_G(err); - error = OCI_G(errcode); + errcode = OCI_G(errcode); } go_out: - if (error == OCI_SUCCESS) { /* no error set in the handle */ + if (errcode == 0) { /* no error set in the handle */ RETURN_FALSE; } @@ -1764,6 +1762,7 @@ PHP_FUNCTION(oci_set_client_identifier) php_oci_connection *connection; char *client_id; int client_id_len; + sword errstatus; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_id, &client_id_len) == FAILURE) { return; @@ -1771,10 +1770,10 @@ PHP_FUNCTION(oci_set_client_identifier) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_id, (ub4) client_id_len, (ub4) OCI_ATTR_CLIENT_IDENTIFIER, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_id, (ub4) client_id_len, (ub4) OCI_ATTR_CLIENT_IDENTIFIER, connection->err)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); RETURN_FALSE; } @@ -1822,6 +1821,7 @@ PHP_FUNCTION(oci_set_module_name) php_oci_connection *connection; char *module; int module_len; + sword errstatus; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &module, &module_len) == FAILURE) { return; @@ -1829,10 +1829,10 @@ PHP_FUNCTION(oci_set_module_name) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) module, (ub4) module_len, (ub4) OCI_ATTR_MODULE, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) module, (ub4) module_len, (ub4) OCI_ATTR_MODULE, connection->err)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); RETURN_FALSE; } @@ -1853,6 +1853,7 @@ PHP_FUNCTION(oci_set_action) php_oci_connection *connection; char *action; int action_len; + sword errstatus; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &action, &action_len) == FAILURE) { return; @@ -1860,10 +1861,10 @@ PHP_FUNCTION(oci_set_action) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) action, (ub4) action_len, (ub4) OCI_ATTR_ACTION, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) action, (ub4) action_len, (ub4) OCI_ATTR_ACTION, connection->err)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); RETURN_FALSE; } @@ -1884,6 +1885,7 @@ PHP_FUNCTION(oci_set_client_info) php_oci_connection *connection; char *client_info; int client_info_len; + sword errstatus; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_connection, &client_info, &client_info_len) == FAILURE) { return; @@ -1891,10 +1893,10 @@ PHP_FUNCTION(oci_set_client_info) PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection); - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_info, (ub4) client_info_len, (ub4) OCI_ATTR_CLIENT_INFO, OCI_G(err))); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, ((dvoid *) connection->session, (ub4) OCI_HTYPE_SESSION, (dvoid *) client_info, (ub4) client_info_len, (ub4) OCI_ATTR_CLIENT_INFO, connection->err)); - if (OCI_G(errcode) != OCI_SUCCESS) { - php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); RETURN_FALSE; } diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c index 87ce84843f..8d14dc3f50 100644 --- a/ext/oci8/oci8_lob.c +++ b/ext/oci8/oci8_lob.c @@ -54,6 +54,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long type TSRMLS_DC) { php_oci_descriptor *descriptor; + sword errstatus; switch (type) { case OCI_DTYPE_FILE: @@ -72,13 +73,15 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ descriptor->connection = connection; zend_list_addref(descriptor->connection->id); - PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0)); + PHP_OCI_CALL_RETURN(errstatus, OCIDescriptorAlloc, (connection->env, (dvoid*)&(descriptor->descriptor), descriptor->type, (size_t) 0, (dvoid **) 0)); - if (OCI_G(errcode) != OCI_SUCCESS) { - OCI_G(errcode) = php_oci_error(OCI_G(err), OCI_G(errcode) TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + OCI_G(errcode) = php_oci_error(OCI_G(err), errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, OCI_G(errcode)); efree(descriptor); return NULL; + } else { + OCI_G(errcode) = 0; /* retain backwards compat with OCI8 1.4 */ } PHP_OCI_REGISTER_RESOURCE(descriptor, le_descriptor); @@ -117,6 +120,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, long typ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; + sword errstatus; *length = 0; @@ -125,18 +129,18 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D return 0; } else { 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) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + PHP_OCI_CALL_RETURN(errstatus, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY)); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } } - PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length)); + PHP_OCI_CALL_RETURN(errstatus, OCILobGetLength, (connection->svc, connection->err, descriptor->descriptor, (ub4 *)length)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } @@ -144,14 +148,16 @@ int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_D descriptor->lob_size = *length; if (descriptor->type == OCI_DTYPE_FILE) { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(errstatus, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } } + + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } return 0; } @@ -211,20 +217,22 @@ static inline int php_oci_lob_calculate_buffer(php_oci_descriptor *descriptor, l { php_oci_connection *connection = descriptor->connection; ub4 chunk_size; + sword errstatus; if (descriptor->type == OCI_DTYPE_FILE) { return read_length; } if (!descriptor->chunk_size) { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size)); + PHP_OCI_CALL_RETURN(errstatus, OCILobGetChunkSize, (connection->svc, connection->err, descriptor->descriptor, &chunk_size)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return read_length; /* we have to return original length here */ } descriptor->chunk_size = chunk_size; + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } if ((read_length % descriptor->chunk_size) != 0) { @@ -253,6 +261,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini #endif int is_clob = 0; sb4 bytes_per_char = 1; + sword errstatus; *data_len = 0; *data = NULL; @@ -289,20 +298,20 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini offset = initial_offset; if (descriptor->type == OCI_DTYPE_FILE) { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY)); + PHP_OCI_CALL_RETURN(errstatus, OCILobFileOpen, (connection->svc, connection->err, descriptor->descriptor, OCI_FILE_READONLY)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } } else { ub2 charset_id = 0; - PHP_OCI_CALL_RETURN(connection->errcode, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id)); + PHP_OCI_CALL_RETURN(errstatus, OCILobCharSetId, (connection->env, connection->err, descriptor->descriptor, &charset_id)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } @@ -313,10 +322,10 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini } if (is_clob) { - PHP_OCI_CALL_RETURN(connection->errcode, OCINlsNumericInfoGet, (connection->env, connection->err, &bytes_per_char, OCI_NLS_CHARSET_MAXBYTESZ)); + PHP_OCI_CALL_RETURN(errstatus, OCINlsNumericInfoGet, (connection->env, connection->err, &bytes_per_char, OCI_NLS_CHARSET_MAXBYTESZ)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } @@ -340,7 +349,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); - PHP_OCI_CALL_RETURN(connection->errcode, OCILobRead2, + PHP_OCI_CALL_RETURN(errstatus, OCILobRead2, ( connection->svc, connection->err, @@ -373,7 +382,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); - PHP_OCI_CALL_RETURN(connection->errcode, OCILobRead, + PHP_OCI_CALL_RETURN(errstatus, OCILobRead, ( connection->svc, connection->err, @@ -394,8 +403,8 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini #endif - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); if (*data) { efree(*data); @@ -408,10 +417,10 @@ 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) { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(errstatus, OCILobFileClose, (connection->svc, connection->err, descriptor->descriptor)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); if (*data) { efree(*data); @@ -422,6 +431,7 @@ int php_oci_lob_read (php_oci_descriptor *descriptor, long read_length, long ini } } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -433,6 +443,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i OCILobLocator *lob = (OCILobLocator *) descriptor->descriptor; php_oci_connection *connection = (php_oci_connection *) descriptor->connection; ub4 lob_length; + sword errstatus; *bytes_written = 0; if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) { @@ -451,7 +462,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i offset = descriptor->lob_current_position; } - PHP_OCI_CALL_RETURN(connection->errcode, OCILobWrite, + PHP_OCI_CALL_RETURN(errstatus, OCILobWrite, ( connection->svc, connection->err, @@ -468,8 +479,8 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i ) ); - if (connection->errcode) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); *bytes_written = 0; return 1; @@ -486,6 +497,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i descriptor->buffering = PHP_OCI_LOB_BUFFER_USED; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -495,6 +507,7 @@ int php_oci_lob_write (php_oci_descriptor *descriptor, ub4 offset, char *data, i int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; + sword errstatus; if (!on_off && descriptor->buffering == PHP_OCI_LOB_BUFFER_DISABLED) { /* disabling when it's already off */ @@ -507,17 +520,18 @@ int php_oci_lob_set_buffering (php_oci_descriptor *descriptor, int on_off TSRMLS } if (on_off) { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(errstatus, OCILobEnableBuffering, (connection->svc, connection->err, descriptor->descriptor)); } else { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(errstatus, OCILobDisableBuffering, (connection->svc, connection->err, descriptor->descriptor)); } - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } descriptor->buffering = on_off ? PHP_OCI_LOB_BUFFER_ENABLED : PHP_OCI_LOB_BUFFER_DISABLED; + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -540,6 +554,7 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d { php_oci_connection *connection = descriptor_dest->connection; ub4 length_dest, length_from, copy_len; + sword errstatus; if (php_oci_lob_get_length(descriptor_dest, &length_dest TSRMLS_CC)) { return 1; @@ -560,7 +575,7 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d return 1; } - PHP_OCI_CALL_RETURN(connection->errcode, OCILobCopy, + PHP_OCI_CALL_RETURN(errstatus, OCILobCopy, ( connection->svc, connection->err, @@ -572,12 +587,13 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -587,15 +603,17 @@ int php_oci_lob_copy (php_oci_descriptor *descriptor_dest, php_oci_descriptor *d int php_oci_lob_close (php_oci_descriptor *descriptor TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; - + sword errstatus; + if (descriptor->is_open) { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobClose, (connection->svc, connection->err, descriptor->descriptor)); - } + PHP_OCI_CALL_RETURN(errstatus, OCILobClose, (connection->svc, connection->err, descriptor->descriptor)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); - PHP_OCI_HANDLE_ERROR(connection, connection->errcode); - return 1; + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); + PHP_OCI_HANDLE_ERROR(connection, connection->errcode); + return 1; + } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } if (php_oci_temp_lob_close(descriptor TSRMLS_CC)) { @@ -612,24 +630,26 @@ int php_oci_temp_lob_close (php_oci_descriptor *descriptor TSRMLS_DC) { php_oci_connection *connection = descriptor->connection; int is_temporary; + sword errstatus; - PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary)); + PHP_OCI_CALL_RETURN(errstatus, OCILobIsTemporary, (connection->env,connection->err, descriptor->descriptor, &is_temporary)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } if (is_temporary) { - PHP_OCI_CALL_RETURN(connection->errcode, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor)); + PHP_OCI_CALL_RETURN(errstatus, OCILobFreeTemporary, (connection->svc, connection->err, descriptor->descriptor)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -640,7 +660,8 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC) { OCILobLocator *lob = descriptor->descriptor; php_oci_connection *connection = descriptor->connection; - + sword errstatus; + if (!lob) { return 1; } @@ -663,16 +684,17 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, long flush_flag TSRMLS_DC) return 0; } - PHP_OCI_CALL_RETURN(connection->errcode, OCILobFlushBuffer, (connection->svc, connection->err, lob, flush_flag)); + PHP_OCI_CALL_RETURN(errstatus, OCILobFlushBuffer, (connection->svc, connection->err, lob, flush_flag)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } /* marking buffer as enabled and not used */ descriptor->buffering = PHP_OCI_LOB_BUFFER_ENABLED; + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -734,6 +756,7 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC php_oci_connection *connection = descriptor->connection; char buf[8192]; ub4 offset = 1; + sword errstatus; #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3) || (PHP_MAJOR_VERSION > 5) /* Safe mode has been removed in PHP 5.4 */ @@ -750,7 +773,7 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC } while ((loblen = read(fp, &buf, sizeof(buf))) > 0) { - PHP_OCI_CALL_RETURN(connection->errcode, + PHP_OCI_CALL_RETURN(errstatus, OCILobWrite, ( connection->svc, @@ -768,11 +791,13 @@ int php_oci_lob_import (php_oci_descriptor *descriptor, char *filename TSRMLS_DC ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); close(fp); return 1; + } else { + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } offset += loblen; } @@ -790,6 +815,7 @@ int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor OCILobLocator *lob_dest = descriptor_dest->descriptor; OCILobLocator *lob_from = descriptor_from->descriptor; ub4 dest_len, from_len; + sword errstatus; if (php_oci_lob_get_length(descriptor_dest, &dest_len TSRMLS_CC)) { return 1; @@ -803,13 +829,14 @@ int php_oci_lob_append (php_oci_descriptor *descriptor_dest, php_oci_descriptor return 0; } - PHP_OCI_CALL_RETURN(connection->errcode, OCILobAppend, (connection->svc, connection->err, lob_dest, lob_from)); + PHP_OCI_CALL_RETURN(errstatus, OCILobAppend, (connection->svc, connection->err, lob_dest, lob_from)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -821,6 +848,7 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TS php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; ub4 lob_length; + sword errstatus; if (php_oci_lob_get_length(descriptor, &lob_length TSRMLS_CC)) { return 1; @@ -840,15 +868,17 @@ int php_oci_lob_truncate (php_oci_descriptor *descriptor, long new_lob_length TS return 1; } - PHP_OCI_CALL_RETURN(connection->errcode, OCILobTrim, (connection->svc, connection->err, lob, new_lob_length)); + PHP_OCI_CALL_RETURN(errstatus, OCILobTrim, (connection->svc, connection->err, lob, new_lob_length)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } descriptor->lob_size = new_lob_length; + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ + return 0; } /* }}} */ @@ -860,6 +890,7 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length, php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; ub4 lob_length; + sword errstatus; *bytes_erased = 0; @@ -875,15 +906,16 @@ int php_oci_lob_erase (php_oci_descriptor *descriptor, long offset, ub4 length, length = lob_length; } - PHP_OCI_CALL_RETURN(connection->errcode, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+1)); + PHP_OCI_CALL_RETURN(errstatus, OCILobErase, (connection->svc, connection->err, lob, (ub4 *)&length, offset+1)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } *bytes_erased = length; + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -895,14 +927,16 @@ int php_oci_lob_is_equal (php_oci_descriptor *descriptor_first, php_oci_descript php_oci_connection *connection = descriptor_first->connection; OCILobLocator *first_lob = descriptor_first->descriptor; OCILobLocator *second_lob = descriptor_second->descriptor; + sword errstatus; - PHP_OCI_CALL_RETURN(connection->errcode, OCILobIsEqual, (connection->env, first_lob, second_lob, result)); + PHP_OCI_CALL_RETURN(errstatus, OCILobIsEqual, (connection->env, first_lob, second_lob, result)); - if (connection->errcode) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -914,6 +948,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data php_oci_connection *connection = descriptor->connection; OCILobLocator *lob = descriptor->descriptor; ub4 bytes_written = 0; + sword errstatus; switch (type) { case OCI_TEMP_BLOB: @@ -930,7 +965,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data return 1; } - PHP_OCI_CALL_RETURN(connection->errcode, OCILobCreateTemporary, + PHP_OCI_CALL_RETURN(errstatus, OCILobCreateTemporary, ( connection->svc, connection->err, @@ -943,21 +978,22 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, long type, char *data ) ); - if (connection->errcode) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } - PHP_OCI_CALL_RETURN(connection->errcode, OCILobOpen, (connection->svc, connection->err, lob, OCI_LOB_READWRITE)); + PHP_OCI_CALL_RETURN(errstatus, OCILobOpen, (connection->svc, connection->err, lob, OCI_LOB_READWRITE)); - if (connection->errcode) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return 1; } descriptor->is_open = 1; + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return php_oci_lob_write(descriptor, 0, data, data_len, &bytes_written TSRMLS_CC); } diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index 2e6fdabee3..b2fa8ca881 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -46,7 +46,10 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char *query, int query_len TSRMLS_DC) { php_oci_statement *statement; - + sword errstatus; + + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ + statement = ecalloc(1,sizeof(php_oci_statement)); if (!query_len) { @@ -63,7 +66,7 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char PHP_OCI_CALL(OCIHandleAlloc, (connection->env, (dvoid **)&(statement->err), OCI_HTYPE_ERROR, 0, NULL)); if (query_len > 0) { - PHP_OCI_CALL_RETURN(connection->errcode, OCIStmtPrepare2, + PHP_OCI_CALL_RETURN(errstatus, OCIStmtPrepare2, ( connection->svc, &(statement->stmt), @@ -76,14 +79,13 @@ php_oci_statement *php_oci_statement_create(php_oci_connection *connection, char OCI_DEFAULT ) ); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); - PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, statement->errcode ? OCI_STRLS_CACHE_DELETE : OCI_DEFAULT)); + PHP_OCI_CALL(OCIStmtRelease, (statement->stmt, statement->err, NULL, 0, OCI_STRLS_CACHE_DELETE)); PHP_OCI_CALL(OCIHandleFree,(statement->err, OCI_HTYPE_ERROR)); - - efree(statement); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); + efree(statement); return NULL; } } @@ -131,9 +133,10 @@ php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement T void *result; ub4 rtype; php_oci_statement *statement2; /* implicit result set statement handle */ + sword errstatus; - PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtGetNextResult, (statement->stmt, statement->err, &result, &rtype, OCI_DEFAULT)); - if (statement->errcode == OCI_NO_DATA) { + PHP_OCI_CALL_RETURN(errstatus, OCIStmtGetNextResult, (statement->stmt, statement->err, &result, &rtype, OCI_DEFAULT)); + if (errstatus == OCI_NO_DATA) { return NULL; } @@ -182,19 +185,22 @@ php_oci_statement *php_oci_get_implicit_resultset(php_oci_statement *statement T Set prefetch buffer size for the statement */ int php_oci_statement_set_prefetch(php_oci_statement *statement, ub4 prefetch TSRMLS_DC) { + sword errstatus; + if (prefetch > 20000) { prefetch = 20000; /* keep it somewhat sane */ } - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrSet, (statement->stmt, OCI_HTYPE_STMT, &prefetch, 0, OCI_ATTR_PREFETCH_ROWS, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); statement->prefetch_count = 0; return 1; } statement->prefetch_count = prefetch; + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -242,16 +248,18 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) ub4 typep, iterp, idxp; ub1 in_outp, piecep; zend_bool piecewisecols = 0; - php_oci_out_column *column; + sword errstatus; + + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ if (statement->has_descr && statement->columns) { zend_hash_apply(statement->columns, (apply_func_t) php_oci_cleanup_pre_fetch TSRMLS_CC); } - PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT)); + PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT)); - if ( statement->errcode == OCI_NO_DATA || nrows == 0 ) { + if (errstatus == OCI_NO_DATA || nrows == 0) { if (statement->last_query == NULL) { /* reset define-list for refcursors */ if (statement->columns) { @@ -263,7 +271,6 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) statement->executed = 0; } - statement->errcode = 0; /* OCI_NO_DATA is NO error for us!!! */ statement->has_data = 0; if (nrows == 0) { @@ -282,9 +289,9 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) } } - while (statement->errcode == OCI_NEED_DATA) { + while (errstatus == OCI_NEED_DATA) { if (piecewisecols) { - PHP_OCI_CALL_RETURN(statement->errcode, + PHP_OCI_CALL_RETURN(errstatus, OCIStmtGetPieceInfo, ( statement->stmt, @@ -326,7 +333,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) } } - PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT)); + PHP_OCI_CALL_RETURN(errstatus, OCIStmtFetch, (statement->stmt, statement->err, nrows, OCI_FETCH_NEXT, OCI_DEFAULT)); if (piecewisecols) { for (i = 0; i < statement->ncolumns; i++) { @@ -338,7 +345,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) } } - if (statement->errcode == OCI_SUCCESS_WITH_INFO || statement->errcode == OCI_SUCCESS) { + if (errstatus == OCI_SUCCESS_WITH_INFO || errstatus == OCI_SUCCESS) { statement->has_data = 1; /* do the stuff needed for OCIDefineByName */ @@ -359,7 +366,7 @@ int php_oci_statement_fetch(php_oci_statement *statement, ub4 nrows TSRMLS_DC) return 0; } - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); statement->has_data = 0; @@ -482,6 +489,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) ub4 colcount; ub2 dynamic; dvoid *buf; + sword errstatus; switch (mode) { case OCI_COMMIT_ON_SUCCESS: @@ -502,12 +510,14 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) if (!statement->stmttype) { /* get statement type */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement->stmttype, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; + } else { + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } } @@ -528,10 +538,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) } /* execute statement */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIStmtExecute, (statement->connection->svc, statement->stmt, statement->err, iters, 0, NULL, NULL, mode)); + PHP_OCI_CALL_RETURN(errstatus, OCIStmtExecute, (statement->connection->svc, statement->stmt, statement->err, iters, 0, NULL, NULL, mode)); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } @@ -553,6 +563,8 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) * invoked PL/SQL must explicitly rollback/commit else the * SELECT fails). */ + + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } if (statement->stmttype == OCI_STMT_SELECT && statement->executed == 0) { @@ -565,10 +577,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) counter = 1; /* get number of columns */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_ATTR_PARAM_COUNT, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (dvoid *)&colcount, (ub4 *)0, OCI_ATTR_PARAM_COUNT, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } @@ -585,50 +597,50 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) } /* get column */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)¶m, counter)); + PHP_OCI_CALL_RETURN(errstatus, OCIParamGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, statement->err, (dvoid**)¶m, counter)); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get column datatype */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_type, (ub4 *)0, OCI_ATTR_DATA_TYPE, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_type, (ub4 *)0, OCI_ATTR_DATA_TYPE, statement->err)); - if (statement->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get character set form */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_form, (ub4 *)0, OCI_ATTR_CHARSET_FORM, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_form, (ub4 *)0, OCI_ATTR_CHARSET_FORM, statement->err)); - if (statement->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get character set id */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->charset_id, (ub4 *)0, OCI_ATTR_CHARSET_ID, statement->err)); - if (statement->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get size of the column */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->data_size, (dvoid *)0, OCI_ATTR_DATA_SIZE, statement->err)); - if (statement->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } @@ -637,31 +649,31 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) outcol->retlen = outcol->data_size; /* get scale of the column */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->scale, (dvoid *)0, OCI_ATTR_SCALE, statement->err)); - if (statement->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get precision of the column */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid *)&outcol->precision, (dvoid *)0, OCI_ATTR_PRECISION, statement->err)); - if (statement->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } /* get name of the column */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)param, OCI_DTYPE_PARAM, (dvoid **)&colname, (ub4 *)&outcol->name_len, (ub4)OCI_ATTR_NAME, statement->err)); - if (statement->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { PHP_OCI_CALL(OCIDescriptorFree, (param, OCI_DTYPE_PARAM)); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } @@ -757,7 +769,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) } if (dynamic == OCI_DYNAMIC_FETCH) { - PHP_OCI_CALL_RETURN(statement->errcode, + PHP_OCI_CALL_RETURN(errstatus, OCIDefineByPos, ( statement->stmt, /* IN/OUT handle to the requested SQL query */ @@ -775,7 +787,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) ); } else { - PHP_OCI_CALL_RETURN(statement->errcode, + PHP_OCI_CALL_RETURN(errstatus, OCIDefineByPos, ( statement->stmt, /* IN/OUT handle to the requested SQL query */ @@ -794,10 +806,10 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) } - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); - return 0; + return 1; } /* additional OCIDefineDynamic() call */ @@ -807,7 +819,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) case SQLT_BLOB: case SQLT_CLOB: case SQLT_BFILE: - PHP_OCI_CALL_RETURN(statement->errcode, + PHP_OCI_CALL_RETURN(errstatus, OCIDefineDynamic, ( outcol->oci_define, @@ -817,9 +829,15 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC) ) ); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); + PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); + return 1; + } break; } } + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } return 0; @@ -950,6 +968,7 @@ int php_oci_bind_post_exec(void *data TSRMLS_DC) { php_oci_bind *bind = (php_oci_bind *) data; php_oci_connection *connection = bind->parent_statement->connection; + sword errstatus; if (bind->indicator == -1) { /* NULL */ zval *val = bind->zval; @@ -1009,24 +1028,26 @@ 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)) { - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); zval_dtor(*entry); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); ZVAL_NULL(*entry); } else { + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ ZVAL_STRINGL(*entry, (char *)buff, buff_len, 1); } zend_hash_move_forward(hash); } else { - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); - if (connection->errcode != OCI_SUCCESS) { - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + PHP_OCI_CALL_RETURN(errstatus, OCIDateToText, (connection->err, &(((OCIDate *)(bind->array.elements))[i]), 0, 0, 0, 0, &buff_len, buff)); + if (errstatus != OCI_SUCCESS) { + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); add_next_index_null(bind->zval); } else { + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ add_next_index_stringl(bind->zval, (char *)buff, buff_len, 1); } } @@ -1072,6 +1093,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, php_oci_bind bind, *old_bind, *bindp; int mode = OCI_DATA_AT_EXEC; sb4 value_sz = -1; + sword errstatus; switch (type) { case SQLT_NTY: @@ -1195,7 +1217,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, bindp->type = type; zval_add_ref(&var); - PHP_OCI_CALL_RETURN(statement->errcode, + PHP_OCI_CALL_RETURN(errstatus, OCIBindByName, ( statement->stmt, /* statement handle */ @@ -1215,14 +1237,14 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, ) ); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } if (mode == OCI_DATA_AT_EXEC) { - PHP_OCI_CALL_RETURN(statement->errcode, OCIBindDynamic, + PHP_OCI_CALL_RETURN(errstatus, OCIBindDynamic, ( bindp->bind, statement->err, @@ -1233,8 +1255,8 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, ) ); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } @@ -1242,7 +1264,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, if (type == SQLT_NTY) { /* Bind object */ - PHP_OCI_CALL_RETURN(statement->errcode, OCIBindObject, + PHP_OCI_CALL_RETURN(errstatus, OCIBindObject, ( bindp->bind, statement->err, @@ -1254,13 +1276,14 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len, ) ); - if (statement->errcode) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } } + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ return 0; } /* }}} */ @@ -1446,17 +1469,18 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC) { ub2 statement_type; + sword errstatus; *type = 0; - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub2 *)&statement_type, (ub4 *)0, OCI_ATTR_STMT_TYPE, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } - + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ *type = statement_type; return 0; @@ -1468,17 +1492,18 @@ int php_oci_statement_get_type(php_oci_statement *statement, ub2 *type TSRMLS_DC int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSRMLS_DC) { ub4 statement_numrows; + sword errstatus; *numrows = 0; - PHP_OCI_CALL_RETURN(statement->errcode, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, OCI_ATTR_ROW_COUNT, statement->err)); + PHP_OCI_CALL_RETURN(errstatus, OCIAttrGet, ((dvoid *)statement->stmt, OCI_HTYPE_STMT, (ub4 *)&statement_numrows, (ub4 *)0, OCI_ATTR_ROW_COUNT, statement->err)); - if (statement->errcode != OCI_SUCCESS) { - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + if (errstatus != OCI_SUCCESS) { + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } - + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ *numrows = statement_numrows; return 0; @@ -1490,6 +1515,7 @@ int php_oci_statement_get_numrows(php_oci_statement *statement, ub4 *numrows TSR int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int name_len, zval *var, long max_table_length, long maxlength, long type TSRMLS_DC) { php_oci_bind *bind, *bindp; + sword errstatus; convert_to_array(var); @@ -1553,7 +1579,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam zval_add_ref(&var); - PHP_OCI_CALL_RETURN(statement->errcode, + PHP_OCI_CALL_RETURN(errstatus, OCIBindByName, ( statement->stmt, @@ -1574,12 +1600,13 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, int nam ); - if (statement->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { efree(bind); - statement->errcode = php_oci_error(statement->err, statement->errcode TSRMLS_CC); + statement->errcode = php_oci_error(statement->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(statement->connection, statement->errcode); return 1; } + statement->errcode = 0; /* retain backwards compat with OCI8 1.4 */ efree(bind); return 0; } @@ -1741,6 +1768,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p ub4 i; HashTable *hash; zval **entry; + sword errstatus; hash = HASH_OF(var); @@ -1762,14 +1790,14 @@ 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); - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, 0, NULL, 0, &oci_date)); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { /* failed to convert string to date */ efree(bind->array.element_lengths); efree(bind->array.elements); efree(bind); - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return NULL; } @@ -1777,20 +1805,21 @@ 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 { - PHP_OCI_CALL_RETURN(connection->errcode, OCIDateFromText, (connection->err, (CONST text *)"01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date)); + PHP_OCI_CALL_RETURN(errstatus, OCIDateFromText, (connection->err, (CONST text *)"01-JAN-00", sizeof("01-JAN-00")-1, NULL, 0, NULL, 0, &oci_date)); - if (connection->errcode != OCI_SUCCESS) { + if (errstatus != OCI_SUCCESS) { /* failed to convert string to date */ efree(bind->array.element_lengths); efree(bind->array.elements); efree(bind); - connection->errcode = php_oci_error(connection->err, connection->errcode TSRMLS_CC); + connection->errcode = php_oci_error(connection->err, errstatus TSRMLS_CC); PHP_OCI_HANDLE_ERROR(connection, connection->errcode); return NULL; } ((OCIDate *)bind->array.elements)[i] = oci_date; } + connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */ } zend_hash_internal_pointer_reset(hash); diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml index f2c59a1dc1..90c187bfb6 100644 --- a/ext/oci8/package.xml +++ b/ext/oci8/package.xml @@ -44,19 +44,17 @@ http://pear.php.net/dtd/package-2.0.xsd"> <time>12:00:00</time> <version> - <release>2.0.1</release> - <api>2.0.1</api> + <release>2.0.2</release> + <api>2.0.2</api> </version> <stability> <release>devel</release> <api>devel</api> </stability> <license uri="http://www.php.net/license">PHP</license> - <notes> - Fixed --enable-maintainer-zts mode. - Allow Implicit Result Set statement resources to inherit the parent's current prefetch count. - Allow OCI8 to be DTrace-enabled independently from core PHP. - Require OCI8 to be configured 'shared' when enabling DTrace support. + <notes> +Review and improve error handling code and data types. +Fix oci_set_*($connection, ...) error handling so oci_error($connection) works. </notes> <contents> <dir name="/"> @@ -455,6 +453,23 @@ http://pear.php.net/dtd/package-2.0.xsd"> </extsrcrelease> <changelog> +<release> + <version> + <release>2.0.1</release> + <api>2.0.1</api> + </version> + <stability> + <release>devel</release> + <api>devel</api> + </stability> + <license uri="http://www.php.net/license">PHP</license> + <notes> +Fixed --enable-maintainer-zts mode. +Allow Implicit Result Set statement resources to inherit the parent's current prefetch count. +Allow OCI8 to be DTrace-enabled independently from core PHP. +Require OCI8 to be configured 'shared' when enabling DTrace support. + </notes> +</release> <release> <version> @@ -467,69 +482,69 @@ http://pear.php.net/dtd/package-2.0.xsd"> </stability> <license uri="http://www.php.net/license">PHP</license> <notes> - - NEW FUNCTIONALITY: - - - Added Implicit Result Set support for Oracle Database 12c. - Streaming of all IRS's returned from a PL/SQL block is available - via oci_fetch_array, oci_fetch_assoc, oci_fetch_object and - oci_fetch_row (but not oci_fetch or oci_fetch_all). - Alternatively individual IRS statement resources can be obtained - with the new function 'oci_get_implicit_resultset' and passed to - any oci_fetch_* function. - - - Added DTrace probes enabled with PHP's generic --enable-dtrace - - - IMPROVED FUNCTIONALITY: - - - Using 'oci_execute($s, OCI_NO_AUTO_COMMIT)' for a SELECT no - longer unnecessarily initiates an internal ROLLBACK during - connection close. This can improve overall scalability by - reducing "round trips" between PHP and the database. - - - CHANGED FUNCTIONALITY: - - - PHPINFO() CHANGES: - - - The oci8.event and oci8.connection_class values are now shown - only when the Oracle client libraries support the respective - functionality. - - - Connection statistics are now in a separate phpinfo() table. - - - Temporary LOB and Collection support status lines in - phpinfo() were removed. These features have always been - enabled since 2007. - - - OCI_INTERNAL_DEBUG() CHANGES: - - - The oci_internal_debug() function is now a no-op. Use PHP's - --enable-dtrace functionality with DTrace or SystemTap instead. - - - INTERNAL CHANGES: - - - Fixed a potential NULL pointer dereference flagged by Parfait - static code analysis. - - - Extended testing of existing OCI8 functionality. - - - Improved test output portability when using the PHP development - web server to run tests. - - - Removed no-longer necessary Unicode patterns from tests - (vestiges of PHP's previous PHP 6 project) - - - Improved build portability by removing compilation type cast - warnings with some compilers. - - - Fixed compilation warnings when building with Oracle 9.2 - client libraries. - - - Updated code to use internal macro PHP_OCI_REGISTER_RESOURCE. - - - Regularized code prototypes and fixed some in-line documentation - prototypes. - - - Fixed code folding. +- NEW FUNCTIONALITY: + + - Added Implicit Result Set support for Oracle Database 12c. + Streaming of all IRS's returned from a PL/SQL block is available + via oci_fetch_array, oci_fetch_assoc, oci_fetch_object and + oci_fetch_row (but not oci_fetch or oci_fetch_all). + Alternatively individual IRS statement resources can be obtained + with the new function 'oci_get_implicit_resultset' and passed to + any oci_fetch_* function. + + - Added DTrace probes enabled with PHP's generic --enable-dtrace + +- IMPROVED FUNCTIONALITY: + + - Using 'oci_execute($s, OCI_NO_AUTO_COMMIT)' for a SELECT no + longer unnecessarily initiates an internal ROLLBACK during + connection close. This can improve overall scalability by + reducing "round trips" between PHP and the database. + +- CHANGED FUNCTIONALITY: + + - PHPINFO() CHANGES: + + - The oci8.event and oci8.connection_class values are now shown + only when the Oracle client libraries support the respective + functionality. + + - Connection statistics are now in a separate phpinfo() table. + + - Temporary LOB and Collection support status lines in + phpinfo() were removed. These features have always been + enabled since 2007. + + - OCI_INTERNAL_DEBUG() CHANGES: + + - The oci_internal_debug() function is now a no-op. Use PHP's + --enable-dtrace functionality with DTrace or SystemTap instead. + +- INTERNAL CHANGES: + + - Fixed a potential NULL pointer dereference flagged by Parfait + static code analysis. + + - Extended testing of existing OCI8 functionality. + + - Improved test output portability when using the PHP development + web server to run tests. + + - Removed no-longer necessary Unicode patterns from tests + (vestiges of PHP's previous PHP 6 project) + + - Improved build portability by removing compilation type cast + warnings with some compilers. + + - Fixed compilation warnings when building with Oracle 9.2 + client libraries. + + - Updated code to use internal macro PHP_OCI_REGISTER_RESOURCE. + + - Regularized code prototypes and fixed some in-line documentation + prototypes. + + - Fixed code folding. </notes> </release> diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h index 24d80a8163..7c8485800f 100644 --- a/ext/oci8/php_oci8_int.h +++ b/ext/oci8/php_oci8_int.h @@ -141,7 +141,7 @@ typedef struct { OCIAuthInfo *authinfo; /* Cached authinfo handle for OCISessionGet */ OCIError *err; /* private error handle */ php_oci_spool *private_spool; /* private session pool (for persistent) */ - sword errcode; /* last errcode */ + sb4 errcode; /* last ORA- error number */ HashTable *descriptors; /* descriptors hash, used to flush all the LOBs using this connection on commit */ ulong descriptor_count; /* used to index the descriptors hash table. Not an accurate count */ @@ -213,7 +213,7 @@ typedef struct { struct php_oci_statement *impres_child_stmt;/* child of current Implicit Result Set statement handle */ ub4 impres_count; /* count of remaining Implicit Result children on parent statement handle */ php_oci_connection *connection; /* parent connection handle */ - sword errcode; /* last errcode*/ + sb4 errcode; /* last ORA- error number */ OCIError *err; /* private error handle */ OCIStmt *stmt; /* statement handle */ char *last_query; /* last query issued. also used to determine if this is a statement or a refcursor recieved from Oracle */ @@ -412,7 +412,7 @@ void php_oci_client_get_version(char **version TSRMLS_DC); int php_oci_server_get_version(php_oci_connection *connection, char **version TSRMLS_DC); void php_oci_fetch_row(INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_args); int php_oci_column_to_zval(php_oci_out_column *column, zval *value, int mode TSRMLS_DC); -void php_oci_dtrace_check_connection(php_oci_connection *connection, sword errcode, ub4 serverStatus); +void php_oci_dtrace_check_connection(php_oci_connection *connection, sb4 errcode, ub4 serverStatus); /* }}} */ @@ -493,7 +493,7 @@ php_oci_bind *php_oci_bind_array_helper_date(zval *var, long max_table_length, p /* }}} */ ZEND_BEGIN_MODULE_GLOBALS(oci) /* {{{ Module globals */ - sword errcode; /* global last error code (used when connect fails, for example) */ + sb4 errcode; /* global last ORA- error number. Used when connect fails, for example */ OCIError *err; /* global error handle */ zend_bool debug_mode; /* debug mode flag */ |