[gdal-dev] Nullable fields in OGR

Jason Roberts jason.roberts at duke.edu
Thu Feb 18 12:37:04 EST 2010


Many relational databases allow fields to be set to NULL. Is this supported
in OGR? How does one detect whether a field is nullable or not?

 

Looking at the class documentation, I see functions OGRFeature::IsFieldSet
and OGRFeature::UnsetField. Are these intended for checking whether a field
is NULL and setting it to NULL? Or are they used for something else, such as
determining which fields have been modified by a caller prior to him calling
OGRLayer::SetFeature?

 

When I looked at OGRFieldDefn, I could not find a method that might be
intended for checking whether a field was nullable (e.g.
OGRFieldDefn::IsUnsettable).

 

A while back, Mateusz asked this:

 

> Yes. Also, most applications I've seen using OGR do define their own

> data models and translate OGRFeature to features of their own types.

> Perhaps it would be interesting to know why they don't use OGRFeature

> as a part of their data model, what's missing...

 

I am currently evaluating whether or not I should use OGRFeature directly in
a data model, or wrap it. Without nullability, I am probably inclined to
wrap it. As I have mentioned previously on gdal-dev, I'm trying to build
something that wraps OGR and ArcGIS APIs behind a common abstraction, to
allow development of tools that work with both. ArcGIS supports nullability
and it is useful in many situations, so I'd like to cleanly preserve it in
my abstraction, even if OGR does not presently support it.

 

Thanks for any thoughts you have,

 

Jason

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100218/4bf30985/attachment.html


More information about the gdal-dev mailing list