From e7cf55222c6edd72b9ee155a3cc77ba23befe59f Mon Sep 17 00:00:00 2001 From: Steven Looman Date: Thu, 20 Nov 2014 18:58:20 +0100 Subject: [PATCH] Add test case for missing columns in SQLite datasource, using subquery. Refs #2579 --- tests/python_tests/sqlite_test.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/python_tests/sqlite_test.py b/tests/python_tests/sqlite_test.py index 9cbfd1374..270f350cd 100644 --- a/tests/python_tests/sqlite_test.py +++ b/tests/python_tests/sqlite_test.py @@ -387,6 +387,25 @@ if 'sqlite' in mapnik.DatasourceCache.plugin_names(): eq_(ds.fields(),['rowid', 'untyped']) eq_(ds.field_types(),['int', 'str']) + def test_db_with_one_untyped_column_using_subquery(): + # form up an in-memory test db + wkb = '010100000000000000000000000000000000000000' + ds = mapnik.SQLite(file=':memory:', + table='(SELECT rowid, geometry, untyped FROM test1)', + initdb=''' + create table test1 (geometry BLOB, untyped); + insert into test1 values (x'%s', 'untyped'); + ''' % wkb, + extent='-180,-60,180,60', + use_spatial_index=False, + key_field='rowid' + ) + + # ensure the untyped column is found + eq_(len(ds.fields()),3) + eq_(ds.fields(),['rowid', 'untyped', 'rowid']) + eq_(ds.field_types(),['int', 'str', 'int']) + def test_that_64bit_int_fields_work(): ds = mapnik.SQLite(file='../data/sqlite/64bit_int.sqlite',