Re: [INTERFACES] Q on JDBC's resultset - Mailing list pgsql-jdbc

From Peter T Mount
Subject Re: [INTERFACES] Q on JDBC's resultset
Date
Msg-id 981454871.3a7fd017dc11f@webmail.retep.org.uk
Whole thread Raw
List pgsql-jdbc
Quoting Kovacs Baldvin <kb136@hszk.bme.hu>:

Redirecting to the JDBC list.

> Hello.
>
> I looked in the source and have the feeling that if I
> execute a SELECT statement, the whole resultset comes through
> the network in one large bundle.
>
> Is it true?

Currently yes (although the same goes for other interfaces as well).

> It means that I cannot enable to use simple tablemodel and
> table on top of an sql query, since it would be too slow to
> download all of the data when opening it.

Work in progress, may get into 7.1 if time allows. Basically the idea is to
have an optional ResultSet that implements the retrieve using a cursor.

>
> Anyway, how does the backend handles this? If I execute a query,
> it copies the result immediately to a separate place?? So for
> a SELECT *... query on a 2GB table results immediately in the
> occupance of an pther two gigs?

Possibly, although it may be inteligent enough to handle it differently
(somebody correct me here).

> Lastly, does anyone plans to work on updatable cursors? I think
> that would make possibel to create read/write tablemodels in
> Java.

7.1 has the beginings of an UpdateableResultSet. When I can work out how to
solve a few fundamental problems it shouldn't take long.

Here's a few questions for people to see if they can figure it out:

* How to detect what table a column belongs so. Required if the query was a
join of 2 or more tables.

* How to detect if the query was on a view. Do we support updateable view's?
(not tried it myself).

* How to detect if a column was a computed value (ie count(*) or col1+col2 etc).

There's probably more, but I can't think of them at the moment.

> p.s.: Does anyone knows if mysql supports updatable queries and
> complete jdbc?

Not sure about updateable queries, but there are not many drivers that support
the complete jdbc.

PS: Updateable ResultSet's are not actually required for JDBC Compliance.
Technically if the database or driver cannot support it, it is supposed to
though an SQLException (and also say so in DatabaseMetaData methods) that it
doesn't support it.

That's why there are methods in DatabaseMetaData that currently return false
because we don't support it (yet).

ie: DatabaseMetaData.supportsPositionedUpdate()
    DatabaseMetaData.supportsSelectForUpdate()

Technically (by the specs) you should check DatabaseMetaData first to see if a
feature is implemented, and then your code should handle either senario.

Were more compliant than most of the others ;-)

Peter

--
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/

pgsql-jdbc by date:

Previous
From: Peter T Mount
Date:
Subject: RE: [GENERAL] GIS-type databases using PostgreSQL
Next
From: Pete Forman
Date:
Subject: Archives of this list