X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (mx2.hub.org [200.46.204.254]) by postgresql.org (Postfix) with ESMTP id F25B611F7AF3 for ; Tue, 18 Apr 2006 05:24:45 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: -2.599 X-Spam-Level: X-Spam-Status: No, score=-2.599 required=5 tests=[BAYES_00=-2.599] Received: from postgresql.org ([200.46.204.71]) by localhost (mx2.hub.org [200.46.204.254]) (amavisd-new, port 10024) with ESMTP id abBCKtTfjEKk for ; Tue, 18 Apr 2006 05:24:36 -0300 (ADT) X-Greylist: delayed 00:23:09.911319 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 4B7F711F76EA for ; Tue, 18 Apr 2006 05:24:28 -0300 (ADT) Received: from smtp9.wanadoo.fr (smtp9.wanadoo.fr [193.252.22.22]) by svr4.postgresql.org (Postfix) with ESMTP id E71DF5AF836 for ; Tue, 18 Apr 2006 08:01:19 +0000 (GMT) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf0909.wanadoo.fr (SMTP Server) with ESMTP id A16A52400114 for ; Tue, 18 Apr 2006 10:01:16 +0200 (CEST) Received: from EMC3 (AToulouse-152-1-74-109.w83-200.abo.wanadoo.fr [83.200.174.109]) by mwinf0909.wanadoo.fr (SMTP Server) with SMTP id 69AF12400102 for ; Tue, 18 Apr 2006 10:01:16 +0200 (CEST) X-ME-UUID: 20060418080116433.69AF12400102@mwinf0909.wanadoo.fr Message-ID: <015501c662be$419d6460$0200a8c0@EMC3> From: =?iso-8859-1?Q?Eric_Mauvi=E8re?= To: References: <020401c65e3c$70721050$0200a8c0@EMC3> <20060416163932.GA30082@winnie.fuhr.org> Subject: Re: binary cursor returning truncated data Date: Tue, 18 Apr 2006 10:01:10 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2670 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 X-Archive-Number: 200604/11 X-Sequence-Number: 3481 Thank you Michael, for that confirmation I reported the bug to the PHP team, and they issued a patch. I would also suggest to postgres developpers to simplify their code and go back to SQL standards :) That BINARY CURSOR thing should be avoided. With MySQL for instance, a cursor will read the same way any type of data, binary or text. Best regards, Eric Mauvière ----- Original Message ----- From: "Michael Fuhr" To: "Eric Mauvière" Cc: Sent: Sunday, April 16, 2006 6:39 PM Subject: Re: [PHP] binary cursor returning truncated data > 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 > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > >