X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9FFA4D1B1DF for ; Mon, 2 Aug 2004 20:35:30 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 74886-06 for ; Mon, 2 Aug 2004 23:35:25 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id DB724D1B183 for ; Mon, 2 Aug 2004 20:35:21 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i72NZK1O016573; Mon, 2 Aug 2004 19:35:20 -0400 (EDT) To: Brijesh Shrivastav Cc: pgsql-interfaces@postgresql.org Subject: Re: libpq binary transfer of the numeric data type - II In-reply-to: <491DC5F3D279CD4EB4B157DDD62237F404E27FE9@zipwire.esri.com> References: <491DC5F3D279CD4EB4B157DDD62237F404E27FE9@zipwire.esri.com> Comments: In-reply-to Brijesh Shrivastav message dated "Mon, 02 Aug 2004 14:43:50 -0700" Date: Mon, 02 Aug 2004 19:35:20 -0400 Message-ID: <16572.1091489720@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/2 X-Sequence-Number: 5050 Brijesh Shrivastav writes: > Has anyone had success with fetching numeric data in binary format? > I tried to follow Tom's advice below and try to reverse engineer from > recv/send function. It seemes the end structure that user will > get is of Numeric type (see struct below) No, it isn't. What you get is a series of int16 fields: pq_sendint(&buf, x.ndigits, sizeof(int16)); pq_sendint(&buf, x.weight, sizeof(int16)); pq_sendint(&buf, x.sign, sizeof(int16)); pq_sendint(&buf, x.dscale, sizeof(int16)); for (i = 0; i < x.ndigits; i++) pq_sendint(&buf, x.digits[i], sizeof(NumericDigit)); Note that the "digits" are base-10000 digits. regards, tom lane