- Don't distinguish between SQL_SUCCESS and SQL_SUCCESS_WITH_INFO.

- Don't call SQLGetDiagRec() automatically on SQL_ERROR, some ODBC
  seem to have a broken SQLGetDiagRec() implementation. Let user call
  SQLGetDiagRec() from Scheme at his own risk.

The ODBC documentation thinks it's a good idea to call SQLGetDiagRec()
after each ODBC-call that might return SQL_SUCCESS_WITH_INFO. IMHO
this sucks. However it's now possible to do so in the user's Scheme
code.
This commit is contained in:
eknauel 2002-09-03 08:14:14 +00:00
parent 7efd91d54f
commit 23151f3ad1
1 changed files with 42 additions and 244 deletions

View File

@ -22,20 +22,13 @@ s48_value odbc_alloc_environment_handle()
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
odbc_sql_set_env_attr(henv);
return s48_enter_integer((long)henv);
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_ENV, henv);
odbc_sql_set_env_attr(henv);
return s48_enter_integer((long)henv);
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_ENV, henv);
ODBC_RAISE_EXCEPTION("SQLAllocHandle returned SQL_ERROR");
break;
}
@ -63,18 +56,12 @@ void odbc_sql_set_env_attr(SQLHENV env_handle)
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_ENV, env_handle);
return;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_ENV, env_handle);
ODBC_RAISE_EXCEPTION("SQLSetEnvAttr returned SQL_ERROR");
break;
}
@ -85,7 +72,7 @@ void odbc_sql_set_env_attr(SQLHENV env_handle)
}
default:
{
ODBC_RAISE_EXCEPTION("SQLSetEnvAttr returned unknown error code\n");
ODBC_RAISE_EXCEPTION("SQLSetEnvAttr returned unknown error code");
break;
}
}
@ -106,18 +93,12 @@ s48_value odbc_alloc_connection_handle(s48_value env_handle) {
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return s48_enter_integer((long)hdbc);
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, envh);
return s48_enter_integer((long)hdbc);
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, envh);
ODBC_RAISE_EXCEPTION("SQLAllocHandle returned SQL_ERROR");
break;
}
@ -149,18 +130,12 @@ s48_value odbc_alloc_statement_handle(s48_value conn_handle) {
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return s48_enter_integer((long)hstmt);
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
return s48_enter_integer((long)hstmt);
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
ODBC_RAISE_EXCEPTION("SQLAllocHandle returned SQL_ERROR");
break;
}
@ -208,18 +183,12 @@ s48_value odbc_sql_connect(s48_value connection_handle,
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
/* ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch); */
return S48_TRUE;
}
case SQL_ERROR:
{
/* ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch); */
ODBC_RAISE_EXCEPTION("SQLConnect returned SQL_ERROR");
break;
}
@ -280,8 +249,6 @@ s48_value odbc_sql_data_sources(s48_value env_handle)
result = s48_cons(s48_cons(s48_enter_string(server_name),
s48_enter_string(driver_descr)),
result);
if (retval == SQL_SUCCESS_WITH_INFO)
ODBC_DEBUG_DIAGREC(SQL_HANDLE_ENV, eh);
break;
}
case SQL_NO_DATA:
@ -291,7 +258,6 @@ s48_value odbc_sql_data_sources(s48_value env_handle)
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_ENV, eh);
ODBC_RAISE_EXCEPTION("SQLDataSources returned SQL_ERROR");
break;
}
@ -302,7 +268,6 @@ s48_value odbc_sql_data_sources(s48_value env_handle)
}
default:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_ENV, eh);
ODBC_RAISE_EXCEPTION("SQLDataSources returned unknown error code");
break;
}
@ -350,8 +315,6 @@ s48_value odbc_sql_drivers(s48_value env_handle)
result = s48_cons(s48_cons(s48_enter_string(driver_descr),
s48_enter_string(driver_attr)),
result);
if (retval == SQL_SUCCESS_WITH_INFO)
ODBC_DEBUG_DIAGREC(SQL_HANDLE_ENV, eh);
break;
}
case SQL_NO_DATA:
@ -361,7 +324,6 @@ s48_value odbc_sql_drivers(s48_value env_handle)
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_ENV, eh);
ODBC_RAISE_EXCEPTION("SQLDrivers returned SQL_ERROR");
break;
}
@ -372,7 +334,6 @@ s48_value odbc_sql_drivers(s48_value env_handle)
}
default:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_ENV, eh);
ODBC_RAISE_EXCEPTION("SQLDrivers returned unknown error code");
break;
}
@ -403,18 +364,12 @@ s48_value odbc_sql_get_info_int(s48_value conn_handle, s48_value info_key)
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return s48_enter_integer(info);
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
return s48_enter_integer(info);
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
ODBC_RAISE_EXCEPTION("SQLGetInfo returned SQL_ERROR");
break;
}
@ -451,18 +406,12 @@ s48_value odbc_sql_get_info_string(s48_value conn_handle, s48_value info_key)
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return s48_enter_string(info);
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
return s48_enter_string(info);
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
ODBC_RAISE_EXCEPTION("SQLGetInfo returned SQL_ERROR");
break;
}
@ -498,18 +447,12 @@ s48_value odbc_sql_get_func_exists(s48_value conn_handle, s48_value fun_id)
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return SQL_FUNC_EXISTS(supported, fi) == SQL_TRUE ? S48_TRUE : S48_FALSE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
return SQL_FUNC_EXISTS(supported, fi) == SQL_TRUE ? S48_TRUE : S48_FALSE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
ODBC_RAISE_EXCEPTION("SQLGetFunctions returned SQL_ERROR");
break;
}
@ -543,18 +486,12 @@ s48_value odbc_sql_get_type_info(s48_value stmt_handle, s48_value data_type)
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLGetTypeInfo returned SQL_ERROR");
break;
}
@ -599,18 +536,12 @@ s48_value odbc_sql_set_connect_attr_int(s48_value conn_handle,
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
ODBC_RAISE_EXCEPTION("SQLSetConnectAttr returned SQL_ERROR");
break;
}
@ -646,18 +577,12 @@ s48_value odbc_sql_set_connect_attr_string(s48_value conn_handle,
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
ODBC_RAISE_EXCEPTION("SQLSetConnectAttr returned SQL_ERROR");
break;
}
@ -692,18 +617,12 @@ s48_value odbc_sql_get_connect_attr_string(s48_value conn_handle,
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return s48_enter_string(buffer);
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
return s48_enter_string(buffer);
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
ODBC_RAISE_EXCEPTION("SQLGetConnectAttr returned SQL_ERROR");
break;
}
@ -737,18 +656,12 @@ s48_value odbc_sql_get_connect_attr_int(s48_value conn_handle,
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return s48_enter_integer(buffer);
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
return s48_enter_integer(buffer);
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
ODBC_RAISE_EXCEPTION("SQLGetConnectAttr returned SQL_ERROR");
break;
}
@ -785,18 +698,12 @@ s48_value odbc_sql_set_env_attr_int(s48_value env_handle,
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_ENV, eh);
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, eh);
ODBC_RAISE_EXCEPTION("SQLSetEnvAttr returned SQL_ERROR");
break;
}
@ -833,18 +740,12 @@ s48_value odbc_sql_get_env_attr_int(s48_value env_handle,
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return s48_extract_integer(val);
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_ENV, eh);
return s48_extract_integer(val);
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_ENV, eh);
ODBC_RAISE_EXCEPTION("SQLGetEnvAttr returned SQL_ERROR");
break;
}
@ -882,18 +783,12 @@ s48_value odbc_sql_set_stmt_attr_int(s48_value stmt_handle,
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLSetStmtAttr returned SQL_ERROR");
break;
}
@ -931,18 +826,12 @@ s48_value odbc_sql_set_stmt_attr_string(s48_value stmt_handle,
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLSetStmtAttr returned SQL_ERROR");
break;
}
@ -976,18 +865,12 @@ s48_value odbc_sql_get_stmt_attr_int(s48_value stmt_handle,
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return s48_enter_integer(val);
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
return s48_enter_integer(val);
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLGetStmtAttr returned SQL_ERROR");
break;
}
@ -1020,18 +903,12 @@ s48_value odbc_sql_get_stmt_attr_string(s48_value stmt_handle,
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return s48_enter_string(buf);
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
return s48_enter_string(buf);
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLGetStmtAttr returned SQL_ERROR");
break;
}
@ -1078,15 +955,10 @@ s48_value odbc_sql_prepare(s48_value stmt_handle, s48_value stmt_txt)
retval = SQLPrepare(sh, query, S48_STRING_LENGTH(stmt_txt));
switch (retval) {
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
return S48_TRUE;
}
case SQL_INVALID_HANDLE:
{
ODBC_RAISE_EXCEPTION("SQLPrepare got invalid handle");
@ -1094,7 +966,6 @@ s48_value odbc_sql_prepare(s48_value stmt_handle, s48_value stmt_txt)
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLPrepare returned SQL_ERROR");
break;
}
@ -1305,17 +1176,11 @@ s48_value odbc_sql_bind_parameter_exec_out(s48_value stmt_handle,
ODBC_DEBUG_PRINTF("All parameters bound\n");
/* check the return value of SQLBindParameter */
if (retval != SQL_SUCCESS) {
if ((retval != SQL_SUCCESS) || (retval != SQL_SUCCESS_WITH_INFO)) {
switch (retval)
{
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
break;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLBindParameter returned SQL_ERROR");
break;
}
@ -1336,18 +1201,12 @@ s48_value odbc_sql_bind_parameter_exec_out(s48_value stmt_handle,
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLExcute returned SQL_ERROR");
break;
}
@ -1388,18 +1247,12 @@ s48_value odbc_sql_execute(s48_value stmt_handle)
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLExecute returned SQL_ERROR");
break;
}
@ -1433,18 +1286,12 @@ s48_value odbc_sql_execute_direct(s48_value stmt_handle,
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLExecDirect returned SQL_ERROR");
break;
}
@ -1534,18 +1381,12 @@ void check_sql_get_data_result(SQLRETURN retval, SQLHSTMT stmt_handle)
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, stmt_handle);
return;
}
case SQL_NO_DATA:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, stmt_handle);
ODBC_RAISE_EXCEPTION("SQLGetData returned SQL_NO_DATA");
break;
}
@ -1556,7 +1397,6 @@ void check_sql_get_data_result(SQLRETURN retval, SQLHSTMT stmt_handle)
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, stmt_handle);
ODBC_RAISE_EXCEPTION("SQLGetData returned SQL_ERROR");
break;
}
@ -1582,15 +1422,10 @@ s48_value odbc_sql_fetch(s48_value stmt_handle)
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
return S48_TRUE;
}
case SQL_NO_DATA:
{
return SQL_NO_DATA;
@ -1602,7 +1437,6 @@ s48_value odbc_sql_fetch(s48_value stmt_handle)
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLFetch returned SQL_ERROR");
break;
}
@ -1636,9 +1470,6 @@ s48_value odbc_sql_num_result_cols(s48_value stmt_handle)
{
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
if (retval == SQL_SUCCESS_WITH_INFO)
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
return s48_enter_integer(numcols);
}
case SQL_STILL_EXECUTING:
@ -1648,7 +1479,6 @@ s48_value odbc_sql_num_result_cols(s48_value stmt_handle)
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLNumResultCols returned SQL_ERROR");
break;
}
@ -1673,8 +1503,11 @@ s48_value odbc_sql_describe_col(s48_value stmt_handle, s48_value column_number)
SQLCHAR column_name[ODBC_DESCRIBE_COL_MAX_STR_LEN];
SQLSMALLINT buf_len, data_type, digits, nullable;
SQLUINTEGER col_size;
s48_value col_rec;
SQLRETURN retval;
s48_value col_rec = S48_UNSPECIFIC;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(col_rec);
ODBC_DEBUG_PRINTF("odbc_sql_describe_col\n");
@ -1694,9 +1527,6 @@ s48_value odbc_sql_describe_col(s48_value stmt_handle, s48_value column_number)
{
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
if (retval == SQL_SUCCESS_WITH_INFO)
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
col_rec = s48_make_record(odbc_column_record_type);
S48_RECORD_SET(col_rec, SR_ODBC_COLUMN_NAME,
s48_enter_string(column_name));
@ -1709,6 +1539,7 @@ s48_value odbc_sql_describe_col(s48_value stmt_handle, s48_value column_number)
S48_RECORD_SET(col_rec, SR_ODBC_COLUMN_NULLABLE,
s48_enter_integer(nullable));
S48_GC_UNPROTECT();
return col_rec;
}
case SQL_STILL_EXECUTING:
@ -1718,7 +1549,6 @@ s48_value odbc_sql_describe_col(s48_value stmt_handle, s48_value column_number)
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLDescribeCol returned SQL_ERROR");
break;
}
@ -1770,18 +1600,12 @@ s48_value odbc_sql_free_statement(s48_value stmt_handle, s48_value option)
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLFreeStmt returned SQL_ERROR");
break;
}
@ -1810,18 +1634,12 @@ s48_value odbc_sql_close_cursor(s48_value stmt_handle)
retval = SQLCloseCursor(sh);
switch (retval) {
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLCloseCursor returned SQL_ERROR");
break;
}
@ -1850,18 +1668,12 @@ s48_value odbc_sql_cancel(s48_value stmt_handle)
retval = SQLCancel(sh);
switch (retval) {
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_STMT, sh);
ODBC_RAISE_EXCEPTION("SQLCancel returned SQL_ERROR");
break;
}
@ -1897,18 +1709,12 @@ s48_value odbc_sql_endtran(s48_value handle_type, s48_value handle,
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(ht, h);
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(ht, h);
ODBC_RAISE_EXCEPTION("SQLEndTran returned SQL_ERROR");
break;
}
@ -1947,18 +1753,12 @@ s48_value odbc_sql_disconnect(s48_value conn_handle)
switch (retval)
{
case SQL_SUCCESS:
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
{
return S48_TRUE;
}
case SQL_SUCCESS_WITH_INFO:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
return S48_TRUE;
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(SQL_HANDLE_DBC, ch);
ODBC_RAISE_EXCEPTION("SQLDisconnect returned SQL_ERROR");
break;
}
@ -1998,7 +1798,6 @@ s48_value odbc_sql_free_handle(s48_value handle_type, s48_value handle)
}
case SQL_ERROR:
{
ODBC_DEBUG_DIAGREC(ht, h);
ODBC_RAISE_EXCEPTION("SQLFreeHandle returned SQL_ERROR");
break;
}
@ -2009,7 +1808,6 @@ s48_value odbc_sql_free_handle(s48_value handle_type, s48_value handle)
}
default:
{
ODBC_DEBUG_DIAGREC(ht, h);
ODBC_RAISE_EXCEPTION("SQLFreeHandle returned unknown error code");
break;
}