+ fix resolving the table name properly

+ remove unused imports
+ don't use static string for datasource name
This commit is contained in:
Lucio Asnaghi 2010-11-16 17:47:23 +00:00
parent d8ea5582fb
commit 82ed88a940
3 changed files with 5 additions and 11 deletions

View file

@ -202,10 +202,9 @@ void sqlite_datasource::bind() const
as all column_type are SQLITE_NULL
*/
std::string::size_type idx = table_.find(table_name);
std::ostringstream s;
s << "select * from (" << table_.substr(0,idx + table_name.length()) << ") limit 1";
s << "select * from (" << table_name << ") limit 1";
boost::scoped_ptr<sqlite_resultset> rs (dataset_->execute_query (s.str()));
if (rs->is_valid () && rs->step_next())
{
@ -252,11 +251,9 @@ sqlite_datasource::~sqlite_datasource()
}
}
std::string const sqlite_datasource::name_="sqlite";
std::string sqlite_datasource::name()
{
return name_;
return "sqlite";
}
int sqlite_datasource::type() const

View file

@ -50,7 +50,6 @@ class sqlite_datasource : public mapnik::datasource
mapnik::layer_descriptor get_descriptor() const;
void bind() const;
private:
static const std::string name_;
mutable mapnik::Envelope<double> extent_;
mutable bool extent_initialized_;
int type_;

View file

@ -41,10 +41,6 @@ using mapnik::Envelope;
using mapnik::CoordTransform;
using mapnik::Feature;
using mapnik::feature_ptr;
using mapnik::point_impl;
using mapnik::line_string_impl;
using mapnik::polygon_impl;
using mapnik::geometry2d;
using mapnik::geometry_utils;
using mapnik::transcoder;
@ -67,6 +63,8 @@ feature_ptr sqlite_featureset::next()
{
int size;
const char* data = (const char *) rs_->column_blob (0, size);
if (!data)
return feature_ptr();
int feature_id = rs_->column_integer (1);
#ifdef MAPNIK_DEBUG