Skip to Content.
Sympa Menu

freetds - RE: [RE: [freetds] Moving the resultset pointer]

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Thompson, Bill D (London)" <bill_d_thompson AT ml.com>
  • To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [RE: [freetds] Moving the resultset pointer]
  • Date: Tue, 6 Jan 2004 09:06:39 -0000

Hi all,

Let me explain the state of play with server side cursors in FreeTDS.

Support for Server side cursors was not included in the earliest versions of
the TDS protocol, and has only been available in later versions.
Sybase and Microsoft have independently built support for server side
cursors into TDS 5.0 (Sybase) and TDS 7.0/8.0 (MS).
Their implementations are radically different however.

The TDS 5.0 implementation involves a new group of TDS messages which are
documented in the TDS 5.0 specification.
The TDS 7.0/8.0 implementation involves a number of "pseudo system stored
procedures" ( e.g. sp_cursoropen, sp_cursorfetch ) .
Although these are not publicly documented, I have a fairly thorough
understanding of them.

In FreeTDS 0.62 is a first-cut implementation of server side cursors.
This implements the necessary code to allow a cursor to be declared, opened,
fetched from, and closed.
The only API which has been upgraded to support these cursors is ct-library,
and there are large caveats surrounding this.

Currently, forward-only / read-only cursors are supported.
Currently, we do not support other concurrent database interactions
alongside cursors.

There is still a good deal of work to be done to fully implement cursors,
but much of the groundwork is done.

The most difficult remaining work involves us being able to handle multiple
concurrent result sets.
I have a first cut patch for this, but I was going to wait until 0.62 was
bedded in before unleashing it on an unsuspecting world!

Once this is done, support for the different types of cursor (random access,
backward, etc.) is relatively trivial.

I imagine that fitting cursors into the ODBC code may be a substantial piece
of work, that could perhaps follow.


HTH,

Bill




> -----Original Message-----
> From: brian AT bruns.com [SMTP:brian AT bruns.com]
> Sent: 06 January 2004 05:57
> To: freetds AT lists.ibiblio.org
> Subject: Re: [RE: [freetds] Moving the resultset pointer]
>
> Anyone interested in tackling this might want to look
> at the row buffering code in dblib. anything functions
> with buffer_...() should be pretty adaptable to being
> moved into the libtds area and used for both libraries.
>
> One big limitation is you have to set the size of the
> row buffer. I'm not sure how well this meshes with
> ODBC, but perhaps someone with a bit more knowledge
> could enlighten me. Also this is client side cursors
> only, I have no idea how server side cursor
> would/should work.
>
> Brian
>
> On Mon, 05 Jan 2004 23:59:27 -0500, Steven Orton wrote:
>
> >
> >
> > oh man....that is unfortunate :( it would make my
> > life a hell of a lot
> > easier if i could get a multirow resultset and
> > basically search through the
> > same set multiple times. so basically, if i want to
> > search through the set
> > again, i have to dump the old and get a new? i guess
> > that's why the big boys
> > are getting buku $$$$$, ehhh?
> > i really would be out of my league if I tried to add
> > cursor support. maybe
> > something to shoot for in 1.0 ;)
> >
> > thanks for the quick reply....steve---
> >
> >
> > "Lowden, James K" <LowdenJK AT bernstein.com> wrote:
> >
> > > > From: Steven Orton [mailto:sorton9999 AT usa.net]
> > > > Sent: January 5, 2004 4:55 PM
> > > >
> > > > I have a technical question that pertains to
> > random access
> > > > of the rows in a multirow resultset.
> > > > First of all I am using
> freeTDS-0.62.dev.20031218
> > with the
> > > > 0.2.3 version of
> > > > ODBC++ (freeodbc) and using TDSVER=7.0 on a RH9.0
> > client getting at a
> > > > SQLServer 7.0 DB.
> > > ..
> > > > My question is, Can one create a random access
> > multirow
> > > > resultset using the
> > > > TDS API.
> > >
> > > I don't think it is. You seem to have pointed up a
> > bug in our
> > > documentation: our api_status.txt file (and new User
> > Guide) indicates
> > > SQLFetchScroll is "OK", but the source code
> disagrees:
> > >
> > > SQLRETURN SQL_API
> > > SQLFetchScroll(SQLHSTMT hstmt, SQLSMALLINT
> > FetchOrientation, SQLINTEGER
> > > FetchOffset)
> > > {
> > > INIT_HSTMT;
> > >
> > > /* still we do not support cursors and
> > scrolling */
> > > if (FetchOrientation != SQL_FETCH_NEXT) {
> > > odbc_errs_add(&stmt->errs, "HY106",
> > NULL, NULL);
> > > ODBC_RETURN(stmt, SQL_ERROR);
> > > }
> > >
> > > ODBC_RETURN(stmt, _SQLFetch(stmt));
> > > }
> > >
> > > In this case, I'd believe the source code. :-(
> > >
> > > You don't get a "HY106" error somewhere along the
> > line?
> > >
> > > > If that IS possible, I can try to update my
> ODBC++
> > > > library (since I
> > > > think this is a unsupported library at present).
> > >
> > > Only because no one's stepped up to it. There seem
> > to be a few people
> > > interested in ODBC++; all that remains is for a
> > knowledgeable someone to
> > > write up how to hook it up to FreeTDS.
> > >
> > > --jkl
> > >
> > >
> > > -----------------------------------------
> > > The information contained in this transmission may
> > contain privileged and
> > confidential information and is intended only for the
> > use of the person(s)
> > named above. If you are not the intended recipient, or
> > an employee or agent
> > responsible for delivering this message to the
> intended
> > recipient, any review,
> > dissemination, distribution or duplication of this
> > communication is strictly
> > prohibited. If you are not the intended recipient,
> > please contact the sender
> > immediately by reply e-mail and destroy all copies of
> > the original message.
> > Please note that we do not accept account orders
> and/or
> > instructions by
> > e-mail, and therefore will not be responsible for
> > carrying out such orders
> > and/or instructions.
> > >
> > >
> > > _______________________________________________
> > > FreeTDS mailing list
> > > FreeTDS AT lists.ibiblio.org
> > > http://lists.ibiblio.org/mailman/listinfo/freetds
> > >
> >
> >
> >
> > -------------------------------
> > Steven Orton
> > sorton9999 AT usa.net
> > --
> > "Put your hand on a hot stove for a minute,
> > and it seems like an hour.
> > Sit with a pretty girl for an hour, and it
> > seems like a minute. THAT'S relativity."
> > -- Albert Einstein
> > -------------------------------
> >
> >
> > _______________________________________________
> > FreeTDS mailing list
> > FreeTDS AT lists.ibiblio.org
> > http://lists.ibiblio.org/mailman/listinfo/freetds
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds





Archive powered by MHonArc 2.6.24.

Top of Page