File indexing completed on 2025-01-05 04:47:01

0001 /*
0002     SPDX-FileCopyrightText: 2012 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include <optional>
0010 
0011 class QString;
0012 class QSqlQuery;
0013 class QSqlDatabase;
0014 
0015 namespace Akonadi
0016 {
0017 namespace Server
0018 {
0019 /**
0020  * A per-thread cache (should be per session, but that'S the same for us) prepared
0021  * query cache.
0022  */
0023 namespace QueryCache
0024 {
0025 /// Returns the cached (and prepared) query for @p queryStatement
0026 std::optional<QSqlQuery> query(const QString &queryStatement);
0027 
0028 /// Insert @p query into the cache for @p queryStatement.
0029 void insert(const QSqlDatabase &db, const QString &queryStatement, const QSqlQuery &query);
0030 
0031 /// Clears all queries from current thread
0032 void clear();
0033 
0034 } // namespace QueryCache
0035 
0036 } // namespace Server
0037 } // namespace Akonadi