X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 07A3152892 for ; Wed, 18 May 2005 19:36:57 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96806-03 for ; Wed, 18 May 2005 22:36:51 +0000 (GMT) Received: from mx5.net.nih.gov (mailfwd.nih.gov [165.112.130.36]) by svr1.postgresql.org (Postfix) with ESMTP id 9799F5288B for ; Wed, 18 May 2005 19:36:48 -0300 (ADT) Received: from mx5.net.nih.gov (localhost [127.0.0.1]) by mx5.net.nih.gov (8.12.10/8.11.6) with ESMTP id j4IMaoaq008602 for ; Wed, 18 May 2005 18:36:51 -0400 Received: from [128.231.145.14] (holmes.nhgri.nih.gov [128.231.145.14]) by mx5.net.nih.gov (8.12.10/8.11.6) with ESMTP id j4IMaoKd008599 for ; Wed, 18 May 2005 18:36:50 -0400 Mime-Version: 1.0 (Apple Message framework v622) Content-Transfer-Encoding: 7bit Message-Id: <9ba996673af22c512313dc025914263a@mail.nih.gov> Content-Type: text/plain; charset=US-ASCII; format=flowed To: pgsql-interfaces From: Sean Davis Subject: perl and large objects Date: Wed, 18 May 2005 18:36:50 -0400 X-Mailer: Apple Mail (2.622) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/39 X-Sequence-Number: 5542 I am new to large objects and have a simple test script that dies (at the lo_import line) and I don't know why (no descriptive error given). Any suggestions (or a quick tutorial)? The DBD manual just wasn't quite enough for me, I guess. Thanks, Sean #!/usr/bin/perl use strict; use DBI; my $dbh = DBI->connect('dbi:Pg:dbname=test2', undef, undef, {AutoCommit=>1},) || die $@; $dbh->{AutoCommit}=0; my $lobjID = $dbh->func("./out.png",'lo_import') || die $DBI::errstr; print $lobjID . "\n"; my $sth=$dbh->prepare('insert into lo_store (obj) values (?)'); $sth->execute($lobjID); $dbh->commit(); $dbh->func($lobjID,"./lo.pl.copy",'lo_export') || die $@; $dbh->commit();