do not crash on repeated calls
This commit is contained in:
parent
fc6fe42337
commit
cd30d51462
@ -39,6 +39,8 @@ api_rope(void)
|
||||
DBERR(sqlite3_finalize(remind_stmt));
|
||||
DBERR(sqlite3_finalize(set_repo_stmt));
|
||||
DBERR(sqlite3_finalize(get_nth_id_stmt));
|
||||
DBERR(sqlite3_finalize(new_assignment_stmt));
|
||||
DBERR(sqlite3_finalize(purge_assignments_stmt));
|
||||
sqlite3_close(connection);
|
||||
}
|
||||
|
||||
@ -57,6 +59,7 @@ remind(char * who)
|
||||
char * title;
|
||||
char * desc;
|
||||
char * repo;
|
||||
DBERR(sqlite3_reset(remind_stmt));
|
||||
DBERR(sqlite3_bind_text(remind_stmt, 1, who, -1, SQLITE_STATIC));
|
||||
const int i = sqlite3_step(remind_stmt);
|
||||
DBERR(i);
|
||||
@ -80,6 +83,7 @@ remind(char * who)
|
||||
DECL void
|
||||
set_repo(const char * const who, const char * const link)
|
||||
{
|
||||
DBERR(sqlite3_reset(set_repo_stmt));
|
||||
DBERR(sqlite3_bind_text(set_repo_stmt, 1, link, -1, SQLITE_STATIC));
|
||||
DBERR(sqlite3_bind_text(set_repo_stmt, 2, who, -1, SQLITE_STATIC));
|
||||
DBERR(sqlite3_step(set_repo_stmt));
|
||||
@ -153,6 +157,7 @@ get_project_count(){
|
||||
DECL int
|
||||
get_nth_id(const int i){
|
||||
int r;
|
||||
DBERR(sqlite3_reset(get_nth_id_stmt));
|
||||
DBERR(sqlite3_bind_int(get_nth_id_stmt, 1, i));
|
||||
DBERR(sqlite3_step(get_nth_id_stmt));
|
||||
r = sqlite3_column_int(get_nth_id_stmt, 0);
|
||||
@ -161,6 +166,7 @@ get_nth_id(const int i){
|
||||
|
||||
DECL void
|
||||
new_assignment(const char * const who, const int project){
|
||||
DBERR(sqlite3_reset(new_assignment_stmt));
|
||||
DBERR(sqlite3_bind_text(new_assignment_stmt, 1, who, -1, SQLITE_STATIC));
|
||||
DBERR(sqlite3_bind_int(new_assignment_stmt, 2, project));
|
||||
DBERR(sqlite3_step(new_assignment_stmt));
|
||||
|
Reference in New Issue
Block a user