diff options
Diffstat (limited to 'src/actions.c')
-rw-r--r-- | src/actions.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/actions.c b/src/actions.c index 87c0a6c..4e9e4ca 100644 --- a/src/actions.c +++ b/src/actions.c @@ -42,9 +42,12 @@ int run_ADD(UserOpt * opt, Conf *conf) { for (int i = 0; i < opt->argc; i++) { printf("[%d]: %s\n", i, opt->argv[i]); } - add_insert_program_to_db(&db, opt->argv[1]); + // figure out user opt + if (add_transaction_begin(&db, opt->argv[0], opt->argv[1], 0, 0) == 0) { + return 0; + } close_DB(&db); - return 0; + return 1; } int run_DEL(UserOpt * opt, Conf *conf) { @@ -59,6 +62,16 @@ int run_EDIT(UserOpt * opt, Conf *conf) { int run_LIST(UserOpt * opt, Conf *conf) { printf("Running %s\n", "list"); + DB db = open_DB(opt); + if (db.ptr == NULL) { + if (db.error == SQL_ERR_NO_TABLES) { + printf("no tables\n"); + } + } + for (int i = 0; i < opt->argc; i++) { + printf("[%d]: %s\n", i, opt->argv[i]); + } + close_DB(&db); return 0; } |