diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2018-11-16 14:43:19 +0200 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2018-11-16 14:43:19 +0200 |
commit | 54ae271dfc5f8405233ed320b2e9bd821ee8210f (patch) | |
tree | 9b27941b0e5cc0aa5ba805e1bcb9f8d7ff965592 /src/dblayer.h | |
parent | 97e14c73be6684259e235a92cc575ea39a04fc7e (diff) | |
download | ck-54ae271dfc5f8405233ed320b2e9bd821ee8210f.tar.gz ck-54ae271dfc5f8405233ed320b2e9bd821ee8210f.tar.bz2 ck-54ae271dfc5f8405233ed320b2e9bd821ee8210f.zip |
Code restructure/simplification, restore regression test
Diffstat (limited to 'src/dblayer.h')
-rw-r--r-- | src/dblayer.h | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/src/dblayer.h b/src/dblayer.h index 2e42ad0..c830a94 100644 --- a/src/dblayer.h +++ b/src/dblayer.h @@ -35,57 +35,54 @@ struct DBstruct { SqlError error; }; -int db_exists(const UserOpt *opt); - /* Open the db file. On fail return null pointer to db->ptr * and the corresponding SQL error (NO_DB_FILE | NO_TABLES)*/ int open_DB(DB *db, const UserOpt *opt); - void close_DB(DB *db); +int db_exists(const UserOpt *opt); + + +/**********************************/ int program_exists(DB *db, const char *pName); int get_program_paths(DB *db, cklist *ckl, const char* pName, int bName, int attr, const char *home); +int get_config_number(DB *db, char *pName); +int get_program_relations(DB *db, int pid); +/* Returns the path of the found config via *ret */ +int program_has_primary_config(DB *db, const int pid, char *ret, int *sec); -/********/ -/* init */ -/********/ +/* Returns -2 or error, -1 if program doesn't exist + * else the program ID */ +int get_config_id(DB *db, const char* path); -/* Create the tables required for the ckdb */ -void init_make_tables(DB *db); -int init_make_DB(DB *db, const UserOpt *opt); +/* Returns -2 or error, -1 if program doesn't exist + * else the config ID */ +int get_program_id(DB *db, const char* name); + +int get_pid_from_cid(DB *db, int cid); -/*******/ -/* add */ -/*******/ +void print_suggested_configs(DB *db, const char *pName); +/* init.c */ +void init_make_tables(DB *db); + +/* add.c */ /* Returns 1 in error, 0 otherwise */ int add_transaction_try(DB *db, const AddOpt * const opt, const char *home); -/********/ -/* edit */ -/********/ - +/* edit.c */ int edit_get_prime_config_from_program(DB *db, char *pName, char *ret, int *secret); -int get_config_number(DB *db, char *pName); int edit_get_config(DB *db, const char *pName, char *ret, const char *cName, int *sec); -/********/ -/* list */ -/********/ - +/* list.c */ int list_get_paths(DB *db, cklist *ckl, int bName, int attr, const char *home); int list_get_programs(DB *db, cklist *ckl); int list_get_path_program_tree(DB *db, cklist *ckl, int bName, int attr, const char *home); -/*******/ -/* del */ -/*******/ - +/* delete.c */ int del_transaction_try(DB *db, const char *pName, const char *cBaseName); -/***********/ -/* restore */ -/***********/ - +/* restore.c */ int restore_configs_exists(DB *db, Conf *conf, const char *pName, cklist *from, cklist *to); int restore_all_exist(DB *db, Conf *conf, cklist *from, cklist *to); + #endif /* DBLAYER_H */ |