diff -c psqlodbc.orig\options.c psqlodbc\options.c *** psqlodbc.orig\options.c Wed Nov 30 13:44:27 2005 --- psqlodbc\options.c Thu Jan 26 22:42:12 2006 *************** *** 314,320 **** RETCODE SQL_API PGAPI_SetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, ! SQLUINTEGER vParam) { CSTR func = "PGAPI_SetConnectOption"; ConnectionClass *conn = (ConnectionClass *) hdbc; --- 314,320 ---- RETCODE SQL_API PGAPI_SetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, ! SQLPOINTER vParam) { CSTR func = "PGAPI_SetConnectOption"; ConnectionClass *conn = (ConnectionClass *) hdbc; *************** *** 322,328 **** RETCODE retval; int i; ! mylog("%s: entering fOption = %d vParam = %d\n", func, fOption, vParam); if (!conn) { CC_log_error(func, "", NULL); --- 322,328 ---- RETCODE retval; int i; ! mylog("%s: entering fOption = %d vParam = %d\n", func, fOption, (unsigned long) vParam); if (!conn) { CC_log_error(func, "", NULL); *************** *** 353,366 **** for (i = 0; i < conn->num_stmts; i++) { if (conn->stmts[i]) ! set_statement_option(NULL, conn->stmts[i], fOption, vParam); } /* * Become the default for all future statements on this * connection */ ! retval = set_statement_option(conn, NULL, fOption, vParam); if (retval == SQL_SUCCESS_WITH_INFO) changed = TRUE; --- 353,366 ---- for (i = 0; i < conn->num_stmts; i++) { if (conn->stmts[i]) ! set_statement_option(NULL, conn->stmts[i], fOption, (UDWORD) ((unsigned long) vParam)); } /* * Become the default for all future statements on this * connection */ ! retval = set_statement_option(conn, NULL, fOption, (UDWORD) ((unsigned long) vParam)); if (retval == SQL_SUCCESS_WITH_INFO) changed = TRUE; *************** *** 377,392 **** break; case SQL_AUTOCOMMIT: ! if (vParam == SQL_AUTOCOMMIT_ON && CC_is_in_autocommit(conn)) break; ! else if (vParam == SQL_AUTOCOMMIT_OFF && !CC_is_in_autocommit(conn)) break; if (CC_is_in_trans(conn)) CC_commit(conn); ! mylog("PGAPI_SetConnectOption: AUTOCOMMIT: transact_status=%d, vparam=%d\n", conn->transact_status, vParam); ! switch (vParam) { case SQL_AUTOCOMMIT_OFF: CC_set_autocommit_off(conn); --- 377,392 ---- break; case SQL_AUTOCOMMIT: ! if (vParam == (SQLPOINTER) SQL_AUTOCOMMIT_ON && CC_is_in_autocommit(conn)) break; ! else if (vParam == (SQLPOINTER) SQL_AUTOCOMMIT_OFF && !CC_is_in_autocommit(conn)) break; if (CC_is_in_trans(conn)) CC_commit(conn); ! mylog("PGAPI_SetConnectOption: AUTOCOMMIT: transact_status=%d, vparam=%d\n", conn->transact_status, (SQLUINTEGER) ((unsigned long) vParam)); ! switch ((unsigned long) vParam) { case SQL_AUTOCOMMIT_OFF: CC_set_autocommit_off(conn); *************** *** 423,431 **** CC_log_error(func, "", conn); return SQL_ERROR; } ! if (conn->isolation == vParam) break; ! switch (vParam) { case SQL_TXN_SERIALIZABLE: if (PG_VERSION_GE(conn, 6.5) && --- 423,431 ---- CC_log_error(func, "", conn); return SQL_ERROR; } ! if ((SQLPOINTER) conn->isolation == vParam) break; ! switch ((unsigned long) vParam) { case SQL_TXN_SERIALIZABLE: if (PG_VERSION_GE(conn, 6.5) && *************** *** 450,456 **** char *query; QResultClass *res; ! if (vParam == SQL_TXN_SERIALIZABLE) query = "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE"; else query = "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED"; --- 450,456 ---- char *query; QResultClass *res; ! if (vParam == (SQLPOINTER) SQL_TXN_SERIALIZABLE) query = "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE"; else query = "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED"; *************** *** 458,464 **** if (!res || !QR_command_maybe_successful(res)) retval = SQL_ERROR; else ! conn->isolation = vParam; if (res) QR_Destructor(res); if (SQL_ERROR == retval) --- 458,464 ---- if (!res || !QR_command_maybe_successful(res)) retval = SQL_ERROR; else ! conn->isolation = (SQLUINTEGER) ((unsigned long) vParam); if (res) QR_Destructor(res); if (SQL_ERROR == retval) *************** *** 483,489 **** char option[64]; CC_set_error(conn, CONN_UNSUPPORTED_OPTION, "Unknown connect option (Set)"); ! sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam); if (fOption == 30002 && vParam) { int cmp; --- 483,489 ---- char option[64]; CC_set_error(conn, CONN_UNSUPPORTED_OPTION, "Unknown connect option (Set)"); ! sprintf(option, "fOption=%d, vParam=%ld", fOption, (unsigned long) vParam); if (fOption == 30002 && vParam) { int cmp; diff -c psqlodbc.orig\pgapi30.c psqlodbc\pgapi30.c *** psqlodbc.orig\pgapi30.c Thu Jan 26 22:22:51 2006 --- psqlodbc\pgapi30.c Thu Jan 26 22:43:36 2006 *************** *** 1556,1562 **** CC_set_error(conn, STMT_OPTION_NOT_FOR_THE_DRIVER, "Unsupported connect attribute (Set)"); return SQL_ERROR; default: ! ret = PGAPI_SetConnectOption(ConnectionHandle, (UWORD) Attribute, (UDWORD) ((unsigned long) Value)); } return ret; } --- 1556,1562 ---- CC_set_error(conn, STMT_OPTION_NOT_FOR_THE_DRIVER, "Unsupported connect attribute (Set)"); return SQL_ERROR; default: ! ret = PGAPI_SetConnectOption(ConnectionHandle, (UWORD) Attribute, Value); } return ret; } *************** *** 1833,1839 **** } conn = SC_get_conn(s->stmt); if (s->auto_commit_needed) ! PGAPI_SetConnectOption(conn, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_ON); irdflds = SC_get_IRDF(s->stmt); if (irdflds->rowsFetched) *(irdflds->rowsFetched) = s->processed; --- 1833,1839 ---- } conn = SC_get_conn(s->stmt); if (s->auto_commit_needed) ! PGAPI_SetConnectOption(conn, SQL_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_ON); irdflds = SC_get_IRDF(s->stmt); if (irdflds->rowsFetched) *(irdflds->rowsFetched) = s->processed; *************** *** 1863,1869 **** { conn = SC_get_conn(s.stmt); if (s.auto_commit_needed = (char) CC_is_in_autocommit(conn), s.auto_commit_needed) ! PGAPI_SetConnectOption(conn, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); } if (SQL_ADD != s.operation) { --- 1863,1869 ---- { conn = SC_get_conn(s.stmt); if (s.auto_commit_needed = (char) CC_is_in_autocommit(conn), s.auto_commit_needed) ! PGAPI_SetConnectOption(conn, SQL_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_OFF); } if (SQL_ADD != s.operation) { diff -c psqlodbc.orig\pgapifunc.h psqlodbc\pgapifunc.h *** psqlodbc.orig\pgapifunc.h Wed Nov 30 13:44:30 2005 --- psqlodbc\pgapifunc.h Thu Jan 26 22:42:08 2006 *************** *** 143,149 **** SQLINTEGER *pcrow); RETCODE SQL_API PGAPI_SetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, ! SQLUINTEGER vParam); RETCODE SQL_API PGAPI_SetCursorName(HSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength); RETCODE SQL_API PGAPI_SetParam(HSTMT StatementHandle, --- 143,149 ---- SQLINTEGER *pcrow); RETCODE SQL_API PGAPI_SetConnectOption(HDBC hdbc, SQLUSMALLINT fOption, ! SQLPOINTER vParam); RETCODE SQL_API PGAPI_SetCursorName(HSTMT StatementHandle, SQLCHAR *CursorName, SQLSMALLINT NameLength); RETCODE SQL_API PGAPI_SetParam(HSTMT StatementHandle, diff -c psqlodbc.orig\results.c psqlodbc\results.c *** psqlodbc.orig\results.c Thu Jan 26 22:22:51 2006 --- psqlodbc\results.c Thu Jan 26 22:43:33 2006 *************** *** 3020,3026 **** if (SQL_ERROR == ret) CC_abort(conn); if (s->auto_commit_needed) ! PGAPI_SetConnectOption(conn, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_ON); if (s->irow > 0) { if (SQL_ADD != s->fOption && s->ridx >= 0) /* for SQLGetData */ --- 3020,3026 ---- if (SQL_ERROR == ret) CC_abort(conn); if (s->auto_commit_needed) ! PGAPI_SetConnectOption(conn, SQL_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_ON); if (s->irow > 0) { if (SQL_ADD != s->fOption && s->ridx >= 0) /* for SQLGetData */ *************** *** 3126,3132 **** case SQL_DELETE: case SQL_ADD: if (s.auto_commit_needed = CC_is_in_autocommit(conn), s.auto_commit_needed) ! PGAPI_SetConnectOption(conn, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF); break; } #endif /* DRIVER_CURSOR_IMPLEMENT */ --- 3126,3132 ---- case SQL_DELETE: case SQL_ADD: if (s.auto_commit_needed = CC_is_in_autocommit(conn), s.auto_commit_needed) ! PGAPI_SetConnectOption(conn, SQL_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_OFF); break; } #endif /* DRIVER_CURSOR_IMPLEMENT */ *************** *** 3187,3193 **** if (SQL_ERROR == ret) CC_abort(conn); if (auto_commit_needed) ! PGAPI_SetConnectOption(conn, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_ON); if (irow > 0) { if (SQL_ADD != fOption && ridx >= 0) /* for SQLGetData */ --- 3187,3193 ---- if (SQL_ERROR == ret) CC_abort(conn); if (auto_commit_needed) ! PGAPI_SetConnectOption(conn, SQL_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_ON); if (irow > 0) { if (SQL_ADD != fOption && ridx >= 0) /* for SQLGetData */