Re: Handling of large objects in DBD::Pg? (fwd)

From: <garth(at)salon(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Handling of large objects in DBD::Pg? (fwd)
Date: 2001-02-23 22:42:06
Message-ID: Pine.LNX.4.30.0102231434490.30639-200000@pippin.salon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Attached are large object read and write functions I wrote based on
information I gleened from the DBD::Pg install test script.
They read and write to buffers rather than files because my
information wasn't comming from a file and wasn't going to one. However
if you need the data to go to a file you can either open a file handle
yourself in these methods and read into a scalar or write out from one, OR
you can scan the test.pl file in the DBD::Pg install to see how to use the
proper file based read and write Pg calls.

M. Tavasti <tawz(at)nic(dot)fi> wrote:
>
> How do I handle large objects in DBD:Pg (perl DBI interface to
> postgresql)?
>
> I've tried to do like this, but not successfull, it looks like there
> is no data inserted. I tried to see in psql is there something, doing
> SELECT lo_export(data,"/tmp/foofaa.txt") from foofaa where id=XXXX;
>
> $obj_ins = $dbh->prepare(q{
> INSERT INTO foofaa
> (id,entry,data)
> VALUES
> (?,?,?)});
>
> $obj = $dbh->func("./$dir/obj.txt", 'lo_import');
> $obj_ins->execute($id,$ent,$obj);
>
>
>
>
> Manual page of DBD:Pg if confusing for lo_export:
>
> $ret = $dbh->func($lobjId, 'lo_export');
>
> Exports a large object into a Unix file. Returns
> false upon failure, true otherwise.
>
> To what file....
>
> Any help welcome.
>
>

Attachment Content-Type Size
lotest.pl text/plain 1.7 KB

Browse pgsql-general by date

  From Date Subject
Next Message Sipos Andras 2001-02-23 22:52:17 Encoding: LATIN2 (hungary)
Previous Message Adam Kornick 2001-02-23 22:05:51 vecor/list INSERT or UPDATE