pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matt Lilley <matt.lilley@securitease.com>
To: pgsql-odbc@postgresql.org
Subject: FORMAT_INTEGER is wrong on (some) 64 bit platforms?
Date: Wed, 24 Jul 2013 06:32:49 +1200
Message-ID: <51EECC51.9040504@securitease.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

Hello,

I'm trying to understand the logic in psqlodbc.h where if the size of a 
long int is not 8 that FORMAT_INTEGER is set to "%ld". I can't find any 
definitive documentation, but I gather from various forum posts that the 
size of SQL_C_LONG is always intended to be 4 bytes, independent of the 
host architecture. (This exact issue was first reported 9 years ago, it 
seems [1]). I don't think it should matter what size long int is on the 
host: surely it should only matter what the type being passed into 
SQLBindParameter is given as, since the data is packed by the caller, 
not the callee. My initial instinct was just to change the macro from 
"%ld" to "%d" (and similarly, "%lu" to "%u" for FORMAT_UINTEGER), but 
since there is quite a bit of code in there trying to make sense of it, 
I thought I'd check here.

FWIW, I got here by trying to bind an integer column to -1 and getting 
an out-of-range error, just like Kelly in [1]. Changing the %ld -> %d 
fixes the symptoms for me. Is there any reason this can't be fixed?

Regards,
Matt

[1] http://www.postgresql.org/message-id/4224F80D.2080103@kkcsm.net

-- 
_____________________________________________
Matt Lilley
Software Engineer
SecuritEase

Tel:    +64 4 912-2100
Fax:    +64 4 912-2101
E-mail: matt.lilley@securitease.com
Web:    http://www.securitease.com
_____________________________________________

This e-mail has passed our content security scan.
It is covered by the confidentiality clauses at http://www.securitease.com/content_and_confidentiality



-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



view thread (4+ messages)  latest in thread

Message-ID: <51EECC51.9040504@securitease.com>
Permalink:  ../51EECC51.9040504@securitease.com/
Also on:    postgresql.org/message-id/51EECC51.9040504@securitease.com

 · 

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: matt.lilley@securitease.com
  Subject: Re: FORMAT_INTEGER is wrong on (some) 64 bit platforms?
  In-Reply-To: <51EECC51.9040504@securitease.com>
  References: <51EECC51.9040504@securitease.com>

* 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