diff options
| author | Thorsten Töpper <atsutane@freethoughts.de> | 2026-02-22 23:04:22 +0100 |
|---|---|---|
| committer | Thorsten Töpper <atsutane@freethoughts.de> | 2026-02-22 23:04:22 +0100 |
| commit | 3317023b02256a58e9f7dcc4b8aa55acddb611fd (patch) | |
| tree | 1a402f9899c3b5a6e7d17baff7e7d93ca4bf9c6b /src/database_interaction.c | |
| parent | 7ec726e5b4fbddc7b72907fec3fa612a0b1bd570 (diff) | |
| download | duplicate_finder-3317023b02256a58e9f7dcc4b8aa55acddb611fd.tar.gz duplicate_finder-3317023b02256a58e9f7dcc4b8aa55acddb611fd.tar.bz2 | |
database_interaction: Statements to get all data, missing functions
Diffstat (limited to 'src/database_interaction.c')
| -rw-r--r-- | src/database_interaction.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/database_interaction.c b/src/database_interaction.c index 1f2d9af..0dd729d 100644 --- a/src/database_interaction.c +++ b/src/database_interaction.c @@ -63,7 +63,9 @@ sqlite3_stmt *select_filename_by_id, *select_fileinfo_by_filename_id, *select_fileinfo_by_path_filename_ids, *select_fileinfo_by_hash_path_filename_ids, - *select_fileinfo_by_hash_id; + *select_fileinfo_by_hash_id, + *select_fileinfo_complete_table, + *select_fileinfo_complete_table_resolved; sqlite3_stmt *insert_filename, *insert_pathname, @@ -215,8 +217,12 @@ int prepare_statements() { LOCAL_PREP_STMT("SELECT * FROM fileinfo WHERE h_id = ? AND p_id = ? AND fn_id = ? ;", &select_fileinfo_by_hash_path_filename_ids); LOCAL_PREP_STMT("SELECT * FROM fileinfo WHERE h_id = ? ;", &select_fileinfo_by_hash_id); - /* TODO: so far the only query with JOINs or masking it in another way? Ignore this frontend query for now.*/ - select_fileinfo_by_id_resolved = NULL; + /* TODO: so far the only query with JOINs or masking it in another way? + * Many years since + */ + LOCAL_PREP_STMT("SELECT paths.path_name, filenames.name, hashes.blake2, hashes.sha256, hashes.512, fileinfo.size, fileinfo.last_seen, fileinfo.stat_struct FROM fileinfo INNER JOIN paths ON fileinfo.p_id = paths.id INNER JOIN filenames ON fileinfo.fn_id = filenames.id INNER JOIN hashes ON fileinfo.h_id = hashes.id WHERE fileinfo.id = ? ;", &select_fileinfo_by_id_resolved); + LOCAL_PREP_STMT("SELECT paths.path_name, filenames.name, hashes.blake2, hashes.sha256, hashes.512, fileinfo.size, fileinfo.last_seen, fileinfo.stat_struct FROM fileinfo INNER JOIN paths ON fileinfo.p_id = paths.id INNER JOIN filenames ON fileinfo.fn_id = filenames.id INNER JOIN hashes ON fileinfo.h_id = hashes.id ;", &select_fileinfo_complete_table_resolved); + LOCAL_PREP_STMT("SELECT p_id, fn_id, h_id, size, last_seen, stat_struct FROM fileinfo ;", &select_fileinfo_complete_table); /* INSERT */ LOCAL_PREP_STMT("INSERT INTO filenames (name) VALUES (?);", &insert_filename); @@ -877,8 +883,8 @@ int dbi_insert_fileinfo(struct df_fileinfo *fi) { *select_fileinfo_by_path_filename_ids, *select_fileinfo_by_hash_id; - -sqlite3_stmt *, + *select_fileinfo_complete_table, + *select_fileinfo_complete_table_resolved; sqlite3_stmt *delete_fileinfo_by_id; #endif |
