Was a Result Set Created?
In such cases, the application calls SQLNumResultCols to determine the number of columns in the result set. If this is 0, the
statement did not create a result set; if it is any other number, the statement did
create a result set.
The application can call SQLNumResultCols at any time after the statement is prepared or executed. However, because
some data sources cannot easily describe the result sets that will be created by
prepared statements, performance will suffer if SQLNumResultCols is called after a statement is prepared, but before it is executed.
Some data sources also support determining the number of rows that an SQL
statement returns in a result set. To do so, the application calls SQLRowCount. Exactly what the row count represents is indicated by the setting of the
SQL_DYNAMIC_CURSOR_ATTRIBUTES2, SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2,
SQL_KEYSET_CURSOR_ATTRIBUTES2, or SQL_STATIC_CURSOR_ATTRIBUTES2 option (depending on the
type of the cursor) returned by a call to SQLGetInfo. This bitmask indicates for each cursor type whether the row count returned
is exact or approximate, or is not available at all. Whether row counts for
static or keyset-driven cursors are affected by changes made through SQLBulkOperations or SQLSetPos, or by positioned update or delete statements, depends upon other bits
returned by the same option arguments listed previously. For more information, see
the SQLGetInfo function description.