Don't call SQLGetDiagRec on SQL_ERROR return values, this causes

certain odbc drivers to crash.
This commit is contained in:
eknauel 2002-08-29 13:47:26 +00:00
parent c8864c6c9a
commit 00dc5a0296
1 changed files with 8 additions and 5 deletions

View File

@ -202,9 +202,9 @@ s48_value odbc_sql_connect(s48_value connection_handle,
ch = (SQLHDBC) s48_extract_integer(connection_handle);
retval = SQLConnect(ch,
dsn, dsn_len,
user, user_len,
auth, auth_len);
dsn, SQL_NTS,
user, SQL_NTS,
auth, SQL_NTS);
switch (retval)
{
@ -214,12 +214,12 @@ s48_value odbc_sql_connect(s48_value connection_handle,
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
/* ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch); */
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
/* ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch); */
ODBC_RAISE_EXCEPTION("SQLConnect returned SQL_ERROR");
break;
}
@ -2011,8 +2011,10 @@ s48_value odbc_sql_free_handle(s48_value handle_type, s48_value handle)
*
*/
#ifdef ODBC_DEBUG_MSGS
/* print detailed debug information */
void odbc_debug_msgs(SQLSMALLINT handle_type, SQLHANDLE handle)
{
@ -2022,6 +2024,7 @@ void odbc_debug_msgs(SQLSMALLINT handle_type, SQLHANDLE handle)
SQLSMALLINT i, message_len;
SQLRETURN retval;
printf("fetching diag_rec from odbc driver.\n");
i = 1;
while (1) {