File indexing completed on 2025-01-19 03:53:46

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2007-04-15
0007  * Description : Thumbnails database 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 "thumbsdbbackend.h"
0019 #include "dbenginebackend_p.h"
0020 #include "thumbsdbschemaupdater.h"
0021 
0022 namespace Digikam
0023 {
0024 
0025 ThumbsDbBackend::ThumbsDbBackend(DbEngineLocking* const locking, const QString& backendName)
0026     : BdEngineBackend(backendName, locking, *new BdEngineBackendPrivate(this))
0027 {
0028 }
0029 
0030 ThumbsDbBackend::~ThumbsDbBackend()
0031 {
0032 }
0033 
0034 bool ThumbsDbBackend::initSchema(ThumbsDbSchemaUpdater* const updater)
0035 {
0036     Q_D(BdEngineBackend);
0037 
0038     if (d->status == OpenSchemaChecked)
0039     {
0040         return true;
0041     }
0042 
0043     if (d->status == Unavailable)
0044     {
0045         return false;
0046     }
0047 
0048     if (updater->update())
0049     {
0050         d->status = OpenSchemaChecked;
0051         return true;
0052     }
0053 
0054     return false;
0055 }
0056 
0057 } // namespace Digikam
0058 
0059 #include "moc_thumbsdbbackend.cpp"