[gdal-dev] Distinguish between empty result and error with OGRDataSource::ExecuteSQL

Dan Homerick danhomerick at gmail.com
Tue Oct 25 19:50:48 EDT 2011


GDAL-Dev,

The ExecuteSQL method returns NULL when an error occurs, or if the
statement result is just empty. I don't see any methods to get
information on the last error, which leaves me wondering if there's a
good way to distinguish the different causes for a NULL result.

I've been prototyping using MS SQL Server, and it looks like the
OGRODBCDataSource has a public getSession method (returning a
CPLODBCSession), that I could use to get error information -- although
this method is commented as being for internal use. Is there a better
route, ideally one that is sure to be supported for all the various
SQL drivers?

Thanks for any guidance,
 - Dan


More information about the gdal-dev mailing list