pg.ddx.io pgsql-interfaces@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: James Orr <james@lrgmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: bytea on windows perl client
Date: Wed, 17 Jul 2002 13:00:00 -0400
Message-ID: <200207171300.01423.james@lrgmail.com> (raw)
In-Reply-To: <14471.1026922139@sss.pgh.pa.us>
References: <200207171201.25600.james@lrgmail.com>
<14471.1026922139@sss.pgh.pa.us>
Hi Tom,
On Wednesday 17 July 2002 12:08 pm, Tom Lane wrote:
> James Orr <james@lrgmail.com> writes:
> > I have some code which runs fine on linux. It simply pulls a png from a
> > bytea column and displays it.
> >
> > Now I need to get it running on windows. We have installed ActiveState
> > perl with the DBI module and downloaded and installed the DBD-Pg binary.
> > Connections to the database are working fine, but the png file is getting
> > corrupted.
> >
> > Anybody know the work-around?
>
> I'd bet money that the problem is a newline conversion issue --- you
> could check by noticing whether the PNG signature (first 8 bytes of the
> file) comes back correctly or not. The signature is designed to get
> changed if it's fed through any of the standard kinds of newline
> conversion (\n -> \r\n, for example).
OK, if I load the output into vi. The one from linux contains a bunch of
control characters etc. The one from windows seems to be all text like so
...
\211PNG\015\012\000 and so on.
Here is my actual perl script:
#! /usr/bin/perl -w
use DBI;
require 'common.pl';
my $dbh; initdb(\$dbh);
# Get the logos
my $image_sth = $dbh->prepare("SELECT logo FROM logos ORDER BY random() LIMIT
1");
$image_sth->execute();
my $image = $image_sth->fetchall_arrayref->[0]->[0];
$image_sth->finish();
$dbh->disconnect();
print "Content-type: image/png\n\n";
print $image;
exit;
view thread (10+ messages) latest in thread
Message-ID: <200207171300.01423.james@lrgmail.com> Permalink: ../200207171300.01423.james@lrgmail.com/ Also on: postgresql.org/message-id/200207171300.01423.james@lrgmail.com ·
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 using the --to and --cc options: reply via email To: pgsql-interfaces@postgresql.org Cc: james@lrgmail.com, tgl@sss.pgh.pa.us Subject: Re: bytea on windows perl client In-Reply-To: <200207171300.01423.james@lrgmail.com> * 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