|
|
@@ -132,3 +132,21 @@ raw(const char * const sql) |
|
|
|
} else { strcat(r, "\00"); } |
|
|
|
return r; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int get_project_count_callback(void* data, int argc, char** argv, char** colname) { |
|
|
|
(void)argc; |
|
|
|
(void)colname; |
|
|
|
int* count = (int*)data; |
|
|
|
*count = atoi(argv[0]); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
static int get_project_count(){ |
|
|
|
int r = 0; |
|
|
|
|
|
|
|
const char* sql = "SELECT COUNT(*) FROM project;"; |
|
|
|
DBERR(sqlite3_exec(connection, sql, get_project_count_callback, &r, NULL)); |
|
|
|
|
|
|
|
return r; |
|
|
|
} |