cvs: /php4/ext/odbc php_odbc.c php_odbc.h

From: Date: Sun, 02 Jan 2000 15:59:33 +0000
Subject: cvs: /php4/ext/odbc php_odbc.c php_odbc.h
Groups: php.version4 
Request: Send a blank email to php-version4+get-8809@lists.php.net to get a copy of this message
kara Sun Jan 2 10:59:33 2000 EDT Modified files: /php4/ext/odbc php_odbc.c php_odbc.h Log: Statements get closed before connection shutdown. Disabled fetching all errors for Adabas. Index: php4/ext/odbc/php_odbc.c diff -u php4/ext/odbc/php_odbc.c:1.24 php4/ext/odbc/php_odbc.c:1.25 --- php4/ext/odbc/php_odbc.c:1.24 Fri Dec 31 20:31:44 1999 +++ php4/ext/odbc/php_odbc.c Sun Jan 2 10:59:01 2000 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_odbc.c,v 1.24 2000/01/01 01:31:44 sas Exp $ */ +/* $Id: php_odbc.c,v 1.25 2000/01/02 15:59:01 kara Exp $ */ #if COMPILE_DL #include "dl/phpdl.h" @@ -61,14 +61,6 @@ #define SAFE_SQL_NTS(n) ((SWORD) ((n)?(SQL_NTS):0)) -/* - * #if defined( HAVE_IBMDB2 ) || defined( HAVE_UNIXODBC ) - SQLHANDLE henv; -#else - HENV henv; -#endif -*/ - function_entry odbc_functions[] = { PHP_FE(odbc_setoption, NULL) PHP_FE(odbc_autocommit, NULL) @@ -122,7 +114,7 @@ PHP_MINIT(odbc), PHP_MSHUTDOWN(odbc), PHP_RINIT(odbc), - NULL, + PHP_RSHUTDOWN(odbc), PHP_MINFO(odbc), STANDARD_MODULE_PROPERTIES }; @@ -137,6 +129,14 @@ DLEXPORT zend_module_entry *get_module(void) { return &odbc_module_entry; }; #endif +static int _odbc_stmt_cleanup(list_entry *le) +{ + if(le->type == le_result){ + return 1; + } + return 0; +} + static void _free_odbc_result(odbc_result *res) { int i; @@ -420,6 +420,15 @@ return SUCCESS; } +PHP_RSHUTDOWN_FUNCTION(odbc) +{ + ELS_FETCH(); + + /* Close all statements before connection */ + zend_hash_apply(&EG(regular_list), (int (*)(void *)) _odbc_stmt_cleanup); + return SUCCESS; +} + PHP_MSHUTDOWN_FUNCTION(odbc) { ODBCLS_FETCH(); @@ -457,15 +466,17 @@ void ODBC_SQL_ERROR(HENV henv, HDBC conn, HSTMT stmt, char *func) #endif { - char state[6]; /* Not used */ + char state[6]; SDWORD error; /* Not used */ char errormsg[255]; SWORD errormsgsize; /* Not used */ - RETCODE ret; + RETCODE ret; ODBCLS_FETCH(); - do { - ret = SQLError(henv, conn, stmt, state, +#if !defined (HAVE_ADABAS) + do { +#endif + ret = SQLError(henv, conn, stmt, state, &error, errormsg, sizeof(errormsg)-1, &errormsgsize); if (func) { php_error(E_WARNING, "SQL error: %s, SQL state %s in %s", @@ -474,7 +485,9 @@ php_error(E_WARNING, "SQL error: %s, SQL state %s", errormsg, state); } - } while ( SQL_SUCCEEDED( ret )); +#if !defined (HAVE_ADABAS) + } while (SQL_SUCCEEDED(ret)); +#endif } void php_odgbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode) Index: php4/ext/odbc/php_odbc.h diff -u php4/ext/odbc/php_odbc.h:1.13 php4/ext/odbc/php_odbc.h:1.14 --- php4/ext/odbc/php_odbc.h:1.13 Thu Dec 30 19:38:22 1999 +++ php4/ext/odbc/php_odbc.h Sun Jan 2 10:59:01 2000 @@ -28,7 +28,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_odbc.h,v 1.13 1999/12/31 00:38:22 sas Exp $ */ +/* $Id: php_odbc.h,v 1.14 2000/01/02 15:59:01 kara Exp $ */ #ifndef _PHP_ODBC_H #define _PHP_ODBC_H @@ -157,6 +157,7 @@ extern PHP_MINIT_FUNCTION(odbc); extern PHP_MSHUTDOWN_FUNCTION(odbc); extern PHP_RINIT_FUNCTION(odbc); +extern PHP_RSHUTDOWN_FUNCTION(odbc); PHP_MINFO_FUNCTION(odbc); PHP_FUNCTION(odbc_setoption);

« previous php.version4 (#8809) next »