How to determine if an SQL statement returns columns

I am writing code that can execute SQL queries through ODBC.

To do this, I run SQLExecDirect() , then SQLExtendedFetch() to get the result columns.

However, expressions such as INSERT , UPDATE , etc., do not have return columns, and SQLExtendedFetch ends with an error code.

The question arises: how to determine from a query if this type of query has return columns or not?

Edit : Forget that for queries that should not have return columns, SQLGetDiagRec () returns an empty error message (I'v checked it for MS SQL driver).

+4
source share
1 answer

Call SQLNumResultCols, and if it says 0, you don't have a result set.

+2
source

All Articles