Browse Source

proper init and prototyping

pull/3/head
anon 10 months ago
parent
commit
677b9ed665
3 changed files with 12 additions and 1 deletions
  1. +3
    -1
      include/parse.h
  2. +6
    -0
      include/stmt.h
  3. +3
    -0
      src/api.c

+ 3
- 1
include/parse.h View File

@@ -17,12 +17,14 @@ DECL void clean_creds(void);

DECL int parse_admin_list(char const * admin_list_file);
DECL int is_admin(char const * user);
DECL void clean_admin_list();
DECL void clean_admin_list();

DECL char * remind(char * who);
DECL void set_repo(const char * const who, const char * const link);
DECL char * dump(void);
DECL char * raw(const char * const sql);
DECL void random_assign(const char * const sql);
DECL void purge_assignments(const char * const who);

#define CREDS_PARSER_H
#endif

+ 6
- 0
include/stmt.h View File

@@ -42,3 +42,9 @@ static const char new_assignment_stmt_template[] =
" VALUES "
"(?, ?);"
;

static sqlite3_stmt* purge_assignments_stmt;
static const char purge_assignments_stmt_template[] =
"DELETE FROM assignment "
"WHERE who = ?;"
;

+ 3
- 0
src/api.c View File

@@ -27,9 +27,12 @@ DECL int
api_init(void)
{
DBERR(sqlite3_open(DBFILE, &connection));
// dont you fucking dare to remove this spacing
DBERR(stmt_prepare(remind_stmt));
DBERR(stmt_prepare(set_repo_stmt));
DBERR(stmt_prepare(get_nth_id_stmt));
DBERR(stmt_prepare(new_assignment_stmt));
DBERR(stmt_prepare(purge_assignments_stmt));
return 0;
}