File indexing completed on 2025-01-19 03:53:28
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2007-04-15 0007 * Description : Core database abstract backend. 0008 * 0009 * SPDX-FileCopyrightText: 2007-2009 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0010 * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 // Local includes 0017 0018 #include "coredbbackend.h" 0019 #include "coredbbackend_p.h" 0020 #include "coredbschemaupdater.h" 0021 #include "coredbwatch.h" 0022 0023 namespace Digikam 0024 { 0025 0026 CoreDbBackend::CoreDbBackend(DbEngineLocking* const locking, const QString& backendName) 0027 : BdEngineBackend(backendName, locking, *new CoreDbBackendPrivate(this)) 0028 { 0029 } 0030 0031 CoreDbBackend::~CoreDbBackend() 0032 { 0033 } 0034 0035 void CoreDbBackend::setCoreDbWatch(CoreDbWatch* watch) 0036 { 0037 Q_D(CoreDbBackend); 0038 d->watch = watch; 0039 } 0040 0041 bool CoreDbBackend::initSchema(CoreDbSchemaUpdater* updater) 0042 { 0043 Q_D(CoreDbBackend); 0044 0045 if (d->status == OpenSchemaChecked) 0046 { 0047 return true; 0048 } 0049 0050 if (d->status == Unavailable) 0051 { 0052 return false; 0053 } 0054 0055 if (updater->update()) 0056 { 0057 d->status = OpenSchemaChecked; 0058 return true; 0059 } 0060 0061 return false; 0062 } 0063 0064 void CoreDbBackend::recordChangeset(const ImageChangeset& changeset) 0065 { 0066 Q_D(CoreDbBackend); 0067 0068 // if we want to do compression of changesets, think about doing this here 0069 0070 d->imageChangesetContainer.recordChangeset(changeset); 0071 } 0072 0073 void CoreDbBackend::recordChangeset(const ImageTagChangeset& changeset) 0074 { 0075 Q_D(CoreDbBackend); 0076 d->imageTagChangesetContainer.recordChangeset(changeset); 0077 } 0078 0079 void CoreDbBackend::recordChangeset(const CollectionImageChangeset& changeset) 0080 { 0081 Q_D(CoreDbBackend); 0082 d->collectionImageChangesetContainer.recordChangeset(changeset); 0083 } 0084 0085 void CoreDbBackend::recordChangeset(const AlbumChangeset& changeset) 0086 { 0087 Q_D(CoreDbBackend); 0088 d->albumChangesetContainer.recordChangeset(changeset); 0089 } 0090 0091 void CoreDbBackend::recordChangeset(const TagChangeset& changeset) 0092 { 0093 Q_D(CoreDbBackend); 0094 d->tagChangesetContainer.recordChangeset(changeset); 0095 } 0096 0097 void CoreDbBackend::recordChangeset(const AlbumRootChangeset& changeset) 0098 { 0099 Q_D(CoreDbBackend); 0100 d->albumRootChangesetContainer.recordChangeset(changeset); 0101 } 0102 0103 void CoreDbBackend::recordChangeset(const SearchChangeset& changeset) 0104 { 0105 Q_D(CoreDbBackend); 0106 d->searchChangesetContainer.recordChangeset(changeset); 0107 } 0108 0109 } // namespace Digikam 0110 0111 #include "moc_coredbbackend.cpp"