I should have taken the time to make 100% sure these patches were relatively bug free. I missed some obvious bugs in previous patches. Hopfully these will test well.
I've not been able to compile the PHP binary in the latest CVS, so that patch is untested, but it _seems_ ok, since the compile makes it past oci8.c with no warnings. Attached are patches against 4.1.2 and the latest cvs. Daniel
--- php-4.1.2/ext/oci8/oci8.c.orig Wed Mar 13 14:51:19 2002 +++ php-4.1.2/ext/oci8/oci8.c Thu Mar 14 09:29:44 2002 @@ -4090,15 +4090,34 @@ zval **arg; oci_statement *statement; oci_connection *connection; - text errbuf[512]; - sb4 errcode = 0; + text errbuf[512]; + sb4 errcode = 0; sword error = 0; dvoid *errh = NULL; + ub2 errorofs = 0; + text *sqltext = NULL; if (zend_get_parameters_ex(1, &arg) == SUCCESS) { statement = (oci_statement *) zend_fetch_resource(arg TSRMLS_CC, -1, NULL, NULL, 1, le_stmt); if (statement) { - errh = statement->pError; + + CALL_OCI_RETURN(statement->error, OCIAttrGet( + (dvoid *)statement->pStmt, + OCI_HTYPE_STMT, + (text *) &sqltext, + (ub4 *)0, + OCI_ATTR_STATEMENT, + statement->pError)); + + CALL_OCI_RETURN(statement->error, OCIAttrGet( + (dvoid *)statement->pStmt, + OCI_HTYPE_STMT, + (ub2 *)&errorofs, + (ub4 *)0, + OCI_ATTR_PARSE_ERROR_OFFSET, + statement->pError)); + + errh = statement->pError; error = statement->error; } else { connection = (oci_connection *) zend_fetch_resource(arg TSRMLS_CC, -1, NULL, NULL, 1, le_conn); @@ -4134,6 +4153,8 @@ array_init(return_value); add_assoc_long(return_value, "code", errcode); add_assoc_string(return_value, "message", (char*) errbuf, 1); + add_assoc_long(return_value, "offset", errorofs); + add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : +"", 1); } else { RETURN_FALSE; }
--- php4/ext/oci8/oci8.c.orig Thu Mar 14 09:33:06 2002 +++ php4/ext/oci8/oci8.c Thu Mar 14 09:32:33 2002 @@ -4218,16 +4218,35 @@ zval **arg; oci_statement *statement; oci_connection *connection; - text errbuf[512]; - sb4 errcode = 0; + text errbuf[512]; + sb4 errcode = 0; sword error = 0; dvoid *errh = NULL; + ub2 errorofs = 0; + text *sqltext = NULL; if (zend_get_parameters_ex(1, &arg) == SUCCESS) { statement = (oci_statement *) zend_fetch_resource(arg TSRMLS_CC, -1, NULL, NULL, 1, le_stmt); if (statement) { errh = statement->pError; error = statement->error; + + CALL_OCI_RETURN(statement->error, OCIAttrGet( + (dvoid *)statement->pStmt, + OCI_HTYPE_STMT, + (text *) &sqltext, + (ub4 *)0, + OCI_ATTR_STATEMENT, + statement->pError)); + + CALL_OCI_RETURN(statement->error, OCIAttrGet( + (dvoid *)statement->pStmt, + OCI_HTYPE_STMT, + (ub2 *)&errorofs, + (ub4 *)0, + OCI_ATTR_PARSE_ERROR_OFFSET, + statement->pError)); + } else { connection = (oci_connection *) zend_fetch_resource(arg TSRMLS_CC, -1, NULL, NULL, 1, le_conn); if (connection) { @@ -4262,6 +4281,8 @@ array_init(return_value); add_assoc_long(return_value, "code", errcode); add_assoc_string(return_value, "message", (char*) errbuf, 1); + add_assoc_long(return_value, "offset", errorofs); + add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : +"", 1); } else { RETURN_FALSE; }
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php