i am using postgres 7.0.3
and also postgres 7.2.1
I am new towards using blobs,I want to transfers
records with blobs from a table to different
database(postgr es) using
perl without extracting the blob to disk(i.e without
using lo_export/lo_import).
Below is my perl script which is not working can
anybody help in this.
$rest = $conn->exec("begin" );
$stmt="select * from image ;";
$result = $conn->exec($stmt);
if ( $result->resultStatus ne PGRES_TUPLES_OK )
{
die $conn->errorMessage unless PGRES_TUPLES_OK eq
$result->resultStatus ;
}
$n=$result->ntuples;
print "\n Number of Processes Scheduled $n \n";
while ( @row=$result->fetchrow)
{
$fld=$row[0];
$fd=Pg::lo_open ($conn,$fld,"r" );
if ( $fd )
{
$buf="";
Pg::lo_read($co nn,$fd,$buf,200 00);
}
Pg::lo_close($c onn,$fd);
$foid=Pg::lo_cr eat($conn,"w");
$fdw=Pg::lo_ope n($conn,$foid," w");
Pg::lo_write($c onn,$fdw,$buf,2 0000);
Pg::lo_close($c onn,$foid);
$stmt="insert into photo values($foid)";
$resi = $conn->exec($stmt);
if ( $resi->resultStatus ne PGRES_COMMAND_O K )
{
die $conn->errorMessage unless PGRES_TUPLES_OK eq
$resi->resultStatus ;
}
}
$rest = $conn->exec("end");
_______________ _______________ ____
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)