Re: blobs and small binary objects - Mailing list pgsql-interfaces

From Robert B. Easter
Subject Re: blobs and small binary objects
Date
Msg-id 0101241913120H.08820@comptechnews
Whole thread Raw
In response to blobs and small binary objects  ("David Wall" <d.wall@computer.org>)
List pgsql-interfaces
The documentation at www.postgresql.org talks about Large Objects.  Large 
Objects in postgres are not like other data types.  They are like files 
identified by an OID number instead of a file pointer.  Postgres has a set of 
functions that more or less mirror C file IO functions.  Instead of a file 
pointer, you use the OID of the large object with these functions.  When you 
use the function to create a large object, it returns an OID that you use 
from then on to work with it. If you read the docs, an OID is a hidden field 
in every record in all tables and is created automatically by the database.  
Just about every data item created in the database gets an OID number that 
identifies it.

If you are working with JDBC, it has javadoc documentation.  I have it on my 
website:

http://localhost/~reaster/pg_jdbc/
http://localhost/~reaster/pg_jdbc/org/postgresql/largeobject/LargeObjectManager.html

The LargeObjectManager has the functions needed to get started.  Notice how 
the functions take an int OID.  A LargeObject has a function getOID() so you 
can get it when you need to.  To construct a PGBlob object, you need this 
OID. Postgres doesn't actually have SQL BLOB or CLOB datatypes.  The postgres 
JDBC PBblob just implements the JDBC blob interface but it uses the postgres 
large object functions internally.  I guess you can try to make your code 
more portable if you create PGblobs and use that interface in your code.  
When the real BLOB datatype is available, maybe less will have to be changed 
in your code that way.


On Tuesday 23 January 2001 13:56, David Wall wrote:
> I'm new to Postgresql and am trying to figure out how I'd store
> Serializable objects, byte arrays and potentially large binary objects. 
> JDBC has APIs for getObject(), getBytes() and getBlob(), but how do I
> define those attributes inside a table?  I don't see the typical BYTE or
> BINARY or BLOB types.
>
> I know that 7.0.3 still suffers from the 8K row limit, so I'd hope that the
> JDBC library would automatically handle this for me, if I define some small
> objects as byte arrays, and larger objects are blobs.  I saw somewhere a
> type BYTEA (byte array?), but I can't find it in the documentation to know
> if this is a real type, one of the user defined types that's a common
> extension, etc.
>
> Anybody handle these issues yet?
>
> Thanks,
> David

-- 
-------- Robert B. Easter  reaster@comptechnews.com ---------
-- CompTechNews Message Board http://www.comptechnews.com/ --
-- CompTechServ Tech Services http://www.comptechserv.com/ --
---------- http://www.comptechnews.com/~reaster/ ------------


pgsql-interfaces by date:

Previous
From: "Poul Kristensen"
Date:
Subject: Sv: Postgres ODBC
Next
From: "David Wall"
Date:
Subject: Re: blobs and small binary objects