aboutsummaryrefslogtreecommitdiff
path: root/include/database_interaction.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/database_interaction.h')
-rw-r--r--include/database_interaction.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/database_interaction.h b/include/database_interaction.h
new file mode 100644
index 0000000..9ae0da7
--- /dev/null
+++ b/include/database_interaction.h
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: Apache-2.0 */
+
+/* Copyright 2026 Thorsten Töpper
+ *
+ * vim:ts=4:sw=4:expandtab
+ */
+#ifndef DATABASE_INTERACTION_H
+#define DATABASE_INTERACTION_H
+
+#include "file_processor.h"
+
+/*=========== FUNCTIONS ===========*/
+bool dbi_open(char *filename);
+void dbi_close();
+
+char *dbi_select_filename_by_id(int64_t id);
+int64_t dbi_select_filename_by_name(const char *name);
+int dbi_insert_filename(const char *filename);
+
+char *dbi_select_path_by_id(int64_t id);
+int64_t dbi_select_path_by_pathname(const char *pathname);
+int dbi_insert_pathname(const char *path);
+
+struct df_hashstrings *dbi_select_hashes_by_id(int64_t id);
+int64_t dbi_select_hashes_by_strings(const char *blake2, const char *sha256, const char *sha512);
+int dbi_insert_hashes(const char *blake2, const char *sha256, const char *sha512);
+
+int64_t dbi_select_fileinfo_by_hash_path_filename_ids(int64_t hash_id, int64_t path_id, int64_t filename_id);
+int64_t dbi_select_fileinfo_by_path_filename_ids(int64_t pname_id, int64_t fname_id);
+int dbi_insert_fileinfo(struct df_fileinfo *fi);
+
+int dbi_update_fileinfo_last_seen(int64_t id);
+int dbi_update_fileinfo_complete(struct df_fileinfo *fi, int64_t existing_id);
+#endif