db: move duplicated code into helper functions

* move common cleanup code into separate function
* add helper function for IMSI binding
* use errno.h instead of numbers

Change-Id: Iec81b56ab1ccc948807854a3947b04355a555c10
diff --git a/src/db.h b/src/db.h
index d569fb0..0fb76a0 100644
--- a/src/db.h
+++ b/src/db.h
@@ -20,6 +20,8 @@
 	sqlite3_stmt *stmt[_NUM_STMT];
 };
 
+bool db_remove_reset(sqlite3_stmt *stmt);
+bool db_bind_imsi(sqlite3_stmt *stmt, const char *imsi);
 void db_close(struct db_context *dbc);
 struct db_context *db_open(void *ctx, const char *fname);