Subject Re: [Firebird-Java] Re: JDBC
Author Paul Schmidt
On Wed, 2003-07-30 at 08:46, Robert Rylly wrote:
> Does anyone have the code to navigate through record sets is JDBC does not
> allow cursor positioning?
>
> How do you move previous, next, first, last, etc...l?
>

There are a couple of ways, first you could use a large array, storing
the primary key of each record as you scan that record, but this could
take a lot of time, and waste a lot of storage space.

Second fake it, on one project I used ORDER BY to do this, to get the
last record append ASC or DESC onto the end of the select, and it reads
the records in reverse, simply get the next record to get the previous
record when going in reverse. Use a flag to determine if you are going
forward or reverse in your client software. Use the primary key, as the
starting point when changing directions.

For efficiency, you could then add a descending index on the primary
key, and let the server decide which one it wants to use.

PaulS














> Thanks in advance.
>
>
> >From: "Roman Rokytskyy" <rrokytskyy@...>
> >Reply-To: Firebird-Java@yahoogroups.com
> >To: Firebird-Java@yahoogroups.com
> >Subject: [Firebird-Java] Re: JDBC
> >Date: Sun, 27 Jul 2003 18:34:17 -0000
> >
> >Hi,
> >
> > > Can anyone tell me if JDBC for Firebird will allow cursor positioning
> > > yet?
> >
> >No, because server does not support this.
> >
> > > If not, how do you navigate the data?
> >
> >You don't. SQL is about manipulating a data sets. If we take the idea
> >to the extreem, ORDER BY should be disabled, because it breaks the
> >concept. :) SQL client executes a query and fetches the set of data
> >back to the client. There you can do with data everything you like:
> >scroll, sort, etc.
> >
> >This is not convenient for some applications and scrollable cursors
> >would be of great help. Unfortunatelly server does not provide this
> >functionality. Delphi users have libraries that emulate such
> >functionality on the client side, but nobody implemented this for JDBC
> >yet.
> >
> >Best regards,
> >Roman Rokytskyy
> >
>
> _________________________________________________________________
> MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
> http://join.msn.com/?page=features/virus
>
>
>
> To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>