|
|
@@ -1,4 +1,5 @@ |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdlib.h> |
|
|
|
|
|
|
|
#include <sqlite3.h> |
|
|
|
|
|
|
@@ -164,3 +165,17 @@ get_nth_id(const int i){ |
|
|
|
r = sqlite3_column_int(get_nth_id_stmt, 0); |
|
|
|
return r; |
|
|
|
} |
|
|
|
|
|
|
|
DECL void |
|
|
|
new_assignment(const char * const who, const int project){ |
|
|
|
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)); |
|
|
|
} |
|
|
|
|
|
|
|
DECL void |
|
|
|
random_assign(const char * const who){ |
|
|
|
int i = rand() % get_project_count(); |
|
|
|
i = get_nth_id(i); |
|
|
|
new_assignment(who, i); |
|
|
|
} |