lo_export - Mailing list pgsql-general

From Luke
Subject lo_export
Date
Msg-id 3BC697B7.2EE1CA5B@chipcity.com.au
Whole thread Raw
List pgsql-general
Hi,

I want to extract images from a database.
I am currently trying to use the following script
The point is if I get more than 1 image returned, how can I write it to
different output files.
As you can see, I've tried using '$dbh->func'


use DBI;
$dbh = DBI->connect("dbi:Pg:dbname=luke") or die $DBI::errstr;

#the next statement gets the objectID, which I have called imagename.

$qry = "select imagename from images where date='7/10/01'";
$sth = $dbh->prepare($qry);
$sth->execute();

$rec_num = 0;
print "\nResults of query are: \n";

#in the next statement I want to print each returned image to a
different filename,
#but I can't get func to work here at all
#any suggestions?


while (@array = $sth->fetchrow)
{
($imageName) = @array;
$rec_num = $rec_num + 1;
print "RECORD $rec_num\n";
print "  Name: $imageName\n";
$fileName = "/home/httpd/html/outimage.jpg";
$ret = $dbh->func($imageName, 'lo_export', $fileName);
}


print "\n--------------------------------------------------\n";

Luke


pgsql-general by date:

Previous
From: Henning Follmann
Date:
Subject: Re: Embedded postgres ?
Next
From: Hans-Juergen Schoenig
Date:
Subject: PostgreSQL and OpenOffice