Type A and Type B Statements

The SQL Server driver uses two types of statements — Type A and Type B.

A Type A statement is defined as any statement that uses the default setting for each of the following three statement options.

Option Default
SQL_CONCURRENCY SQL_CONCUR_READ_ONLY
SQL_CURSOR_TYPE SQL_CURSOR_FORWARD_ONLY
SQL_ROWSET_SIZE 1

Type A statements do not make use of server cursors. Instead the query is executed at the server and results sets are passed back to the application. The SQL Server driver allows you to perform SQLFetch and SQLExtendedFetch (you can change the rowset size after the cursor is open and perform block fetches) on this data, but the connection between the client and the server remains busy until all the data has been fetched (you have reached the end of the cursor) or the cursor is closed. This option is fast if you are going to retrieve all rows sequentially and you do not need to perform any updates. Because server cursors are not used, you cannot do positioned operations (using WHERE CURRENT OF) on Type A statements.

A Type B statement is defined as any statement that does not use the default settings for the above three statement options. Type B statements cause the driver to use server cursors in most cases (see the restrictions noted in "Creating Cursors," later in this chapter).