Check for null values in the PostGIS results and don't add attributes
with null values to the feature rather than adding a value based on decoding a buffer full of undefined data.
This commit is contained in:
parent
02962156c5
commit
13d32335e0
2 changed files with 52 additions and 43 deletions
|
@ -105,6 +105,9 @@ feature_ptr postgis_featureset::next()
|
||||||
for (unsigned pos=1;pos<num_attrs_+1;++pos)
|
for (unsigned pos=1;pos<num_attrs_+1;++pos)
|
||||||
{
|
{
|
||||||
std::string name = rs_->getFieldName(pos);
|
std::string name = rs_->getFieldName(pos);
|
||||||
|
|
||||||
|
if (!rs_->isNull(pos))
|
||||||
|
{
|
||||||
const char* buf=rs_->getValue(pos);
|
const char* buf=rs_->getValue(pos);
|
||||||
int oid = rs_->getTypeOID(pos);
|
int oid = rs_->getTypeOID(pos);
|
||||||
|
|
||||||
|
@ -158,6 +161,7 @@ feature_ptr postgis_featureset::next()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
++count_;
|
++count_;
|
||||||
return feature;
|
return feature;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,11 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isNull(int index) const
|
||||||
|
{
|
||||||
|
return PQgetisnull(res_,pos_,index);
|
||||||
|
}
|
||||||
|
|
||||||
const char* getValue(int index) const
|
const char* getValue(int index) const
|
||||||
{
|
{
|
||||||
return PQgetvalue(res_,pos_,index);
|
return PQgetvalue(res_,pos_,index);
|
||||||
|
|
Loading…
Reference in a new issue