Re: Handling Blobs with libpq

From: "Reid Thompson" <Reid(dot)Thompson(at)ateb(dot)com>
To: "PostgreSQL-general" <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: Handling Blobs with libpq
Date: 2003-03-20 17:03:48
Message-ID: 64AE3D5B518E3648ACC823FBCB0B7375B6CD80@sr002-2kexc.ateb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'd be appreciative if someone could give or point me to a working example of storing/retrieving images via bytea.

--
thanks,
reid

-----Original Message-----
From: Doug McNaught [mailto:doug(at)mcnaught(dot)org]
Sent: Thursday, March 20, 2003 11:50 AM
To: Stéphane Pinel
Cc: PostgreSQL-general
Subject: Re: [GENERAL] Handling Blobs with libpq

Stéphane Pinel <spinel(at)noos(dot)fr> writes:

> What is the best approach to handle blobs with libpq ?
>
> I've read in documentation that there are 2 ways:
>
> 1- Bytea
> 2- Larges objects (lo_import)
>
> My main need is storing pictures (like Jpegs etc) or small blobs. Doc
> says that (2) is more appropriate but I need to work with blobs in
> memory, not from files.

You don't have to use lo_import()--you can write from memory to a large object using lo_write(), and read an LO (or part of one) into memory using lo_read(). See the documentation.

-Doug

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo(at)postgresql(dot)org so that your message can get through to the mailing list cleanly

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Fernando Papa 2003-03-20 17:41:03 Re: using arrays as variable, not as field
Previous Message Tom Lane 2003-03-20 16:56:59 Re: using arrays as variable, not as field