Compare commits
No commits in common. "c31ccdece296ac43b44cade150fe49b6fe932b86" and "d30f8df5c1b82c4bd5649dabe6fd1e071dd37355" have entirely different histories.
c31ccdece2
...
d30f8df5c1
@ -118,7 +118,6 @@ int cmd_delete(int argc, char *argv[]) {
|
|||||||
|
|
||||||
if(not db.recipe_exists(id)) {
|
if(not db.recipe_exists(id)) {
|
||||||
std::cerr << "No recipe exists with ID " << id << "." << std::endl;
|
std::cerr << "No recipe exists with ID " << id << "." << std::endl;
|
||||||
db.close();
|
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
} else {
|
} else {
|
||||||
recipe_ids.push_back(id);
|
recipe_ids.push_back(id);
|
||||||
@ -135,12 +134,12 @@ int cmd_info(const int id) {
|
|||||||
db db;
|
db db;
|
||||||
struct recipe recipe;
|
struct recipe recipe;
|
||||||
std::vector<std::string> ingredients, tags;
|
std::vector<std::string> ingredients, tags;
|
||||||
|
int ret = EXIT_SUCCESS;
|
||||||
|
|
||||||
db.open();
|
db.open();
|
||||||
|
|
||||||
if(not db.recipe_exists(id)) {
|
if(not db.recipe_exists(id)) {
|
||||||
std::cerr << "No recipe with ID '" << id << "'";
|
std::cerr << "No recipe with ID '" << id << "'";
|
||||||
db.close();
|
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,5 +164,5 @@ int cmd_info(const int id) {
|
|||||||
std::cout << "\t- " << tag << std::endl;
|
std::cout << "\t- " << tag << std::endl;
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public:
|
|||||||
inline int get_recipe_id(const std::string &name) {
|
inline int get_recipe_id(const std::string &name) {
|
||||||
return table_get_id_by_name("recipes", 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);
|
return (get_recipe_id(name) > 0);
|
||||||
}
|
}
|
||||||
bool recipe_exists(const int id);
|
bool recipe_exists(const int id);
|
||||||
@ -74,7 +74,7 @@ public:
|
|||||||
inline int get_ingredient_id(const std::string &name) {
|
inline int get_ingredient_id(const std::string &name) {
|
||||||
return table_get_id_by_name("ingredients", 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);
|
return (get_ingredient_id(name) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user