CVS update: php3/functions

From: Date: Wed, 10 Feb 1999 17:29:29 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-4026@lists.php.net to get a copy of this message
Date: Wednesday February 10, 1999 @ 12:29 Author: thies Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv24129 Modified Files: oci8.c Log Message: added ocierror function. Index: php3/functions/oci8.c diff -c php3/functions/oci8.c:1.34 php3/functions/oci8.c:1.35 *** php3/functions/oci8.c:1.34 Wed Feb 10 09:36:12 1999 --- php3/functions/oci8.c Wed Feb 10 12:29:28 1999 *************** *** 32,38 **** +----------------------------------------------------------------------+ */ ! /* $Id: oci8.c,v 1.34 1999/02/10 14:36:12 thies Exp $ */ #include "php.h" #include "internal_functions.h" --- 32,38 ---- +----------------------------------------------------------------------+ */ ! /* $Id: oci8.c,v 1.35 1999/02/10 17:29:28 thies Exp $ */ #include "php.h" #include "internal_functions.h" *************** *** 160,165 **** --- 160,166 ---- void php3_oci8_internaldebug(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_logoff(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_logon(INTERNAL_FUNCTION_PARAMETERS); + void php3_oci8_error(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_freelob(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_savelob(INTERNAL_FUNCTION_PARAMETERS); void php3_oci8_loadlob(INTERNAL_FUNCTION_PARAMETERS); *************** *** 199,204 **** --- 200,206 ---- {"ocistatementtype", php3_oci8_statementtype, NULL}, {"ocilogoff", php3_oci8_logoff, NULL}, {"ocilogon", php3_oci8_logon, NULL}, + {"ocierror", php3_oci8_error, NULL}, {"ocifreelob", php3_oci8_freelob, NULL}, {"ocisavelob", php3_oci8_savelob, NULL}, {"ociloadlob", php3_oci8_loadlob, NULL}, *************** *** 1150,1156 **** RETURN_FALSE; } ! connection = oci8_get_conn(conn->value.lval, "OCISaveLob", list, plist); if (connection == NULL) { RETURN_FALSE; } --- 1152,1158 ---- RETURN_FALSE; } ! connection = oci8_get_conn(conn->value.lval, "OCIFreeLob", list, plist); if (connection == NULL) { RETURN_FALSE; } *************** *** 1907,1912 **** --- 1909,1964 ---- RETVAL_LONG(connection->id); OCI8_GLOBAL(php3_oci8_module).num_links++; + } + + /* }}} */ + /* {{{ proto int OCIError(int stmt|conn) + Return the last error of stmt|conn. If no error happened returns false. + */ + + void php3_oci8_error(INTERNAL_FUNCTION_PARAMETERS) + { + pval *mixed; + oci8_statement *statement; + oci8_connection *connection; + text errbuf[512]; + ub4 errcode = 0; + int type; + dvoid *errh = NULL; + + OCI8_TLS_VARS; + + if (getParameters(ht, 1, &mixed) == FAILURE) { + WRONG_PARAM_COUNT; + } + convert_to_long(mixed); + + statement = (oci8_statement *)php3_list_find(mixed->value.lval, &type); + if (statement && OCI8_STMT_TYPE(type)) { + errh = statement->pError; + } else { + connection = (oci8_connection *)php3_list_find(mixed->value.lval, &type); + if (connection && OCI8_CONN_TYPE(type)) { + errh = connection->pError; + } + } + + if (! errh) { + php3_error(E_WARNING, "OCIError: unable to find Error handle"); + RETURN_FALSE; + } + + OCIErrorGet(errh,1,NULL,&errcode,errbuf,(ub4)sizeof(errbuf),(ub4)OCI_HTYPE_ERROR); + + if (errcode) { + array_init(return_value); + add_assoc_long(return_value, "code", errcode); + add_assoc_string(return_value, "message", errbuf, 1); + } else { + RETURN_FALSE; + } + + } /* }}} */ -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#4026) next »