summaryrefslogtreecommitdiff
path: root/src/connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/connection.cpp')
-rw-r--r--src/connection.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/connection.cpp b/src/connection.cpp
index ceb5d3e..30ab00a 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -56,7 +56,17 @@ connection::connection( const connection& c ) {
connection::~connection( ) {
assert( db != NULL );
- sqlite3_close( db );
+
+ // remove all prepared statements
+ for( PSMap::iterator it = prepared_stmts.begin( ); it != prepared_stmts.end( ); it++ ) {
+ delete (*it).second;
+ }
+
+ // close database now
+ int rt = sqlite3_close( db );
+ if( rt != SQLITE_OK ) {
+ cerr << "ERROR in destructor of connection: " << rt << endl;
+ }
}
extern "C" void profiling_callback( void *a, const char *b, sqlite3_uint64 c ) {