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

From: Peter T Mount <peter(at)retep(dot)org(dot)uk>
To: Reto Gmuer <gmuer(at)netiquette(dot)ch>
Cc: pgsql-interfaces(at)hub(dot)org
Subject: Re: [INTERFACES] Re: pgsql-interfaces-digest V1 #208
Date: 1999-02-01 13:32:47
Message-ID: Pine.LNX.4.04.9902011248300.3631-100000@maidast.retep.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)retep(dot)org(dot)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

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter T Mount 1999-02-01 13:46:01 Re: ResultSet.getDate
Previous Message Gregory W Burnham 1999-02-01 13:28:12 Re: [INTERFACES] Large objects, why not use the filesystem?