pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Eric Mauvière <e.mauviere@geoclip.fr>
Cc: pgsql-php@postgresql.org
Subject: Re: binary cursor returning truncated data
Date: Sun, 16 Apr 2006 10:39:32 -0600
Message-ID: <20060416163932.GA30082@winnie.fuhr.org> (raw)
In-Reply-To: <020401c65e3c$70721050$0200a8c0@EMC3>
References: <020401c65e3c$70721050$0200a8c0@EMC3>

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



view thread (7+ messages)  latest in thread

Message-ID: <20060416163932.GA30082@winnie.fuhr.org>
Permalink:  ../20060416163932.GA30082@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20060416163932.GA30082@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: mike@fuhr.org, e.mauviere@geoclip.fr
  Subject: Re: binary cursor returning truncated data
  In-Reply-To: <20060416163932.GA30082@winnie.fuhr.org>
  References: <020401c65e3c$70721050$0200a8c0@EMC3> <20060416163932.GA30082@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox