aboutsummaryrefslogtreecommitdiff
path: root/xsig
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2022-09-19 02:39:03 -0400
committerGravatar Chris Xiong <chirs241097@gmail.com> 2022-09-19 02:39:03 -0400
commit41e9051f2d809c42c3dfecc2eb11ad544cbd27b7 (patch)
treee370e08b0e0a45c6eef38704aa2f2b2b0e6d8033 /xsig
parent4b8d314f575d9e893d8dda7431194f8b470fc888 (diff)
downloaddeduper-41e9051f2d809c42c3dfecc2eb11ad544cbd27b7.tar.xz
You break it, you fix it!
The GUI is now working again, with scanning built-in.
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;