sqlite: step_next for a prepared statement must only return SQLITE_DONE

This commit is contained in:
Dane Springmeyer 2011-11-13 16:41:34 -08:00
parent f49fac2d0e
commit 7ef5778d96

View file

@ -109,7 +109,7 @@ public:
bool step_next () bool step_next ()
{ {
const int status = sqlite3_step(stmt_); const int status = sqlite3_step(stmt_);
if (status != SQLITE_ROW && status != SQLITE_DONE) if (status != SQLITE_DONE)
{ {
std::ostringstream s; std::ostringstream s;
s << "SQLite Plugin: inserting bbox into rtree index failed"; s << "SQLite Plugin: inserting bbox into rtree index failed";
@ -120,8 +120,12 @@ public:
} }
throw mapnik::datasource_exception(s.str()); throw mapnik::datasource_exception(s.str());
} }
sqlite3_reset(stmt_); sqlite3_clear_bindings(stmt_);
return status == SQLITE_ROW; if (sqlite3_reset(stmt_) != SQLITE_OK)
{
throw mapnik::datasource_exception("sqlite3_reset failed");
}
return true;
} }
private: private: