aboutsummaryrefslogtreecommitdiff
path: root/xsig
diff options
context:
space:
mode:
Diffstat (limited to 'xsig')
-rw-r--r--xsig/include/signature_db.hpp2
-rw-r--r--xsig/src/signature_db.cpp16
2 files changed, 18 insertions, 0 deletions
diff --git a/xsig/include/signature_db.hpp b/xsig/include/signature_db.hpp
index b37cf0a..107aa90 100644
--- a/xsig/include/signature_db.hpp
+++ b/xsig/include/signature_db.hpp
@@ -57,6 +57,8 @@ public:
std::pair<fs::path, signature> get_signature(size_t id);
void batch_get_signature_end();
+ std::vector<size_t> get_image_ids();
+
//place batch_put_subslice_begin() and batch_put_subslice_end() around a group of
//put_subslice() calls to improve performance
void batch_put_subslice_begin();
diff --git a/xsig/src/signature_db.cpp b/xsig/src/signature_db.cpp
index 393b756..ba1a372 100644
--- a/xsig/src/signature_db.cpp
+++ b/xsig/src/signature_db.cpp
@@ -214,6 +214,22 @@ void signature_db::batch_get_signature_end()
p->batch_end(batch_status::getsig);
}
+std::vector<size_t> signature_db::get_image_ids()
+{
+ sqlite3_stmt *st = nullptr;
+ sqlite3_prepare_v2(p->db, "select id from images;", -1, &st, 0);
+ std::vector<size_t> ret;
+ while (1)
+ {
+ int r = sqlite3_step(st);
+ if (r != SQLITE_ROW) break;
+ size_t id = (size_t)sqlite3_column_int(st, 0);
+ ret.push_back(id);
+ }
+ sqlite3_finalize(st);
+ return ret;
+}
+
void signature_db::batch_put_subslice_begin()
{
if (!p->db) [[ unlikely ]] return;