X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6261B11F66F8 for ; Sun, 16 Apr 2006 13:39:42 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0.132 X-Spam-Level: X-Spam-Status: No, score=0.132 required=5 tests=[AWL=0.132] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id riswRC5fOCYm for ; Sun, 16 Apr 2006 13:39:39 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 16B4E11F66EC for ; Sun, 16 Apr 2006 13:39:39 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id k3GGdYfB042024 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 16 Apr 2006 10:39:36 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id k3GGdXh0033601; Sun, 16 Apr 2006 10:39:33 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id k3GGdWFa033600; Sun, 16 Apr 2006 10:39:32 -0600 (MDT) (envelope-from mfuhr) Date: Sun, 16 Apr 2006 10:39:32 -0600 From: Michael Fuhr To: Eric =?iso-8859-1?Q?Mauvi=E8re?= Cc: pgsql-php@postgresql.org Subject: Re: binary cursor returning truncated data Message-ID: <20060416163932.GA30082@winnie.fuhr.org> References: <020401c65e3c$70721050$0200a8c0@EMC3> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <020401c65e3c$70721050$0200a8c0@EMC3> X-Archive-Number: 200604/9 X-Sequence-Number: 3479 On Wed, Apr 12, 2006 at 04:21:49PM +0200, Eric Mauvire wrote: > i am trying to retrieve binary content of a bytea field (or postgis > geometry field) with a binary cursor with PHP : > > $sql="BEGIN;DECLARE mycursor BINARY CURSOR FOR SELECT shape FROM $layerName; fetch all in mycursor;" > ....pg_query... > > But my shape field shows only two bytes of data. The PHP source code (ext/pgsql/pgsql.c) doesn't have any calls to PQfformat or PQbinaryTuples so PHP appears to expect text data. Looks like you'll have to fetch data in text format and use pg_unescape_bytea. Maybe the PHP developers would consider adding support for binary data (or maybe they already have and rejected the idea; I don't know). Try asking on a PHP mailing list. -- Michael Fuhr