From: Marcin Ligorowski <ligo@interia.pl>
To: pgsql-odbc@postgresql.org
Subject: Problem with using SOCK_put_int method PGAPI_PutData
Date: 17 Sep 2008 12:23:47 +0200
Message-ID: <20080917102348.82AB016004F@f32.poczta.interia.pl> (raw)
Hi,
I%u2019ve detected problem with using psqlodbc driver on Sun Sparc Solaris platform.
An error occurs when Sparc converts unsigned short to unsigned int and back to unsigned short.
With default implementation 00 00 01 02 is converted to 00 00 (last two bytes are skipped), but it should be converted to 01 and 02.
Problem occurs every time when through method SOCK_put_int two bytes integer was transferred and doesn%u2019t allow using PGAPI_PutData (odbc_lo_write) to put large objects to database.
To resolve described problem I%u2019ve attached patch bellow.
Regards
Marcin
--- 769,793 ----
void
SOCK_put_int(SocketClass *self, int value, short len)
{
if (!self)
return;
switch (len)
{
case 2:
+ {
+ unsigned short rv;
rv = self->reverse ? value : htons((unsigned short) value);
SOCK_put_n_char(self, (char *) &rv, 2);
return;
+ }
case 4:
+ {
+ unsigned int rv;
rv = self->reverse ? value : htonl((unsigned int) value);
SOCK_put_n_char(self, (char *) &rv, 4);
return;
+ }
default:
SOCK_set_error(self, SOCKET_PUT_INT_WRONG_LENGTH, "Cannot write ints of that length");
----------------------------------------------------------------------
Dzwon taniej na zagraniczne komorki!
Sprawdz >> http://link.interia.pl/f1f0e
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: ligo@interia.pl
Subject: Re: Problem with using SOCK_put_int method PGAPI_PutData
In-Reply-To: <20080917102348.82AB016004F@f32.poczta.interia.pl>
References: <20080917102348.82AB016004F@f32.poczta.interia.pl>
* 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