From 6d5c6d74585a78fb28848c5522bcb0936b6d3ac8 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 16 Aug 2011 16:45:03 +0000 Subject: [PATCH] sqlite: query from geometry_table_ rather than table_ to hopefully avoid problems with rowid being missing from subquery --- plugins/input/sqlite/sqlite_datasource.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/input/sqlite/sqlite_datasource.cpp b/plugins/input/sqlite/sqlite_datasource.cpp index 293bf7d76..ed66147cb 100644 --- a/plugins/input/sqlite/sqlite_datasource.cpp +++ b/plugins/input/sqlite/sqlite_datasource.cpp @@ -410,10 +410,16 @@ void sqlite_datasource::bind() const // final fallback to gather extent if (!extent_initialized_ || !has_spatial_index_) { + + /*if (use_spatial_index_ && key_field_ == "rowid" && boost::algorithm::icontains(geometry_table_,"from")) { + // this is an impossible situation because rowid will be null via a subquery + throw datasource_exception("Sqlite Plugin: Using a spatial index will require creating one on the fly which is not possible unless you supply a 'key_field' value that references the primary key of your spatial table. To avoid using a spatial index set 'use_spatial_index'=false"); + }*/ + std::ostringstream s; s << "SELECT " << geometry_field_ << "," << key_field_ - << " FROM " << table_; + << " FROM " << geometry_table_; if (row_limit_ > 0) { s << " LIMIT " << row_limit_; }