[freetds] Supporting fast forward-only cursors?

Sebastien FLAESCH sf at 4js.com
Thu Jan 10 08:57:06 EST 2008


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

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

With SQL_NONSCROLLABLE / SQL_SENSITIVE:

@p5=4
@p6=4

Tested with SQL Server 2005 ...

Thanks!
Seb



More information about the FreeTDS mailing list