![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "database/metadata_repository.h"#include "database/database.h"#include "database/sql_debug.h"#include "system/macros.h"#include "system/mem_alloc.h"#include <sqlite3.h>
Include dependency graph for metadata_repository.c:Go to the source code of this file.
Functions | |
| GList * | dt_metadata_repository_get_values (const int32_t imgid, const int keyid) |
Values stored under keyid, ordered by value. | |
| GList * | dt_metadata_repository_get_all (const int32_t imgid) |
Every (key, value) pair of imgid, as a flat list. | |
| void | dt_metadata_repository_remove (const int32_t imgid, const char *keyid_list) |
Delete the rows of imgid whose key is in keyid_list, a comma-separated list of decimal key ids. Does nothing when keyid_list is NULL. | |
| void | dt_metadata_repository_add (const dt_metadata_row_t *rows, const size_t count) |
Insert count rows as a single multi-VALUES statement. | |
| int32_t | dt_metadata_repository_find_image_by_value (const char *value) |
The first image carrying value under any key, or -1. | |
| void | dt_metadata_repository_foreach (const int32_t imgid, dt_metadata_repository_row_cb cb, void *user_data) |
Every metadata row of imgid, in row order. | |
| void | dt_metadata_repository_foreach_selected (dt_metadata_repository_selected_cb cb, void *user_data) |
Every distinct (key, value) pair across main.selected_images, ordered by value. | |
| void | dt_metadata_repository_cleanup (void) |
| Finalise the prepared statements. See dt_colorlabel_repository_cleanup(). | |
| void dt_metadata_repository_add | ( | const dt_metadata_row_t * | rows, |
| const size_t | count | ||
| ) |
Insert count rows as a single multi-VALUES statement.
Quoting is done here, with sqlite3_mprintf("%q", …). It used to be done by the caller, which is why common/metadata.c linked against sqlite for one function call: a module that has to escape its own strings for SQL is still writing SQL. Nothing happens when count is 0.
Definition at line 106 of file metadata_repository.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, i, dt_metadata_row_t::imgid, IS_NULL_PTR, dt_metadata_row_t::keyid, L, TRUE, and value.
Referenced by _bulk_add_metadata(), and test_metadata_foreach_selected().
Finalise the prepared statements. See dt_colorlabel_repository_cleanup().
Definition at line 184 of file metadata_repository.c.
Referenced by dt_metadata_cleanup(), and testdb_teardown().
| int32_t dt_metadata_repository_find_image_by_value | ( | const char * | value | ) |
The first image carrying value under any key, or -1.
Used to recognise an already-imported file by the filename-datetime marker the importer stores. Matches on value alone, across every key.
Definition at line 133 of file metadata_repository.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_TEXT, DT_DEBUG_SQLITE3_PREPARE_V2, L, and value.
Referenced by dt_metadata_already_imported().
| void dt_metadata_repository_foreach | ( | const int32_t | imgid, |
| dt_metadata_repository_row_cb | cb, | ||
| void * | user_data | ||
| ) |
Every metadata row of imgid, in row order.
Definition at line 149 of file metadata_repository.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, and L.
Referenced by dt_set_xmp_dt_metadata().
| void dt_metadata_repository_foreach_selected | ( | dt_metadata_repository_selected_cb | cb, |
| void * | user_data | ||
| ) |
Every distinct (key, value) pair across main.selected_images, ordered by value.
One pass instead of one dt_metadata_repository_get_values() call per key, which is what the panel needs: for each field it must know both the values present and whether every selected image agrees on one – hence the count travelling with the pair.
Definition at line 163 of file metadata_repository.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_PREPARE_V2, and L.
Referenced by _update(), and test_metadata_foreach_selected().
Every (key, value) pair of imgid, as a flat list.
dt_metadata_get_list_id() has always returned and what the XMP writer consumes. Definition at line 69 of file metadata_repository.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, L, and value.
Referenced by dt_metadata_get_list_id().
Values stored under keyid, ordered by value.
| imgid | the image, or a negative value for every selected image. |
GList of newly allocated strings, never containing NULL (a NULL column comes back as ""). Free with g_list_free_full(l, g_free). Definition at line 28 of file metadata_repository.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, IS_NULL_PTR, L, and value.
Referenced by dt_metadata_get().
Delete the rows of imgid whose key is in keyid_list, a comma-separated list of decimal key ids. Does nothing when keyid_list is NULL.
Definition at line 91 of file metadata_repository.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, IS_NULL_PTR, and L.
Referenced by _bulk_remove_metadata().