cvs: /php4/ext/odbc php_odbc.c php_odbc.h
| From: | Andreas Karajannis | Date: | Fri, 08 Oct 1999 19:36:21 +0000 |
| Subject: | cvs: /php4/ext/odbc php_odbc.c php_odbc.h | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-5416@lists.php.net to get a copy of this message | ||
kara Fri Oct 8 15:36:21 1999 EDT
Modified files:
/php4/ext/odbc php_odbc.c php_odbc.h
Log:
Moved Environment handle to connection struct for thread safety
Index: php4/ext/odbc/php_odbc.c
diff -u php4/ext/odbc/php_odbc.c:1.5 php4/ext/odbc/php_odbc.c:1.6
--- php4/ext/odbc/php_odbc.c:1.5 Thu Oct 7 14:49:41 1999
+++ php4/ext/odbc/php_odbc.c Fri Oct 8 15:35:50 1999
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_odbc.c,v 1.5 1999/10/07 18:49:41 kara Exp $ */
+/* $Id: php_odbc.c,v 1.6 1999/10/08 19:35:50 kara Exp $ */
#if COMPILE_DL
#include "dl/phpdl.h"
@@ -55,12 +55,13 @@
static int le_result, le_conn, le_pconn;
-#if defined( HAVE_DB2 ) || defined( HAVE_UNIXODBC )
+/*
+ * #if defined( HAVE_DB2 ) || defined( HAVE_UNIXODBC )
SQLHANDLE henv;
#else
HENV henv;
#endif
-
+*/
function_entry odbc_functions[] = {
PHP_FE(odbc_setoption, NULL)
@@ -141,7 +142,7 @@
}
if(res->stmt){
#if HAVE_SOLID
- SQLTransact(henv, res->conn_ptr->hdbc,
+ SQLTransact(res->conn_ptr->henv, res->conn_ptr->hdbc,
(UWORD)SQL_COMMIT);
#endif
SQLFreeStmt(res->stmt,SQL_DROP);
@@ -164,6 +165,7 @@
SQLDisconnect(conn->hdbc);
SQLFreeConnect(conn->hdbc);
+ SQLFreeEnv(conn->henv);
efree(conn);
ODBCG(num_links)--;
}
@@ -175,6 +177,7 @@
conn->open = 0;
SQLDisconnect(conn->hdbc);
SQLFreeConnect(conn->hdbc);
+ SQLFreeEnv(conn->henv);
free(conn);
ODBCG(num_links)--;
@@ -314,13 +317,12 @@
#endif
REGISTER_INI_ENTRIES();
- SQLAllocEnv(&henv);
+ /* SQLAllocEnv(&henv); */
le_result = register_list_destructors(_free_odbc_result, NULL);
le_conn = register_list_destructors(_close_odbc_conn, NULL);
le_pconn = register_list_destructors(NULL, _close_odbc_pconn);
odbc_module_entry.type = type;
- SQLAllocEnv(&henv);
#ifdef SQLANY_BUG
/* Make a dumb connection to avoid crash on SQLFreeEnv(),
* then release it immediately.
@@ -429,7 +431,7 @@
ODBCLS_FETCH();
UNREGISTER_INI_ENTRIES();
- SQLFreeEnv(henv);
+ /*SQLFreeEnv(henv);*/
return SUCCESS;
}
@@ -456,9 +458,9 @@
}
#if defined ( HAVE_DB2 ) || defined ( HAVE_UNIXODBC )
-void ODBC_SQL_ERROR(SQLHANDLE conn, SQLHANDLE stmt, char *func)
+void ODBC_SQL_ERROR(SQLHANDLE henv, SQLHANDLE conn, SQLHANDLE stmt, char *func)
#else
-void ODBC_SQL_ERROR(HDBC conn, HSTMT stmt, char *func)
+void ODBC_SQL_ERROR(HENV henv, HDBC conn, HSTMT stmt, char *func)
#endif
{
char state[6]; /* Not used */
@@ -579,9 +581,9 @@
conn = (odbc_connection *) zend_fetch_resource_ex(pv_conn, -1, "ODBC connection", 2,
le_conn, le_pconn);
ZEND_VERIFY_RESOURCE(conn);
- rc = SQLTransact(henv, conn->hdbc, (UWORD)((type)?SQL_COMMIT:SQL_ROLLBACK));
+ rc = SQLTransact(conn->henv, conn->hdbc, (UWORD)((type)?SQL_COMMIT:SQL_ROLLBACK));
if(rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLTransact");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLTransact");
RETURN_FALSE;
}
@@ -658,13 +660,13 @@
}
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
efree(result);
RETURN_FALSE;
}
if((rc = SQLPrepare(result->stmt, query, SQL_NTS)) != SQL_SUCCESS){
- ODBC_SQL_ERROR(conn->hdbc, result->stmt, "SQLPrepare");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, result->stmt, "SQLPrepare");
SQLFreeStmt(result->stmt, SQL_DROP);
RETURN_FALSE;
}
@@ -799,7 +801,7 @@
rc = SQLFreeStmt(result->stmt, SQL_CLOSE);
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt, "SQLFreeStmt");
+ ODBC_SQL_ERROR(result->conn_ptr->henv, result->conn_ptr->hdbc, result->stmt,
"SQLFreeStmt");
}
rc = SQLExecute(result->stmt);
@@ -817,7 +819,7 @@
}
}else{
if(rc != SQL_SUCCESS){
- ODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt, "SQLExecute");
+ ODBC_SQL_ERROR(result->conn_ptr->henv, result->conn_ptr->hdbc, result->stmt,
"SQLExecute");
RETVAL_FALSE;
}
}
@@ -887,14 +889,14 @@
SWORD errormsgsize; /* Not used */
ODBCLS_FETCH();
- SQLError(henv, result->conn_ptr->hdbc,
+ SQLError( result->conn_ptr->henv, result->conn_ptr->hdbc,
result->stmt, state, &error, errormsg,
sizeof(errormsg)-1, &errormsgsize);
if(!strncmp(state,"S1015",5)){
sprintf(cursorname,"php3_curs_%d", (int)result->stmt);
if(SQLSetCursorName(result->stmt,cursorname,SQL_NTS) != SQL_SUCCESS){
- ODBC_SQL_ERROR(result->conn_ptr->hdbc,result->stmt,
- "SQLSetCursorName");
+ ODBC_SQL_ERROR(result->conn_ptr->henv, result->conn_ptr->hdbc,
+ result->stmt, "SQLSetCursorName");
RETVAL_FALSE;
}else{
RETVAL_STRING(cursorname,1);
@@ -958,7 +960,7 @@
}
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
efree(result);
RETURN_FALSE;
}
@@ -974,7 +976,7 @@
*/
if(SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC)
== SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, result->stmt, " SQLSetStmtOption");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, result->stmt, " SQLSetStmtOption");
SQLFreeStmt(result->stmt, SQL_DROP);
efree(result);
RETURN_FALSE;
@@ -990,7 +992,7 @@
/* XXX FIXME we should really check out SQLSTATE with SQLError
* in case rc is SQL_SUCCESS_WITH_INFO here.
*/
- ODBC_SQL_ERROR(conn->hdbc, result->stmt, "SQLExecDirect");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, result->stmt, "SQLExecDirect");
SQLFreeStmt(result->stmt, SQL_DROP);
efree(result);
RETURN_FALSE;
@@ -1125,8 +1127,8 @@
rc = SQLGetData(result->stmt, (UWORD)(i + 1),sql_c_type,
buf, result->longreadlen + 1, &result->values[i].vallen);
- if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt, "SQLGetData");
+ if(rc == SQL_ERROR){
+ ODBC_SQL_ERROR(result->conn_ptr->henv, result->conn_ptr->hdbc, result->stmt,
"SQLGetData");
efree(buf);
RETURN_FALSE;
}
@@ -1346,7 +1348,7 @@
field, fieldsize, &result->values[field_ind].vallen);
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt,
"SQLGetData");
+ ODBC_SQL_ERROR(result->conn_ptr->henv, result->conn_ptr->hdbc,
result->stmt, "SQLGetData");
efree(field);
RETURN_FALSE;
}
@@ -1389,7 +1391,7 @@
field, fieldsize, &result->values[field_ind].vallen);
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt, "SQLGetData");
+ ODBC_SQL_ERROR(result->conn_ptr->henv, result->conn_ptr->hdbc, result->stmt,
"SQLGetData");
efree(field);
RETURN_FALSE;
}
@@ -1495,7 +1497,7 @@
php_printf("<td>");
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt, "SQLGetData");
+ ODBC_SQL_ERROR(result->conn_ptr->henv, result->conn_ptr->hdbc, result->stmt,
"SQLGetData");
php_printf("</td></tr></table>");
efree(buf);
RETURN_FALSE;
@@ -1574,7 +1576,8 @@
*conn = (odbc_connection *)pemalloc(sizeof(odbc_connection), persistent);
(*conn)->persistent = persistent;
- SQLAllocConnect(henv, &((*conn)->hdbc));
+ SQLAllocEnv(&((*conn)->henv));
+ SQLAllocConnect((*conn)->henv, &((*conn)->hdbc));
#if HAVE_SOLID
SQLSetConnectOption((*conn)->hdbc, SQL_TRANSLATE_OPTION,
@@ -1593,7 +1596,7 @@
if(cur_opt != SQL_CUR_DEFAULT){
rc = SQLSetConnectOption((*conn)->hdbc, SQL_ODBC_CURSORS, cur_opt);
if(rc != SQL_SUCCESS){ /* && rc != SQL_SUCCESS_WITH_INFO ? */
- ODBC_SQL_ERROR((*conn)->hdbc, SQL_NULL_HSTMT, "SQLSetConnectOption");
+ ODBC_SQL_ERROR((*conn)->henv, (*conn)->hdbc, SQL_NULL_HSTMT,
"SQLSetConnectOption");
SQLFreeConnect((*conn)->hdbc);
pefree(*conn, persistent);
return FALSE;
@@ -1631,7 +1634,7 @@
#endif
#endif
if(rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
- ODBC_SQL_ERROR((*conn)->hdbc, SQL_NULL_HSTMT, "SQLConnect");
+ ODBC_SQL_ERROR((*conn)->henv, (*conn)->hdbc, SQL_NULL_HSTMT, "SQLConnect");
SQLFreeConnect((*conn)->hdbc);
pefree((*conn), persistent);
return FALSE;
@@ -2043,7 +2046,7 @@
((*pv_onoff)->value.lval) ?
SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF);
if(rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "Set autocommit");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "Set autocommit");
RETURN_FALSE;
}
RETVAL_TRUE;
@@ -2052,7 +2055,7 @@
rc = SQLGetConnectOption(conn->hdbc, SQL_AUTOCOMMIT, (PTR)&status);
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "Get commit status");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "Get commit status");
RETURN_FALSE;
}
RETVAL_LONG((long)status);
@@ -2111,7 +2114,7 @@
}
rc = SQLSetConnectOption(conn->hdbc, (unsigned short)((*pv_opt)->value.lval),
(*pv_val)->value.lval);
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SetConnectOption");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SetConnectOption");
RETURN_FALSE;
}
break;
@@ -2121,7 +2124,7 @@
rc = SQLSetStmtOption(result->stmt, (unsigned short)((*pv_opt)->value.lval),
((*pv_val)->value.lval));
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
- ODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt, "SetStmtOption");
+ ODBC_SQL_ERROR(result->conn_ptr->henv, result->conn_ptr->hdbc, result->stmt,
"SetStmtOption");
RETURN_FALSE;
}
break;
@@ -2188,7 +2191,7 @@
}
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
efree(result);
RETURN_FALSE;
}
@@ -2200,7 +2203,7 @@
type, type ? SQL_NTS : 0 );
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLTables");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLTables");
efree(result);
RETURN_FALSE;
}
@@ -2271,7 +2274,7 @@
}
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
efree(result);
RETURN_FALSE;
}
@@ -2283,7 +2286,7 @@
column, column ? SQL_NTS : 0 );
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLColumns");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLColumns");
efree(result);
RETURN_FALSE;
}
@@ -2350,7 +2353,7 @@
}
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
efree(result);
RETURN_FALSE;
}
@@ -2362,7 +2365,7 @@
column, column ? SQL_NTS : 0 );
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLColumnPrivileges");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLColumnPrivileges");
efree(result);
RETURN_FALSE;
}
@@ -2436,7 +2439,7 @@
}
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
efree(result);
RETURN_FALSE;
}
@@ -2450,7 +2453,7 @@
ftable, ftable ? SQL_NTS : 0 );
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLForeignKeys");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLForeignKeys");
efree(result);
RETURN_FALSE;
}
@@ -2514,7 +2517,7 @@
}
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
efree(result);
RETURN_FALSE;
}
@@ -2523,7 +2526,7 @@
data_type );
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLGetTypeInfo");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLGetTypeInfo");
efree(result);
RETURN_FALSE;
}
@@ -2588,7 +2591,7 @@
}
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
efree(result);
RETURN_FALSE;
}
@@ -2599,7 +2602,7 @@
table, table ? SQL_NTS : 0 );
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLPrimaryKeys");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLPrimaryKeys");
efree(result);
RETURN_FALSE;
}
@@ -2670,7 +2673,7 @@
}
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
efree(result);
RETURN_FALSE;
}
@@ -2682,7 +2685,7 @@
col, col ? SQL_NTS : 0 );
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLProcedureColumns");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLProcedureColumns");
efree(result);
RETURN_FALSE;
}
@@ -2751,7 +2754,7 @@
}
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
efree(result);
RETURN_FALSE;
}
@@ -2762,7 +2765,7 @@
proc, proc ? SQL_NTS : 0 );
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLProcedures");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLProcedures");
efree(result);
RETURN_FALSE;
}
@@ -2836,7 +2839,7 @@
}
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
efree(result);
RETURN_FALSE;
}
@@ -2850,7 +2853,7 @@
nullable);
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLSpecialColumns");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLSpecialColumns");
efree(result);
RETURN_FALSE;
}
@@ -2922,7 +2925,7 @@
}
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
efree(result);
RETURN_FALSE;
}
@@ -2935,7 +2938,7 @@
reserved);
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLStatistics");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLStatistics");
efree(result);
RETURN_FALSE;
}
@@ -3000,7 +3003,7 @@
}
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
efree(result);
RETURN_FALSE;
}
@@ -3011,7 +3014,7 @@
table, table ? SQL_NTS : 0 );
if(rc == SQL_ERROR){
- ODBC_SQL_ERROR(conn->hdbc, SQL_NULL_HSTMT, "SQLTablePrivileges");
+ ODBC_SQL_ERROR(conn->henv, conn->hdbc, SQL_NULL_HSTMT, "SQLTablePrivileges");
efree(result);
RETURN_FALSE;
}
Index: php4/ext/odbc/php_odbc.h
diff -u php4/ext/odbc/php_odbc.h:1.4 php4/ext/odbc/php_odbc.h:1.5
--- php4/ext/odbc/php_odbc.h:1.4 Thu Oct 7 14:49:41 1999
+++ php4/ext/odbc/php_odbc.h Fri Oct 8 15:35:50 1999
@@ -28,7 +28,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_odbc.h,v 1.4 1999/10/07 18:49:41 kara Exp $ */
+/* $Id: php_odbc.h,v 1.5 1999/10/08 19:35:50 kara Exp $ */
#ifndef _PHP_ODBC_H
#define _PHP_ODBC_H
@@ -190,8 +190,10 @@
typedef struct odbc_connection {
#if defined( HAVE_DB2 ) || defined( HAVE_UNIXODBC )
+ SQLHANDLE henv;
SQLHANDLE hdbc;
#else
+ HENV henv;
HDBC hdbc;
#endif
int open;
@@ -245,10 +247,12 @@
int odbc_add_conn(HashTable *list, HDBC conn);
odbc_connection *odbc_get_conn(HashTable *list, int count);
void odbc_del_conn(HashTable *list, int ind);
+
+#define ODBC_SQL_ERROR odbc_sql_error
#if defined( HAVE_DB2 ) || defined( HAVE_UNIXODBC )
-void odbc_sql_error(SQLHANDLE conn, SQLHANDLE stmt, char *func);
+void odbc_sql_error(SQLHANDLE henv, SQLHANDLE conn, SQLHANDLE stmt, char *func);
#else
-void odbc_sql_error(HDBC conn, HSTMT stmt, char *func);
+void odbc_sql_error(HENV henv, HDBC conn, HSTMT stmt, char *func);
#endif
int odbc_bindcols(odbc_result *result);