Browse Source

* query.c : update

master
Alex 'AdUser' Z 10 years ago
parent
commit
80f5b686d9
  1. 17
      src/query.c

17
src/query.c

@ -52,19 +52,18 @@ int search_similar(imdb_t *db, uint64_t number, float maxdiff)
sample.num = number; sample.num = number;
if ((ret = imdb_search(db, &sample, &search, &matches)) < 0) { if ((ret = imdb_search(db, &sample, &search, &matches)) < 0) {
printf("%s\n", db->errstr); puts(db->errstr);
exit(EXIT_FAILURE); return 0;
} }
if (ret > 0) { for (i = 0; i < ret; i++) {
for (i = 0; i < ret; i++)
printf("%llu -- bitmap: %.1f, ratio: %.1f\n", printf("%llu -- bitmap: %.1f, ratio: %.1f\n",
matches[i].num, matches[i].num,
matches[i].diff_bitmap * 100, matches[i].diff_bitmap * 100,
matches[i].diff_ratio * 100); matches[i].diff_ratio * 100);
}
FREE(matches); FREE(matches);
}
return 0; return 0;
} }
@ -82,7 +81,7 @@ int db_usage_map(imdb_t *db, unsigned short int cols)
if ((records = imdb_usage_map(db, &map)) == 0) { if ((records = imdb_usage_map(db, &map)) == 0) {
printf("Can't get database usage map\n"); printf("Can't get database usage map\n");
FREE(map); FREE(map);
exit(1); return 0;
} }
m = map; m = map;
@ -95,7 +94,6 @@ int db_usage_map(imdb_t *db, unsigned short int cols)
} }
FREE(map); FREE(map);
return 0; return 0;
} }
@ -107,10 +105,7 @@ int rec_bitmap(imdb_t *db, uint64_t number)
memset(&rec, 0x0, sizeof(imdb_rec_t)); memset(&rec, 0x0, sizeof(imdb_rec_t));
rec.num = number; rec.num = number;
if (imdb_read_rec(db, &rec) < 1) if (imdb_read_rec(db, &rec) < 1) {
return -1;
if (rec.data[0] != 0xFF) {
puts("Sample not exists"); puts("Sample not exists");
return 0; return 0;
} }

Loading…
Cancel
Save