Browse Source

+ simdb_record_used()

master
Alex 'AdUser' Z 8 years ago
parent
commit
44fe96c8fd
  1. 19
      src/database.c
  2. 8
      src/simdb.h

19
src/database.c

@ -231,6 +231,25 @@ simdb_write(simdb_t *db, int start, int records, simdb_urec_t *data) {
return records;
}
bool
simdb_record_used(simdb_t *db, int num) {
simdb_urec_t *rec = NULL;
bool ret = false;
assert(db != NULL);
if (num > db->records)
return false;
if (simdb_read(db, num, 1, &rec) < 1)
return false;
ret = rec->used ? true : false;
FREE(rec);
return ret;
}
int
simdb_record_del(simdb_t *db, int num) {
simdb_urec_t *rec;

8
src/simdb.h

@ -105,6 +105,14 @@ int simdb_search(simdb_t * const db, int num,
simdb_search_t * const search,
simdb_match_t ** matches);
/**
* @brief Checks is record with given number is used
* @param db Database handle
* @param num Record number
* @returns true if used, false if no record exists or not used
*/
bool simdb_record_used(simdb_t *db, int num);
/**
* @brief Create record from image file
* @param path Path to source image

Loading…
Cancel
Save