cvs: php4 /ext/oci8 oci8.c
| From: | Markus Fischer | Date: | Mon, 18 Mar 2002 21:01:32 +0000 |
| Subject: | cvs: php4 /ext/oci8 oci8.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-10375@lists.php.net to get a copy of this message | ||
mfischer Mon Mar 18 16:01:32 2002 EDT
Modified files:
/php4/ext/oci8 oci8.c
Log:
- Let OCIError() also return the sql statement which failed and the exact
position into the statement where it failed (if applicable).
Patch by Daniel Ceregatti <vi@sh.nu>.
Index: php4/ext/oci8/oci8.c
diff -u php4/ext/oci8/oci8.c:1.169 php4/ext/oci8/oci8.c:1.170
--- php4/ext/oci8/oci8.c:1.169 Thu Feb 28 03:26:28 2002
+++ php4/ext/oci8/oci8.c Mon Mar 18 16:01:29 2002
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: oci8.c,v 1.169 2002/02/28 08:26:28 sebastian Exp $ */
+/* $Id: oci8.c,v 1.170 2002/03/18 21:01:29 mfischer Exp $ */
/* TODO list:
*
@@ -631,7 +631,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "OCI8 Support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.169 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.170 $");
#ifndef PHP_WIN32
php_info_print_table_row(2, "Oracle Version", PHP_OCI8_VERSION );
php_info_print_table_row(2, "Compile-time ORACLE_HOME", PHP_OCI8_DIR );
@@ -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;
}