From a527bb25e22c246a98b0c471ea3c2b99a361f03e Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sun, 13 Nov 2011 16:41:34 -0800 Subject: [PATCH] sqlite: step_next for a prepared statement must only return SQLITE_DONE --- plugins/input/sqlite/sqlite_prepared.hpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/input/sqlite/sqlite_prepared.hpp b/plugins/input/sqlite/sqlite_prepared.hpp index 4ad5271f2..b5909bf81 100644 --- a/plugins/input/sqlite/sqlite_prepared.hpp +++ b/plugins/input/sqlite/sqlite_prepared.hpp @@ -109,7 +109,7 @@ public: bool step_next () { const int status = sqlite3_step(stmt_); - if (status != SQLITE_ROW && status != SQLITE_DONE) + if (status != SQLITE_DONE) { std::ostringstream s; s << "SQLite Plugin: inserting bbox into rtree index failed"; @@ -120,8 +120,12 @@ public: } throw mapnik::datasource_exception(s.str()); } - sqlite3_reset(stmt_); - return status == SQLITE_ROW; + sqlite3_clear_bindings(stmt_); + if (sqlite3_reset(stmt_) != SQLITE_OK) + { + throw mapnik::datasource_exception("sqlite3_reset failed"); + } + return true; } private: