Skip to Content.
Sympa Menu

freetds - Re: [freetds] Supporting fast forward-only cursors?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Supporting fast forward-only cursors?
  • Date: Fri, 11 Jan 2008 11:49:24 +0100


>
> So far I have one remaining "FIXME" comment in my FreeTDS
> driver interface, regarding fast forward cursors...
>

I call it a TODO :)

> With the native MSSQL ODBC drivers, when you set:
>
> r = SQLSetStmtAttr(st->stmtHandle,
> SQL_SOPT_SS_CURSOR_OPTIONS, (SQLPOINTER) SQL_CO_FFO, SQL_IS_UINTEGER);
>
> You get fast forward-only cursors, as described in:
>
> http://msdn2.microsoft.com/en-us/library/aa172573.aspx
>
> Note this is a SQL Server 2000 feature...
>
> Other link:
>
> http://msdn2.microsoft.com/en-us/library/aa177106(SQL.80).aspx
>
> I was wondering how difficult it would be to support this
> MSSQL specific statement attribute...
>
> If it's just a matter of sp_cursoroption, then you should...
>
> Attached a sample (must compile with -D USE_FAST_FOWARD to
> use FFO cursor)
>
> I noticed that SQL Profiler should different values in the
> @p5 and @p6 parameters of the sp_cursorprepexec() call:
>
> With FFO:
>
> @p5=16
> @p6=1
>

See http://jtds.sourceforge.net/apiCursors.html

16 == Fast forward-only cursor
1 == Read-only

> With SQL_NONSCROLLABLE / SQL_SENSITIVE:
>
> @p5=4
> @p6=4
>

4 == Forward-only cursor
4 == Optimistic. Checks timestamps and, when not available, values.

> Tested with SQL Server 2005 ...
>
> Thanks!
> Seb

I think the better way is to try to enable FFO when needed but ignore
error... if supported you will gain network performance, if not it
works.

Another problem is how to define these constants. These constants are
not "open" that is are contained in copyrighted header (odbcss.h).
Should we extract constants with somethink like:

#include <odbcss.h>

#define STR(s) #s

void main()
{
printf("%s\n", STR(SQL_SOPT_SS_CURSOR_OPTIONS));
}

??

Having to enable explicitly these function make it do not break any
compatibility however I think it's better to posticipate this stuff.
Currently there are some issue I want to fix/workaround before release
- Mac OS X compile (quite easy)
- select(2) problem (I have a patch quite ready for net.c)
- wrong result SQLExecDirect with INSERT INTO and cursors (I'm not
really sure this is the real problem)
- HY008 on SQLCancel

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page