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

This commit is contained in:
Dane Springmeyer 2011-07-12 01:48:36 +00:00
parent 560f5718c3
commit 3d862034cd
2 changed files with 11 additions and 2 deletions

View file

@ -106,8 +106,10 @@ struct equals
bool operator() (value_null, value_null) const 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 struct not_equals
@ -143,18 +145,21 @@ struct not_equals
bool operator() (value_null, value_null) const bool operator() (value_null, value_null) const
{ {
// TODO - needs review http://trac.mapnik.org/ticket/794
return false; return false;
} }
template <typename T> template <typename T>
bool operator() (value_null, const T &) const bool operator() (value_null, const T &) const
{ {
// TODO - needs review http://trac.mapnik.org/ticket/794
return false; return false;
} }
template <typename T> template <typename T>
bool operator() (const T &, value_null) const bool operator() (const T &, value_null) const
{ {
// TODO - needs review http://trac.mapnik.org/ticket/794
return false; return false;
} }
}; };

View file

@ -108,7 +108,11 @@ feature_ptr postgis_featureset::next()
{ {
std::string name = rs_->getFieldName(pos); 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); const char* buf = rs_->getValue(pos);
int oid = rs_->getTypeOID(pos); int oid = rs_->getTypeOID(pos);