56 lines
1.6 KiB
C
56 lines
1.6 KiB
C
#ifndef DODO_H
|
|
#define DODO_H
|
|
|
|
#define SQLQUERY_MAX 100
|
|
#define ARG_MAX 100
|
|
#define TODAY_COL_START -1
|
|
#define BACKLOG_COL_START 33
|
|
#define BLOCKED_COL_START 66
|
|
#define FIXED_WIDTH 19
|
|
|
|
typedef struct{
|
|
int year;
|
|
int month;
|
|
int day;
|
|
}date;
|
|
|
|
typedef struct {
|
|
int task_id;
|
|
char* title;
|
|
int active_id;
|
|
char* status;
|
|
date creation_date;
|
|
date due_date;
|
|
}task_entry;
|
|
|
|
// FOR DEBUG
|
|
int callback(void *NotUsed, int argc, char **argv, char **azColName);
|
|
int view_all(sqlite3 *db);
|
|
|
|
// sql generators TODO: might be able to boil this down to 1 func
|
|
int gen_sql_update_stmt(sqlite3 *db, sqlite3_stmt** out_stmt, char* table, char* status, char* title);
|
|
int gen_sql_delete_stmt(sqlite3 *db, sqlite3_stmt** out_stmt, char* table, char* title);
|
|
int gen_sql_insert_stmt(sqlite3 *db, sqlite3_stmt** out_stmt, char* table, char* colnames, char* values);
|
|
int gen_sql_select_stmt(sqlite3 *db, sqlite3_stmt** out_stmt, char* colnames, char* table, char* status);
|
|
|
|
// helpers
|
|
int checksqlerr(int rc, char *errmsg);
|
|
int opendb(sqlite3 **db, char* filename);
|
|
void display_heading();
|
|
int parse_args(int argc, char** argv, char** title, char** due_date);
|
|
int get_num_rows(sqlite3 *db, char* table, char* status);
|
|
int print_fixed_width(const unsigned char* str);
|
|
int display_task_list(int start_col, sqlite3 *db, char* colnames, char* table, char* status);
|
|
|
|
// main functions
|
|
int view_tasks(sqlite3 *db);
|
|
int add_new_task(sqlite3 *db, int argc, char** argv);
|
|
int update_task_status(sqlite3 *db, int argc, char** argv);
|
|
int complete_task(sqlite3 *db, int argc, char** argv);
|
|
int modify_task(sqlite3 *db, int argc, char** argv);
|
|
|
|
|
|
int del_task(sqlite3 *db, int argc, char** argv);
|
|
|
|
#endif
|