Akonadi

selectquerybuilder.h
1/*
2 SPDX-FileCopyrightText: 2007 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "storage/datastore.h"
10#include "storage/querybuilder.h"
11
12namespace Akonadi
13{
14namespace Server
15{
16/**
17 Helper class for creating and executing database SELECT queries.
18*/
19template<typename T> class SelectQueryBuilder : public QueryBuilder
20{
21public:
22 /**
23 Creates a new query builder.
24 */
27 {
28 }
29
30 explicit inline SelectQueryBuilder(DataStore *store)
31 : QueryBuilder(store, T::tableName(), Select)
32 {
33 addColumns(T::fullColumnNames());
34 }
35
36 /**
37 Returns the result of this SELECT query.
38 */
40 {
41 return T::extractResult(dataStore(), query());
42 }
43};
44
45} // namespace Server
46} // namespace Akonadi
This class handles all the database access.
Definition datastore.h:95
Helper class to construct arbitrary SQL queries.
void addColumns(const QStringList &cols)
Adds the given columns to a select query.
QSqlQuery & query()
Returns the query, only valid after exec().
Helper class for creating and executing database SELECT queries.
SelectQueryBuilder()
Creates a new query builder.
QList< T > result()
Returns the result of this SELECT query.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:54:40 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.