Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
common/database.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2010-2011 Henrik Andersson.
4 Copyright (C) 2010 johannes hanika.
5 Copyright (C) 2011-2012 Edouard Gomez.
6 Copyright (C) 2012 Richard Wonka.
7 Copyright (C) 2013-2017 Tobias Ellinghaus.
8 Copyright (C) 2019 Edgardo Hoszowski.
9 Copyright (C) 2020 Hubert Kowalski.
10 Copyright (C) 2020, 2022 Pascal Obry.
11 Copyright (C) 2022 Martin Bařinka.
12 Copyright (C) 2025 Alynx Zhou.
13 Copyright (C) 2025-2026 Aurélien PIERRE.
14 Copyright (C) 2025 Guillaume Stutin.
15
16 darktable is free software: you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation, either version 3 of the License, or
19 (at your option) any later version.
20
21 darktable is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
25
26 You should have received a copy of the GNU General Public License
27 along with darktable. If not, see <http://www.gnu.org/licenses/>.
28*/
29
30#pragma once
31
32#include <glib.h>
33#include <sqlite3.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39struct dt_database_t;
40
42struct dt_database_t *dt_database_init(const char *alternative, const gboolean load_data, const gboolean has_gui);
46sqlite3 *dt_database_get(const struct dt_database_t *);
48const gchar *dt_database_get_path(const struct dt_database_t *db);
52gboolean dt_database_show_error(const struct dt_database_t *db);
54void dt_database_optimize(const struct dt_database_t *);
56gboolean dt_database_maybe_maintenance(const struct dt_database_t *db, const gboolean has_gui, const gboolean closing_time);
61gboolean dt_database_snapshot(const struct dt_database_t *db);
63gboolean dt_database_maybe_snapshot(const struct dt_database_t *db);
65char **dt_database_snaps_to_remove(const struct dt_database_t *db);
67gchar *dt_database_get_most_recent_snap(const char* db_filename);
68
69
70// nested transactions support
76
77#define dt_database_start_transaction(db) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_SQL, dt_database_start_transaction_debug, (db))
78#define dt_database_release_transaction(db) DT_DEBUG_TRACE_WRAPPER(DT_DEBUG_SQL, dt_database_release_transaction_debug, (db))
79
80#ifdef __cplusplus
81}
82#endif
83
84// clang-format off
85// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
86// vim: shiftwidth=2 expandtab tabstop=2 cindent
87// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
88// clang-format on
struct dt_database_t * dt_database_init(const char *alternative, const gboolean load_data, const gboolean has_gui)
Definition common/database.c:3008
void dt_database_end_transaction_batch(const struct dt_database_t *db)
Definition common/database.c:4766
gchar * dt_database_get_most_recent_snap(const char *db_filename)
Definition common/database.c:4517
void dt_database_cleanup_busy_statements(const struct dt_database_t *db)
Definition common/database.c:3711
sqlite3 * dt_database_get(const struct dt_database_t *)
gboolean dt_database_snapshot(const struct dt_database_t *db)
Definition common/database.c:3974
void dt_database_perform_maintenance(const struct dt_database_t *db)
Definition common/database.c:3730
void dt_database_start_transaction_debug(const struct dt_database_t *db)
Definition common/database.c:4623
void dt_database_begin_transaction_batch(const struct dt_database_t *db)
Definition common/database.c:4746
void dt_database_optimize(const struct dt_database_t *)
Definition common/database.c:3908
char ** dt_database_snaps_to_remove(const struct dt_database_t *db)
Definition common/database.c:4232
gboolean dt_database_show_error(const struct dt_database_t *db)
gboolean dt_database_maybe_maintenance(const struct dt_database_t *db, const gboolean has_gui, const gboolean closing_time)
Definition common/database.c:3831
void dt_database_destroy(const struct dt_database_t *)
gboolean dt_database_get_lock_acquired(const struct dt_database_t *db)
void dt_database_release_transaction_debug(const struct dt_database_t *db)
Definition common/database.c:4673
const gchar * dt_database_get_path(const struct dt_database_t *db)
Definition common/database.c:3651
void dt_database_rollback_transaction(const struct dt_database_t *db)
Definition common/database.c:4713
gboolean dt_database_maybe_snapshot(const struct dt_database_t *db)
Definition common/database.c:4024
Definition common/database.c:99