Skip site navigation (1) Skip section navigation (2)

Re: binary cursor returning truncated data

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Eric Mauvière <e(dot)mauviere(at)geoclip(dot)fr>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: binary cursor returning truncated data
Date: 2006-04-16 16:39:32
Message-ID: 20060416163932.GA30082@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-php
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

In response to

Responses

pgsql-php by date

Next:From: Eric MauvièreDate: 2006-04-18 08:01:10
Subject: Re: binary cursor returning truncated data
Previous:From: Eric MauvièreDate: 2006-04-12 14:21:49
Subject: binary cursor returning truncated data

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group