Compare commits

..

No commits in common. "c31ccdece296ac43b44cade150fe49b6fe932b86" and "d30f8df5c1b82c4bd5649dabe6fd1e071dd37355" have entirely different histories.

2 changed files with 4 additions and 5 deletions

View File

@ -118,7 +118,6 @@ int cmd_delete(int argc, char *argv[]) {
if(not db.recipe_exists(id)) {
std::cerr << "No recipe exists with ID " << id << "." << std::endl;
db.close();
return EXIT_FAILURE;
} else {
recipe_ids.push_back(id);
@ -135,12 +134,12 @@ int cmd_info(const int id) {
db db;
struct recipe recipe;
std::vector<std::string> ingredients, tags;
int ret = EXIT_SUCCESS;
db.open();
if(not db.recipe_exists(id)) {
std::cerr << "No recipe with ID '" << id << "'";
db.close();
return EXIT_FAILURE;
}
@ -165,5 +164,5 @@ int cmd_info(const int id) {
std::cout << "\t- " << tag << std::endl;
std::cout << std::endl;
return EXIT_SUCCESS;
return ret;
}

View File

@ -54,7 +54,7 @@ public:
inline int get_recipe_id(const std::string &name) {
return table_get_id_by_name("recipes", name);
}
inline bool recipe_exists(const std::string &name) {
inline bool db_recipe_exists(const std::string &name) {
return (get_recipe_id(name) > 0);
}
bool recipe_exists(const int id);
@ -74,7 +74,7 @@ public:
inline int get_ingredient_id(const std::string &name) {
return table_get_id_by_name("ingredients", name);
}
inline bool ingredient_exists(const std::string &name) {
inline bool db_ingredient_exists(const std::string &name) {
return (get_ingredient_id(name) > 0);
}