aboutsummaryrefslogtreecommitdiffstats
path: root/src/dblayer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dblayer.c')
-rw-r--r--src/dblayer.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/dblayer.c b/src/dblayer.c
index 973d561..4218ef6 100644
--- a/src/dblayer.c
+++ b/src/dblayer.c
@@ -17,6 +17,9 @@
#include "dblayer.h"
#include "dbhelper.h"
#include "ckutil.h"
+#include "ckerrlog.h"
+
+ERRLOG(ckdb);
const char * const DB_FILE_NAME = "/ckdb";
@@ -809,26 +812,26 @@ int del_transaction_try(DB *db, char *arg, int conf) {
if (conf) {
// del conf
int cid = get_config_id(db, arg);
- printf("cid: %d\n", cid);
if (cid < 0) {
- PRINT_ERR("Config doesn't exist in the database.\n");
+ ERR("Config doesn't exist in the database.");
+ return -1;
}
if (delete_conf(db, cid)) {
- PRINT_ERR("Could not delete config from db.\n");
+ ERR("Could not delete config from db.");
return -1;
}
// handle relations
pid = remove_conf_rel(db, cid);
- printf("pid: %d\n", pid);
+ HELP("Deleted config: %s", arg);
if (get_program_relations(db, pid) > 0) {
- printf("More rels left\n");
goto end;
}
- } else {
+ }
+ else {
pid = get_program_id(db, arg);
}
if (pid < 0) {
- PRINT_ERR("Program not found in the db.\n");
+ ERR("Program not found in the db.");
return -1;
}
/* If we are deleting a proram we should delete everything that
@@ -837,11 +840,10 @@ int del_transaction_try(DB *db, char *arg, int conf) {
remove_all_configs(db, pid);
}
if(delete_prog(db, pid)) {
- PRINT_ERR("Could not delete program from db.\n");
- }
- if (db->error == SQL_ERR_SQLITE) {
+ ERR("Could not delete program from db.");
return -1;
}
+ HELP("Deleted program %s", conf ? "" : arg);
end:
__END_TRANSACTION__
return 0;