![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "database/removed_image_repository.h"#include "common/logging.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 removed_image_repository.c:Go to the source code of this file.
Data Structures | |
| struct | _removed_table_t |
Typedefs | |
| typedef struct _removed_table_t | _removed_table_t |
Functions | |
| static gchar * | _columns_of (const char *table) |
| static gboolean | _run (const char *query, const int snap_id, const int32_t imgid) |
| static int | _next_id (const int32_t imgid) |
| static void | _debug_memory (const char *stage, const int snap_id, const int32_t imgid) |
| int | dt_removed_image_repository_create (const int32_t imgid) |
Copy every row imgid owns out of main, so the removal about to happen can be undone. | |
| gboolean | dt_removed_image_repository_restore (const int snap_id, const int32_t imgid) |
Copy snapshot snap_id of imgid back into main, film roll included. | |
| void | dt_removed_image_repository_clear (const int snap_id, const int32_t imgid) |
Drop snapshot snap_id of imgid, making the removal permanent. | |
Variables | |
| static const _removed_table_t | _removed_tables [] |
| typedef struct _removed_table_t _removed_table_t |
|
static |
Definition at line 67 of file removed_image_repository.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_PREPARE_V2, dt_free, IS_NULL_PTR, and name.
Referenced by dt_removed_image_repository_create(), and dt_removed_image_repository_restore().
|
static |
Definition at line 131 of file removed_image_repository.c.
References DT_DEBUG_MEMORY, and dt_print().
Referenced by dt_removed_image_repository_clear(), and dt_removed_image_repository_create().
|
static |
Definition at line 108 of file removed_image_repository.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, and IS_NULL_PTR.
Referenced by dt_removed_image_repository_create().
|
static |
Definition at line 92 of file removed_image_repository.c.
References dt_database_get_sqlite3_global(), DT_DEBUG_SQLITE3_BIND_INT, DT_DEBUG_SQLITE3_PREPARE_V2, FALSE, and IS_NULL_PTR.
Referenced by dt_removed_image_repository_clear(), dt_removed_image_repository_create(), and dt_removed_image_repository_restore().
| void dt_removed_image_repository_clear | ( | const int | snap_id, |
| const int32_t | imgid | ||
| ) |
Drop snapshot snap_id of imgid, making the removal permanent.
Definition at line 264 of file removed_image_repository.c.
References _debug_memory(), _removed_tables, _run(), dt_free, i, and name.
Referenced by _remove_undo_data_free(), and test_clear_drops_the_snapshot().
| int dt_removed_image_repository_create | ( | const int32_t | imgid | ) |
Copy every row imgid owns out of main, so the removal about to happen can be undone.
Call this BEFORE anything touches the image: the group membership of the images staying behind is part of the snapshot, and removing a group's leader rewrites it.
The snapshot id is allocated here rather than asked for separately, so that reading the highest id an image already has and writing rows under the next one happen inside the same transaction.
Definition at line 138 of file removed_image_repository.c.
References _columns_of(), _debug_memory(), _next_id(), _removed_tables, _run(), dt_database_release_transaction, dt_database_rollback_transaction(), dt_database_start_transaction, dt_free, i, IS_NULL_PTR, name, and TRUE.
Referenced by _image_remove(), test_clear_drops_the_snapshot(), test_film_roll_comes_back_with_its_last_image(), test_group_leader_restores_membership(), test_partial_undo_repoints_a_departed_leader(), test_round_trip_restores_every_table(), test_successive_snapshots_do_not_collide(), and test_whole_group_removed_and_fully_undone_keeps_one_group().
| gboolean dt_removed_image_repository_restore | ( | const int | snap_id, |
| const int32_t | imgid | ||
| ) |
Copy snapshot snap_id of imgid back into main, film roll included.
Foreign keys are deferred to the commit, because an image is restored before the group leader it points at may be: a group removed in one go comes back one image per undo record, in whatever order the undo list holds. Any group_id still dangling at the end of the restore is repointed at the image itself rather than left to fail the commit.
Definition at line 193 of file removed_image_repository.c.
References _columns_of(), _removed_tables, _run(), dt_database_get_sqlite3_global(), dt_database_release_transaction, dt_database_rollback_transaction(), dt_database_start_transaction, dt_free, i, IS_NULL_PTR, name, and TRUE.
Referenced by _pop_undo(), test_clear_drops_the_snapshot(), test_film_roll_comes_back_with_its_last_image(), test_group_leader_restores_membership(), test_partial_undo_repoints_a_departed_leader(), test_round_trip_restores_every_table(), test_successive_snapshots_do_not_collide(), and test_whole_group_removed_and_fully_undone_keeps_one_group().
|
static |
Definition at line 52 of file removed_image_repository.c.
Referenced by dt_removed_image_repository_clear(), dt_removed_image_repository_create(), and dt_removed_image_repository_restore().