X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7CC0CD1B440 for ; Fri, 28 Nov 2003 11:20:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 09750-09 for ; Fri, 28 Nov 2003 07:19:46 -0400 (AST) Received: from web40209.mail.yahoo.com (web40209.mail.yahoo.com [66.218.78.70]) by svr1.postgresql.org (Postfix) with SMTP id 0C0FDD1B438 for ; Fri, 28 Nov 2003 07:19:43 -0400 (AST) Message-ID: <20031128111944.79948.qmail@web40209.mail.yahoo.com> Received: from [61.1.74.250] by web40209.mail.yahoo.com via HTTP; Fri, 28 Nov 2003 03:19:44 PST Date: Fri, 28 Nov 2003 03:19:44 -0800 (PST) From: omkar prabhu Subject: help transfer ring blobs using perl To: pgsql-interfaces@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.2 tagged_above=0.0 required=5.0 tests=BAYES_30, RCVD_IN_RFCI X-Spam-Level: X-Archive-Number: 200311/42 X-Sequence-Number: 4600 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(postgres) 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($conn,$fd,$buf,20000); } Pg::lo_close($conn,$fd); $foid=Pg::lo_creat($conn,"w"); $fdw=Pg::lo_open($conn,$foid,"w"); Pg::lo_write($conn,$fdw,$buf,20000); Pg::lo_close($conn,$foid); $stmt="insert into photo values($foid)"; $resi = $conn->exec($stmt); if ( $resi->resultStatus ne PGRES_COMMAND_OK ) { 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/