X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6B1859DC814 for ; Fri, 27 Jan 2006 04:25:51 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75960-05 for ; Fri, 27 Jan 2006 04:25:51 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.pzkagis.cz (gis6.netbox.cz [83.240.30.214]) by postgresql.org (Postfix) with ESMTP id 369909DCA28 for ; Fri, 27 Jan 2006 04:25:45 -0400 (AST) Received: from soptik.pzkagis.cz (localhost.localdomain [127.0.0.1]) by smtp.pzkagis.cz (8.13.1/8.13.1) with ESMTP id k0R8PfA3017250; Fri, 27 Jan 2006 09:25:41 +0100 Received: (from luf@localhost) by soptik.pzkagis.cz (8.13.1/8.13.1/Submit) id k0R8PeTe017249; Fri, 27 Jan 2006 09:25:40 +0100 Date: Fri, 27 Jan 2006 09:25:40 +0100 From: Ludek Finstrle To: Dave Page Cc: Tom Lane , pgsql-odbc@postgresql.org Subject: Re: Odbcapi30.c - 64 bit compiler warning cleanup Message-ID: <20060127082540.GA17230@soptik.pzkagis.cz> References: <20060126183725.GA11754@soptik.pzkagis.cz> <20060126205813.GA12369@soptik.pzkagis.cz> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="AhhlLboLdkugWU4S" Content-Disposition: inline In-Reply-To: <20060126205813.GA12369@soptik.pzkagis.cz> User-Agent: Mutt/1.4.1i X-Virus-Scanned: ClamAV version 0.87.1, clamav-milter version 0.87 on smtp.pzkagis.cz X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.086 required=5 tests=[AWL=0.086, UPPERCASE_25_50=0] X-Spam-Score: 0.086 X-Spam-Level: X-Archive-Number: 200601/261 X-Sequence-Number: 7076 --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > > > The spec actually says it should be a SQLPOINTER. Changing to that > > > unleashes a whole barrel of extra fun unfortunately. > > > > I don't think it will be so problematic. I'll try it. It's the best way > > to support Win64. > > Here is my result. Patch attached. I have no 64-bit box ready at hand here. > I will test it on 64-bit box tomorrow. I find one problem. New patch attached. I get no warning with this one. Please review and comment Luf --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="psqlodbc-64bit_SetConnectOption.diff" diff -c psqlodbc.orig/options.c psqlodbc/options.c *** psqlodbc.orig/options.c 2005-11-25 11:43:25.000000000 +0100 --- psqlodbc/options.c 2006-01-27 12:18:27.000000000 +0100 *************** *** 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 (conn->isolation == (unsigned long) 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/pgapifunc.h psqlodbc/pgapifunc.h *** psqlodbc.orig/pgapifunc.h 2005-11-25 11:43:25.000000000 +0100 --- psqlodbc/pgapifunc.h 2006-01-27 12:16:05.000000000 +0100 *************** *** 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/pgapi30.c psqlodbc/pgapi30.c *** psqlodbc.orig/pgapi30.c 2005-12-02 12:00:43.000000000 +0100 --- psqlodbc/pgapi30.c 2006-01-27 12:15:55.000000000 +0100 *************** *** 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/results.c psqlodbc/results.c *** psqlodbc.orig/results.c 2005-12-08 10:11:28.000000000 +0100 --- psqlodbc/results.c 2006-01-27 12:16:15.000000000 +0100 *************** *** 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 */ *************** *** 3125,3131 **** 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 */ --- 3125,3131 ---- 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 */ *************** *** 3186,3192 **** 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 */ --- 3186,3192 ---- 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 */ --AhhlLboLdkugWU4S--