pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Ludek Finstrle <luf@pzkagis.cz>
To: Dave Page <dpage@vale-housing.co.uk>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-odbc@postgresql.org
Subject: Re: Odbcapi30.c - 64 bit compiler warning cleanup
Date: Fri, 27 Jan 2006 09:25:40 +0100
Message-ID: <20060127082540.GA17230@soptik.pzkagis.cz> (raw )
In-Reply-To: <20060126205813.GA12369@soptik.pzkagis.cz >
References: <E7F85A1B5FF8D44C8A1AF6885BC9A0E40103DB66@ratbert.vale-housing.co.uk >
<20060126183725.GA11754@soptik.pzkagis.cz >
<20060126205813.GA12369@soptik.pzkagis.cz >
> > > 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
Attachments:
psqlodbc-64bit_SetConnectOption.diff (text/plain, 8.8K) download
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 */
view thread (26+ messages) latest in thread
Message-ID: <20060127082540.GA17230@soptik.pzkagis.cz>
Permalink: ../20060127082540.GA17230@soptik.pzkagis.cz/
Also on: postgresql.org/message-id/20060127082540.GA17230@soptik.pzkagis.cz
copy link · copy postgr.es · copy git am
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: luf@pzkagis.cz, dpage@vale-housing.co.uk, tgl@sss.pgh.pa.us
Subject: Re: Odbcapi30.c - 64 bit compiler warning cleanup
In-Reply-To: <20060127082540.GA17230@soptik.pzkagis.cz>
References: <E7F85A1B5FF8D44C8A1AF6885BC9A0E40103DB66@ratbert.vale-housing.co.uk> <20060126183725.GA11754@soptik.pzkagis.cz> <20060126205813.GA12369@soptik.pzkagis.cz> <20060127082540.GA17230@soptik.pzkagis.cz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox