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: "James K. Lowden" <jklowden AT schemamania.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [RE: [freetds] Moving the resultset pointer]
  • Date: Tue, 6 Jan 2004 01:34:49 -0500

On Mon, 05 Jan 2004, Steven Orton <sorton9999 AT usa.net> 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?

At the risk of making a virtue of necessity, can I offer some advice?
You're not so bad off as you think.

Database libraries include a lot of fanciness passed off as features, and
in fact to someone writing applications in C they must look pretty nice.
To someone writing applications in C, I guess flint and steel look pretty
advanced.

But you're using C++, which means you have STL, which is a far far better
thing than any ODBC cursor feature. You have to iterate over the result
set anyway, so why not store your rows as a std::set? Then you can pick
them out any way you like.

I never really learned how to program cursors and "for browse" operations.
In 10 years, I guess I've opened three cursors. Everytime I'm tempted, I
get bogged down in the unhealthy details, and find that a T-SQL loop or
STL container is really the better answer.

Define a class for your row, override operator[]() and operator<(), and
live longer. You and your code will be happier and better looking.

--jkl

> "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




Archive powered by MHonArc 2.6.24.

Top of Page