Re: [INTERFACES] Re: pgsql-interfaces-digest V1 #208 - Mailing list pgsql-interfaces

From Peter T Mount
Subject Re: [INTERFACES] Re: pgsql-interfaces-digest V1 #208
Date
Msg-id Pine.LNX.4.04.9902011248300.3631-100000@maidast.retep.org.uk
Whole thread Raw
In response to Re: [INTERFACES] Re: pgsql-interfaces-digest V1 #208  (Reto Gmuer <gmuer@netiquette.ch>)
List pgsql-interfaces
On Fri, 29 Jan 1999, Reto Gmuer wrote:

> I should put large (> 8K)  text field into the database, do I have to
> put these in fields of type oid using the "Postgres Extensions to the
> JDBC API". Does this work?

To put in any data >8K, you would need to use the LargeObject API.

On the standard JDBC front, there's two methods of handling this:

The first is using the ResultSet.getBytes() and
PreparedStatement.setBytes() methods. These return the _entire_ object in
one go. For small objects, this isn't too bad, but for large ones, this
will cause problems (both speed and memory).

The second is using Streams, and this is not currently implemented in an
efficient manner. The ResultSet.getBinaryStream() is implemented, and it
simply calls getBytes(), and creates a ByteArrayInputStream from the
object.

The PreparedStatement.setBinaryStream() methods are not implemented at
all.

Finally, the Ascii & Unicode stream methods simply pass through to the
BinaryStream methods.

The methods in the Extensions, ie the InputStream & OutputStream's on a
large object are intended to fill in the gaps. I'm hoping to have them
read small chunks of a LargeObject, and buffer them. Then, the stream
based methods in ResultSet and PreparedStatement would use them instead,
and this should improve efficiency with very large objects.

> Peter T Mount wrote:
>
> >
> > Reading from or writing to a large object using Streams are not yet
> > supported. It's one of the things I have on my list for 6.5.
> >
> > Peter
>
> --
> Reto Gmuer
> netiquette internet consulting, Zurich

--
       Peter T Mount peter@retep.org.uk
      Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
 Java PDF Generator: http://www.retep.org.uk/pdf


pgsql-interfaces by date:

Previous
From: Peter T Mount
Date:
Subject: Re: [INTERFACES] CREATE LANGUAGE 'Java'
Next
From: Peter T Mount
Date:
Subject: Re: [INTERFACES] Large objects, why not use the filesystem?