From 581bb23b97cb9eb547974e2ba5bebc5ce2961226 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Thu, 30 Jun 2005 09:30:38 +0000 Subject: [PATCH] According to MSDN docs for SQLSetStmtAttr, if you try to request a cursor type which isn't supported, the driver should fall back to a supported type, set an appropriate SQLState and return SQL_SUCCESS_WITH_INFO. Currently, if a SQL_ATTR_CURSOR_TYPE of SQL_CURSOR_DYNAMIC is requested, we fall back to SQL_CURSOR_FORWARD_ONLY and no warning is given; this is simply because we don't explicitly check for SQL_CURSOR_DYNAMIC. A better solution is to check for SQL_CURSOR_DYNAMIC, fall back to SQL_CURSOR_KEYSET_DRIVEN and set a warning accordingly. Also, currently if SQL_CURSOR_KEYSET_DRIVEN is requested and only static cursors are supported, we fall back without returning a warning. [Mark G. Adams] --- options.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/options.c b/options.c index 9b6e12f..7875c63 100644 --- a/options.c +++ b/options.c @@ -111,7 +111,18 @@ set_statement_option(ConnectionClass *conn, if (ci->updatable_cursors) setval = vParam; else + { + changed = TRUE; setval = SQL_CURSOR_STATIC; /* at least scrollable */ + } + } + else if (SQL_CURSOR_DYNAMIC == vParam) + { + changed = TRUE; + if (ci->updatable_cursors) + setval = SQL_CURSOR_KEYSET_DRIVEN; + else + setval = SQL_CURSOR_STATIC; } if (conn) conn->stmtOptions.cursor_type = setval; -- 2.39.5