Improve some error handling to produce error text on some rare edge cases.
Disambiguate the Oracle library function call return status values from ORA error numbers.
Review and unify error data types.
* 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:
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 */
*/
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;
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;
}
/* }}} */
*/
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;
}
/* }}} */
*/
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;
}
/* }}} */
*/
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;
}
/* }}} */
*/
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;
}
*/
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;
}
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));
}
/* 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;
}
* 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;
}
#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;
}
/* {{{ 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;
}
/* }}} */
/* {{{ 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;
}
/* 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;
}
*
* 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 */
}
/* {{{ 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));
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,
)
);
- 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,
)
);
- 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,
)
);
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
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,
)
);
- 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,
)
);
- 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,
)
);
- 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,
)
);
- if (connection->errcode != OCI_SUCCESS) {
+ if (errstatus != OCI_SUCCESS) {
goto CLEANUP;
}
break;
}
/* Create object to hold return table */
- PHP_OCI_CALL_RETURN(connection->errcode, OCIObjectNew,
+ PHP_OCI_CALL_RETURN(errstatus, OCIObjectNew,
(
connection->env,
connection->err,
)
);
- 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:
/* 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;
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;
}
/* }}} */
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;
}
/* }}} */
{
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;
}
/* }}} */
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,
)
);
- 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;
}
/* }}} */
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 */
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,
)
);
- 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;
}
/* }}} */
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,
)
);
- 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;
}
/* }}} */
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,
)
);
- 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;
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;
{
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;
{
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;
}
/* }}} */
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,
)
);
- 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;
}
/* }}} */
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 */
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,
)
);
- 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;
}
/* }}} */
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,
)
);
- 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;
}
/* }}} */
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;
}
/* }}} */
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;
}
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);
php_oci_connection *connection;
text *errbuf;
sb4 errcode = 0;
- sword error = OCI_SUCCESS;
dvoid *errh = NULL;
ub2 error_offset = 0;
text *sqltext = NULL;
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;
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;
}
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;
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;
}
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;
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;
}
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;
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;
}
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;
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;
}
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:
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);
int php_oci_lob_get_length (php_oci_descriptor *descriptor, ub4 *length TSRMLS_DC)
{
php_oci_connection *connection = descriptor->connection;
+ sword errstatus;
*length = 0;
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;
}
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;
}
{
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) {
#endif
int is_clob = 0;
sb4 bytes_per_char = 1;
+ sword errstatus;
*data_len = 0;
*data = NULL;
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;
}
}
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;
}
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,
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,
#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);
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);
}
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
}
/* }}} */
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)) {
offset = descriptor->lob_current_position;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobWrite,
+ PHP_OCI_CALL_RETURN(errstatus, OCILobWrite,
(
connection->svc,
connection->err,
)
);
- 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;
descriptor->buffering = PHP_OCI_LOB_BUFFER_USED;
}
+ connection->errcode = 0; /* retain backwards compat with OCI8 1.4 */
return 0;
}
/* }}} */
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 */
}
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;
}
/* }}} */
{
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;
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobCopy,
+ PHP_OCI_CALL_RETURN(errstatus, OCILobCopy,
(
connection->svc,
connection->err,
)
);
- 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;
}
/* }}} */
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)) {
{
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;
}
/* }}} */
{
OCILobLocator *lob = descriptor->descriptor;
php_oci_connection *connection = descriptor->connection;
-
+ sword errstatus;
+
if (!lob) {
return 1;
}
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;
}
/* }}} */
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 */
}
while ((loblen = read(fp, &buf, sizeof(buf))) > 0) {
- PHP_OCI_CALL_RETURN(connection->errcode,
+ PHP_OCI_CALL_RETURN(errstatus,
OCILobWrite,
(
connection->svc,
)
);
- 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;
}
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;
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;
}
/* }}} */
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;
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;
}
/* }}} */
php_oci_connection *connection = descriptor->connection;
OCILobLocator *lob = descriptor->descriptor;
ub4 lob_length;
+ sword errstatus;
*bytes_erased = 0;
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;
}
/* }}} */
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;
}
/* }}} */
php_oci_connection *connection = descriptor->connection;
OCILobLocator *lob = descriptor->descriptor;
ub4 bytes_written = 0;
+ sword errstatus;
switch (type) {
case OCI_TEMP_BLOB:
return 1;
}
- PHP_OCI_CALL_RETURN(connection->errcode, OCILobCreateTemporary,
+ PHP_OCI_CALL_RETURN(errstatus, OCILobCreateTemporary,
(
connection->svc,
connection->err,
)
);
- 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);
}
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) {
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),
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;
}
}
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;
}
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;
}
/* }}} */
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) {
statement->executed = 0;
}
- statement->errcode = 0; /* OCI_NO_DATA is NO error for us!!! */
statement->has_data = 0;
if (nrows == 0) {
}
}
- 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,
}
}
- 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++) {
}
}
- 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 */
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;
ub4 colcount;
ub2 dynamic;
dvoid *buf;
+ sword errstatus;
switch (mode) {
case OCI_COMMIT_ON_SUCCESS:
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 */
}
}
}
/* 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;
}
* 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) {
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;
}
}
/* 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;
}
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;
}
}
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 */
);
} else {
- PHP_OCI_CALL_RETURN(statement->errcode,
+ PHP_OCI_CALL_RETURN(errstatus,
OCIDefineByPos,
(
statement->stmt, /* IN/OUT handle to the requested SQL query */
}
- 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 */
case SQLT_BLOB:
case SQLT_CLOB:
case SQLT_BFILE:
- PHP_OCI_CALL_RETURN(statement->errcode,
+ PHP_OCI_CALL_RETURN(errstatus,
OCIDefineDynamic,
(
outcol->oci_define,
)
);
+ 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;
{
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;
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);
}
}
php_oci_bind bind, *old_bind, *bindp;
int mode = OCI_DATA_AT_EXEC;
sb4 value_sz = -1;
+ sword errstatus;
switch (type) {
case SQLT_NTY:
bindp->type = type;
zval_add_ref(&var);
- PHP_OCI_CALL_RETURN(statement->errcode,
+ PHP_OCI_CALL_RETURN(errstatus,
OCIBindByName,
(
statement->stmt, /* statement handle */
)
);
- 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,
)
);
- 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 (type == SQLT_NTY) {
/* Bind object */
- PHP_OCI_CALL_RETURN(statement->errcode, OCIBindObject,
+ PHP_OCI_CALL_RETURN(errstatus, OCIBindObject,
(
bindp->bind,
statement->err,
)
);
- 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;
}
/* }}} */
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;
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;
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);
zval_add_ref(&var);
- PHP_OCI_CALL_RETURN(statement->errcode,
+ PHP_OCI_CALL_RETURN(errstatus,
OCIBindByName,
(
statement->stmt,
);
- 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;
}
ub4 i;
HashTable *hash;
zval **entry;
+ sword errstatus;
hash = HASH_OF(var);
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;
}
((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);
<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="/">
</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>
</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>
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 */
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 */
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);
/* }}} */
/* }}} */
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 */