From 66d4ece0f943674193ffc959e938f4bc01d841da Mon Sep 17 00:00:00 2001 From: amin roosta Date: Sun, 6 Mar 2016 00:41:19 +0330 Subject: [PATCH] prevent prepared- statements from executing again when they go out of scope --- hdr/sqlite_modern_cpp.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hdr/sqlite_modern_cpp.h b/hdr/sqlite_modern_cpp.h index 92ca0e00..264c4513 100644 --- a/hdr/sqlite_modern_cpp.h +++ b/hdr/sqlite_modern_cpp.h @@ -122,6 +122,7 @@ namespace sqlite { sqlite3_reset(_stmt.get()); sqlite3_clear_bindings(_stmt.get()); _inx = 1; + used(false); } void execute() { @@ -132,6 +133,7 @@ namespace sqlite { if(hresult != SQLITE_DONE) { exceptions::throw_sqlite_error(hresult); } + used(true); /* prevent from executing again when goes out of scope */ } void used(bool state) { execution_started = state; }