+ parameter to specify the query columns use when getting back geaometries:

useful when you have big tables and you don't want to query long fields (long varchar2, blobs, anydata, clobs) which may cause slowdowns
This commit is contained in:
Lucio Asnaghi 2010-11-18 14:02:09 +00:00
parent 20ffa2e7e6
commit 91fb08fbff
2 changed files with 3 additions and 1 deletions

View file

@ -73,6 +73,7 @@ occi_datasource::occi_datasource(parameters const& params, bool bind)
: datasource (params), : datasource (params),
type_(datasource::Vector), type_(datasource::Vector),
table_(*params_.get<std::string>("table","")), table_(*params_.get<std::string>("table","")),
fields_(*params_.get<std::string>("fields","*")),
geometry_field_(*params_.get<std::string>("geometry_field","")), geometry_field_(*params_.get<std::string>("geometry_field","")),
extent_initialized_(false), extent_initialized_(false),
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding","utf-8")), desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding","utf-8")),
@ -194,7 +195,7 @@ void occi_datasource::bind() const
// get columns description // get columns description
{ {
std::ostringstream s; std::ostringstream s;
s << "SELECT * FROM (" << table_name << ") WHERE rownum < 1"; s << "SELECT " fields_ << " FROM (" << table_name << ") WHERE rownum < 1";
try try
{ {

View file

@ -51,6 +51,7 @@ class occi_datasource : public mapnik::datasource
private: private:
int type_; int type_;
mutable std::string table_; mutable std::string table_;
mutable std::string fields_;
mutable std::string geometry_field_; mutable std::string geometry_field_;
mutable int srid_; mutable int srid_;
mutable bool extent_initialized_; mutable bool extent_initialized_;