Actual data-based sqlite statistics test, fix kinks in the implementation.
This commit is contained in:
parent
d1c65beb1c
commit
ff450b4998
2 changed files with 5 additions and 1 deletions
|
@ -522,7 +522,7 @@ std::map<std::string, mapnik::parameters> sqlite_datasource::get_statistics() c
|
|||
{
|
||||
itr = desc_.get_descriptors().begin();
|
||||
int col = 0;
|
||||
for ( ; itr != end; ++itr, ++col) {
|
||||
for ( ; itr != end; ++itr) {
|
||||
std::string fld_name = itr->get_name();
|
||||
if (fld_name != key_field_ &&
|
||||
itr->get_type() == mapnik::Double ||
|
||||
|
@ -533,6 +533,7 @@ std::map<std::string, mapnik::parameters> sqlite_datasource::get_statistics() c
|
|||
p["max"] = rs->column_double(col);
|
||||
col++;
|
||||
p["mean"] = rs->column_double(col);
|
||||
col++;
|
||||
stats_[itr->get_name()] = p;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,9 @@ if 'sqlite' in mapnik.DatasourceCache.instance().plugin_names():
|
|||
def test_attachdb_with_multiple_files():
|
||||
ds = mapnik.SQLite(file='../data/sqlite/world.sqlite', table='world_merc')
|
||||
stats = ds.statistics()
|
||||
eq_(stats['pop2005']['min'], 0)
|
||||
eq_(stats['pop2005']['max'], 1312978855)
|
||||
eq_(stats['area']['max'], 1638094)
|
||||
print stats
|
||||
|
||||
def test_attachdb_with_absolute_file():
|
||||
|
|
Loading…
Reference in a new issue