[gdal-dev] Distinguish between empty result and error with
OGRDataSource::ExecuteSQL
Frank Warmerdam
warmerdam at pobox.com
Wed Oct 26 12:59:38 EDT 2011
On Wed, Oct 26, 2011 at 9:39 AM, Dan Homerick <danhomerick at gmail.com> wrote:
> The OGRDataSource documentation
> (http://www.gdal.org/ogr/classOGRDataSource.html#a6acc228db6513784a56ce12334a8c33)
> states that NULL is returned for statements "that have no results
> set", which is subtly different than what I initially claimed, "if the
> statement result is just empty" -- in practice, I think that a result
> set with no columns comes back as NULL (e.g. from an INSERT
> statement), but I think one that has no rows will come back as an
> empty OGRLayer.
Dan,
OK, from my point of view then things are working as intended.
I did note that the code returns NULL for special pseudo statements
like DROP TABLE and CREATE INDEX in the OGR SQL case.
Basically any operation that would never return a resultset returns
NULL.
> I think I'd mildly prefer something like an INSERT to return an empty
> OGRLayer, but the current implementation doesn't appear to be a bug. I
> should probably mention that I don't have much experience with
> databases, so I don't have any sense of what's standard as far as
> results from non-query statements.
I am hesitant to encourage this in part because creating an OGRLayer
is not necessarily a trivial expense.
> Should I still open a ticket?
It seems like things are working as intended from my point of view
so I'm not encouraging the opening of a ticket now.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Software Developer
More information about the gdal-dev
mailing list