Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 8AF9064FD12 for ; Wed, 17 Sep 2008 07:24:05 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 43546-01 for ; Wed, 17 Sep 2008 07:23:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp239.poczta.interia.pl (smtp239.poczta.interia.pl [217.74.64.239]) by postgresql.org (Postfix) with ESMTP id 2679164FCCA for ; Wed, 17 Sep 2008 07:23:56 -0300 (ADT) Received: by smtp239.poczta.interia.pl (INTERIA.PL, from userid 502) id 780733D4E73; Wed, 17 Sep 2008 12:23:49 +0200 (CEST) Received: from f32.poczta.interia.pl (f32.poczta.interia.pl [10.217.2.32]) by smtp239.poczta.interia.pl (INTERIA.PL) with ESMTP id 14E6C3D4D79 for ; Wed, 17 Sep 2008 12:23:48 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by f32.poczta.interia.pl (Postfix) with ESMTP id 82AB016004F for ; Wed, 17 Sep 2008 12:23:47 +0200 (CEST) Date: 17 Sep 2008 12:23:47 +0200 From: Marcin Ligorowski Subject: Problem with using SOCK_put_int method PGAPI_PutData To: pgsql-odbc@postgresql.org MIME-Version: 1.0 Content-Type: TEXT/plain; CHARSET=ISO-8859-2 Content-Transfer-Encoding: QUOTED-PRINTABLE X-ORIGINATE-IP: 139.181.124.2 IMPORTANCE: Normal X-MSMAIL-PRIORITY: Normal X-PRIORITY: 3 X-Mailer: PSE3 Message-Id: <20080917102348.82AB016004F@f32.poczta.interia.pl> X-EMID: 6af40acc X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=MISSING_MIMEOLE=0.001 X-Spam-Level: X-Archive-Number: 200809/16 X-Sequence-Number: 9609 Hi,=0AI%u2019ve detected problem with using psqlodbc driver on Sun Sparc So= laris platform. =0AAn error occurs when Sparc converts unsigned short to un= signed int and back to unsigned short.=0AWith 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.=0AProblem occurs every time when through method SOC= K_put_int two bytes integer was transferred and doesn%u2019t allow using PG= API_PutData (odbc_lo_write) to put large objects to database.=0A=0ATo resol= ve described problem I%u2019ve attached patch bellow.=0A=0ARegards=0AMarcin= =0A=0A--- 769,793 ----=0Avoid =0A SOCK_put_int(SocketClass *self, int valu= e, short len)=0A {=0A if (!self)=0A return;=0A switch (= len)=0A {=0A case 2:=0A+ {=0A+ unsigned s= hort rv;=0A rv =3D self->reverse ? value : htons((unsigned sho= rt) value);=0A SOCK_put_n_char(self, (char *) &rv, 2);=0A = return;=0A+ }=0A=0A case 4:=0A+ {=0A+ = unsigned int rv;=0A rv =3D self->reverse ? value : h= tonl((unsigned int) value);=0A SOCK_put_n_char(self, (char *) = &rv, 4);=0A return;=0A+ }=0A=0A default:=0A = SOCK_set_error(self, SOCKET_PUT_INT_WRONG_LENGTH, "Cannot write in= ts of that length");=0A=0A=0A ---------------------------------------------------------------------- Dzwon taniej na zagraniczne komorki! Sprawdz >> http://link.interia.pl/f1f0e