Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 4C4E79FBF81; Tue, 15 May 2007 20:13:52 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 92615-02; Tue, 15 May 2007 20:13:48 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 678519FBF7E; Tue, 15 May 2007 20:13:48 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from syd.object-craft.com.au (ppp167-236-184.static.internode.on.net [59.167.236.184]) by svr4.postgresql.org (Postfix) with ESMTP id 106D25AF02C; Tue, 15 May 2007 23:13:46 +0000 (GMT) Received: by longblack.object-craft.com.au (Postfix, from userid 1000) id B9FDF5CC4B5; Wed, 16 May 2007 09:13:42 +1000 (EST) Received: from longblack (localhost [127.0.0.1]) by longblack.object-craft.com.au (Postfix) with ESMTP id 803116EC007; Wed, 16 May 2007 09:13:42 +1000 (EST) To: Michael Meskes Cc: PostgreSQL Interfaces Subject: Re: PQexecParams question In-reply-to: <20070515124419.GA31566@feivel.credativ.de> References: <20070515124419.GA31566@feivel.credativ.de> Comments: In-reply-to Michael Meskes message dated "Tue, 15 May 2007 14:44:19 +0200." Date: Wed, 16 May 2007 09:13:42 +1000 From: Andrew McNamara Message-Id: <20070515231342.B9FDF5CC4B5@longblack.object-craft.com.au> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/31 X-Sequence-Number: 6538 >I declare a binary cursor using PQexecParams, which of course works >nicely and then fetch data from it. I'm not able to tell whether the >cursor is binary, unless I keep my own client side cursor list. So I >call PQexecParams with the fetch command without knowing that the >results are binary. Using the default values however all data is >returned in ascii. It appears you have to tell the fetch command to >return data in binary, or else it will return ascii, no matter how the >cursor was defined. In the documentation for the frontend/backend protocol, it says: Note: The choice between text and binary output is determined by the format codes given in Bind, regardless of the SQL command involved. The BINARY attribute in cursor declarations is irrelevant when using extended query protocol. http://www.postgresql.org/docs/8.2/static/protocol-flow.html PQexecParams does the Bind behind the scenes, the resultFormat parameter deciding whether you get binary or text. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/