lo_export

From: Luke <luke(at)chipcity(dot)com(dot)au>
To: pgsql-general(at)postgresql(dot)org
Subject: lo_export
Date: 2001-10-12 07:11:51
Message-ID: 3BC697B7.2EE1CA5B@chipcity.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message J C Lawrence 2001-10-12 08:18:23 COMMIT after an ERROR?
Previous Message William Winter 2001-10-12 03:29:04 Newbie