pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alain Picard <Alain.Picard@memetrics.com>
To: Hiroshi Inoue <Inoue@tpf.co.jp>
Cc: Alain Picard <Alain.Picard@memetrics.com>
Cc: pgsql-odbc@postgresql.org
Subject: Re: unixODBC, PostgreSQL 7.3 + ODBC V3 drivers?
Date: Wed, 5 Feb 2003 14:10:41 +1100 (EST)
Message-ID: <15936.32945.34098.651127@outback.memetrics.local> (raw)
In-Reply-To: <3E40697F.646ACF10@tpf.co.jp>
References: <15935.11848.278897.343335@outback.memetrics.local>
	<3E3F8C0B.C6E195DA@tpf.co.jp>
	<15936.16797.475953.234542@outback.memetrics.local>
	<3E405CB2.6163F291@tpf.co.jp>
	<15936.26434.443355.676365@outback.memetrics.local>
	<3E40697F.646ACF10@tpf.co.jp>

>>>>> Hiroshi Inoue writes:

Hiroshi> I've just committed a change(odbcapi.c) to cvs. 
Hiroshi> Please try.

Hiroshi, it works like a charm.  There's still a bug remaining,
however, when connecting to a postgresql 7.3 back end; it's
not handling the BIGINTs properly.  Here is a patch, for convert.c.

You need to remove the #ifdef WIN32 in the code below, because
we now want to execute this code on unix as well:

#if (ODBCVER >= 0x0300) && defined(ODBCINT64)
/* #ifdef WIN32 */
			case SQL_C_SBIGINT:
				len = 8;
				if (bind_size > 0)
					*(SQLBIGINT *) ((char *) rgbValue + (bind_row * bind_size)) = _atoi64(neut_str);
				else
					*((SQLBIGINT *) rgbValue + bind_row) = _atoi64(neut_str);
				break;

			case SQL_C_UBIGINT:
				len = 8;
				if (bind_size > 0)
					*(SQLUBIGINT *) ((char *) rgbValue + (bind_row * bind_size)) = _atoi64(neut_str);
				else
					*((SQLUBIGINT *) rgbValue + bind_row) = _atoi64(neut_str);
				break;

/* #endif */ /* WIN32 */
#endif /* ODBCINT64 */

And then you need to add

#ifndef WIN32
#define _atoi64 atoll
#endif

somewhere at the top of that file because _atoi64 doesn't exist under linux.
If you're not using GCC, or are on a system which doesn't support
`atoll', this will break; you can adjust the #define dance as you wish
to support other platforms, if you know how they behave.  (I don't).

Also, the code above seems to be wrong for SQL_C_UBIGINT; I doubt that
_atoi64 (or atoll) will return an unsigned long long for a number
above 2^63.

Thank you so much for your _invaluable_ help.

--
			Alain Picard
			Memetrics



view thread (10+ messages)  latest in thread

Message-ID: <15936.32945.34098.651127@outback.memetrics.local>
Permalink:  ../15936.32945.34098.651127@outback.memetrics.local/
Also on:    postgresql.org/message-id/15936.32945.34098.651127@outback.memetrics.local

 · 

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: Alain.Picard@memetrics.com, Inoue@tpf.co.jp
  Subject: Re: unixODBC, PostgreSQL 7.3 + ODBC V3 drivers?
  In-Reply-To: <15936.32945.34098.651127@outback.memetrics.local>
  References: <15935.11848.278897.343335@outback.memetrics.local> <3E3F8C0B.C6E195DA@tpf.co.jp> <15936.16797.475953.234542@outback.memetrics.local> <3E405CB2.6163F291@tpf.co.jp> <15936.26434.443355.676365@outback.memetrics.local> <3E40697F.646ACF10@tpf.co.jp> <15936.32945.34098.651127@outback.memetrics.local>

* 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