+ query WKB in platform native format

This commit is contained in:
Artem Pavlenko 2009-06-29 14:31:39 +00:00
parent 15569af061
commit 597889261b

View file

@ -31,6 +31,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/tokenizer.hpp>
#include <boost/detail/endian.hpp>
// stl
#include <string>
@ -39,6 +40,11 @@
#include <sstream>
#include <iomanip>
#ifndef BOOST_BIG_ENDIAN
#define WKB_ENCODING "NDR"
#else
#define WKB_ENCODING "XDR"
#endif
DATASOURCE_PLUGIN(postgis_datasource)
@ -277,7 +283,7 @@ featureset_ptr postgis_datasource::features(const query& q) const
PoolGuard<shared_ptr<Connection>,shared_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool);
std::ostringstream s;
s << "SELECT AsBinary(\""<<geometryColumn_<<"\",'ndr') AS geom";
s << "SELECT AsBinary(\""<<geometryColumn_<<"\",'"<< WKB_ENCODING << "') AS geom";
std::set<std::string> const& props=q.property_names();
std::set<std::string>::const_iterator pos=props.begin();
std::set<std::string>::const_iterator end=props.end();
@ -314,7 +320,7 @@ featureset_ptr postgis_datasource::features_at_point(coord2d const& pt) const
PoolGuard<shared_ptr<Connection>,shared_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool);
std::ostringstream s;
s << "SELECT AsBinary(\"" << geometryColumn_ << "\",'ndr') AS geom";
s << "SELECT AsBinary(\"" << geometryColumn_ << "\",'"<< WKB_ENCODING << "') AS geom";
std::vector<attribute_descriptor>::const_iterator itr = desc_.get_descriptors().begin();
std::vector<attribute_descriptor>::const_iterator end = desc_.get_descriptors().end();