Cleans up some code and adds documentation
This commit is contained in:
parent
ba2acb23ec
commit
e449bdd2c5
22
src/db.h
22
src/db.h
@ -13,13 +13,35 @@ enum DB_OPTIONS {
|
||||
* VA args
|
||||
* - Expects book_t if option is ADD
|
||||
* - Expects int if option is REMOVE
|
||||
*
|
||||
* Handles the whole process of interacting with the database
|
||||
*/
|
||||
void do_db_entry(enum DB_OPTIONS option, ...);
|
||||
|
||||
/**
|
||||
* void setup_db
|
||||
* sqlite3* db - The database
|
||||
*
|
||||
* Just creates the database if it doesn't exist.
|
||||
*/
|
||||
void setup_db(sqlite3* db);
|
||||
|
||||
/**
|
||||
* void add_to_db
|
||||
* book_t* book - The struct full of book information
|
||||
* sqlite3* db - The database
|
||||
*
|
||||
* Adds the book information to the database
|
||||
*/
|
||||
void add_to_db(book_t* book, sqlite3* db);
|
||||
|
||||
/**
|
||||
* void remove_from_db
|
||||
* int id - The id of the book to remove
|
||||
* sqlite3* db - The database
|
||||
*
|
||||
* Removes the given ID (and its associated book) from the database.
|
||||
*/
|
||||
void remove_from_db(int id, sqlite3* db);
|
||||
|
||||
#endif
|
||||
|
@ -12,10 +12,6 @@
|
||||
|
||||
#define MAX_BUF_LEN 1024
|
||||
|
||||
/**
|
||||
* TODO: we need to check the csv file for duplicates
|
||||
* TODO: allow us to remove a book from the csv and update the ids
|
||||
*/
|
||||
void do_ISBN_get(char* argv[])
|
||||
{
|
||||
// want to hold a max of 14 so we can hold up to ISBN13s
|
||||
@ -70,7 +66,6 @@ void print_help_menu(char* program)
|
||||
puts("remove [id] -- Removes a book with the given ID from the book database.");
|
||||
}
|
||||
|
||||
|
||||
void process_args(char* argv[])
|
||||
{
|
||||
int id;
|
||||
@ -95,8 +90,6 @@ void process_args(char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if (1 == argc) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user