postgis/oracle: use mapnik::boolean type for 'estimate_extent' rather than std::string, and strip double quotes as the estimated_extent function operates on single quotes - improves upon #393

This commit is contained in:
Dane Springmeyer 2010-03-17 22:03:39 +00:00
parent 0ed2f6dc42
commit b1070d22c8
2 changed files with 8 additions and 8 deletions

View file

@ -297,9 +297,9 @@ box2d<double> occi_datasource::envelope() const
double lox, loy, hix, hiy;
occi_connection_ptr conn (pool_);
boost::optional<std::string> estimate_extent = params_.get<std::string>("estimate_extent");
boost::optional<mapnik::boolean> estimate_extent = params_.get<mapnik::boolean>("estimate_extent",false);
if (estimate_extent && *estimate_extent == "true")
if (estimate_extent && *estimate_extent)
{
std::ostringstream s;
s << "select min(c.x), min(c.y), max(c.x), max(c.y) from ";

View file

@ -556,7 +556,7 @@ box2d<double> postgis_datasource::envelope() const
{
PoolGuard<shared_ptr<Connection>,shared_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool);
std::ostringstream s;
boost::optional<std::string> estimate_extent = params_.get<std::string>("estimate_extent");
boost::optional<mapnik::boolean> estimate_extent = params_.get<mapnik::boolean>("estimate_extent",false);
if (!geometryColumn_.length() > 0)
{
@ -569,18 +569,18 @@ box2d<double> postgis_datasource::envelope() const
throw mapnik::datasource_exception(s_error.str());
}
if (estimate_extent && *estimate_extent == "true")
if (estimate_extent && *estimate_extent)
{
s << "select xmin(ext),ymin(ext),xmax(ext),ymax(ext)"
<< " from (select estimated_extent('";
if (schema_.length() > 0)
{
s << schema_ << "','";
s << unquote(schema_) << "','";
}
s << geometry_table_ << "','"
<< geometryColumn_ << "') as ext) as tmp";
s << unquote(geometry_table_) << "','"
<< unquote(geometryColumn_) << "') as ext) as tmp";
}
else
{