From 3d862034cdff3fde03c1bca90ce95a9505d6c04d Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 12 Jul 2011 01:48:36 +0000 Subject: [PATCH] allow '[field] is null' syntax to work with the understanding this may have unintended consequences and we should likely ultimately replace with proper 'is' equality support for nulls - track issue at http://trac.mapnik.org/ticket/794 --- include/mapnik/value.hpp | 7 ++++++- plugins/input/postgis/postgis_featureset.cpp | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/mapnik/value.hpp b/include/mapnik/value.hpp index 9870581a7..95943a165 100644 --- a/include/mapnik/value.hpp +++ b/include/mapnik/value.hpp @@ -106,8 +106,10 @@ struct equals bool operator() (value_null, value_null) const { - return false; + // this changed from false to true - see http://trac.mapnik.org/ticket/794 + return true; } + }; struct not_equals @@ -143,18 +145,21 @@ struct not_equals bool operator() (value_null, value_null) const { + // TODO - needs review http://trac.mapnik.org/ticket/794 return false; } template bool operator() (value_null, const T &) const { + // TODO - needs review http://trac.mapnik.org/ticket/794 return false; } template bool operator() (const T &, value_null) const { + // TODO - needs review http://trac.mapnik.org/ticket/794 return false; } }; diff --git a/plugins/input/postgis/postgis_featureset.cpp b/plugins/input/postgis/postgis_featureset.cpp index de86ab9ae..78c085759 100644 --- a/plugins/input/postgis/postgis_featureset.cpp +++ b/plugins/input/postgis/postgis_featureset.cpp @@ -108,7 +108,11 @@ feature_ptr postgis_featureset::next() { std::string name = rs_->getFieldName(pos); - if (!rs_->isNull(pos)) + if (rs_->isNull(pos)) + { + boost::put(*feature,name,mapnik::value_null()); + } + else { const char* buf = rs_->getValue(pos); int oid = rs_->getTypeOID(pos);