From d513977a3566b14d9357906615d045d71741537f Mon Sep 17 00:00:00 2001 From: Thorsten Töpper Date: Wed, 18 Feb 2026 21:51:53 +0100 Subject: squash initial implementation --- include/database_interaction.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 include/database_interaction.h (limited to 'include/database_interaction.h') 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 -- cgit v1.3