Hiroshi Inoue wrote:
> Hello,
>
> I have a question.
>
> > -----Original Message-----
> > From: Byron Nikolaidis [mailto:byronn@insightdist.com]
> > Sent: Thursday, January 28, 1999 1:00 AM
> > To: Hiroshi Inoue
> > Cc: pgsql-interfaces
> > Subject: Re: [INTERFACES] Use Declare/Fetch option
> >
> >
> >
> >
> > Hiroshi Inoue wrote:
> >
> > > Hello all,
> > >
> > > I have a question about psqlodbc driver.
> > > Now the default setting for "Use Declare/Fetch" is false.
> > >
> > > In MVCC thanks to Vadim,readers block no writers.
> > > So we can change the [Use Declare/Fetch] option to true ?
> > > And if so,it's effective ?
> > >
> >
> > All you say is correct. It probably could go back to true. But I
> > think some people would probably prefer it stay false, because there is
> > more odbc functionality provided with this setting. For example, when
> > the option is false, the entire SQLExtendedFetch functionality is
> > supported (prev,first,last,next,absolute,relative,bookmark). When the
> > Declare/Fetch option is true, only fetch "next" is supported. There are
>
> Is there somthing wrong with the use "fetch backward" to support
> SQL_FETCH_PRIOR ?
>
I don't think the "fetch backward" works well enough to support FETCH_PRIOR.
We have experimented with it, and found it to be inconsistent at best,
especially when near the end of the result set. In fact, if you fetch past
the end of the result set, you can't even back up anyway! So there is no way
(that I know of) to do something like FETCH_LAST, and then do a FETCH_PRIOR,
because you are already in an bad state. There is also no good way of knowing
how many rows are in the result set, which makes it impossible to prevent
going off the end.
The cursor management in the backend needs to improve quite a bit. From what
I understand, it is rather inefficient as well, because when moving around,
the query is actually being re-executed each time. If it does not improve, I
think the driver would be the best place to manage the result set, and as I
said, in the future I would like to combine the two kinds of access into one,
perhaps even using both memory and file caching for large result sets.
Dave Hartwig has tried to fix the cursor management in the backend -- Maybe he
would like to chime in on this too.
Byron