51 lines
1.0 KiB
C
51 lines
1.0 KiB
C
#define stmt_prepare(stmt) \
|
|
sqlite3_prepare_v2(connection, stmt ## _template, -1, &stmt, NULL)
|
|
|
|
static sqlite3_stmt* remind_stmt;
|
|
static const char remind_stmt_template[] =
|
|
"SELECT "
|
|
"title,"
|
|
"body,"
|
|
"difficulty,"
|
|
"repo_link,"
|
|
"trigger_date,"
|
|
"started DATE,"
|
|
"span"
|
|
" FROM assignment INNER JOIN project on assignment.project = project.rowid "
|
|
"WHERE who = ?;"
|
|
;
|
|
|
|
static sqlite3_stmt* set_repo_stmt;
|
|
static const char set_repo_stmt_template[] =
|
|
"UPDATE assignment "
|
|
"SET "
|
|
"repo_link = ? "
|
|
"WHERE who = ?;"
|
|
;
|
|
|
|
static const char dump_stmt[] =
|
|
"SELECT * FROM project;"
|
|
;
|
|
|
|
static sqlite3_stmt* get_nth_id_stmt;
|
|
static const char get_nth_id_stmt_template[] =
|
|
"SELECT rowid "
|
|
"FROM project "
|
|
"LIMIT 1 "
|
|
"OFFSET ?;"
|
|
;
|
|
|
|
static sqlite3_stmt* new_assignment_stmt;
|
|
static const char new_assignment_stmt_template[] =
|
|
"INSERT INTO assignment "
|
|
"(who, project)"
|
|
" VALUES "
|
|
"(?, ?);"
|
|
;
|
|
|
|
static sqlite3_stmt* purge_assignments_stmt;
|
|
static const char purge_assignments_stmt_template[] =
|
|
"DELETE FROM assignment "
|
|
"WHERE who = ?;"
|
|
;
|