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>
21{
22public:
23 /**
24 Creates a new query builder.
25 */
28 {
29 }
30
31 explicit inline SelectQueryBuilder(DataStore *store)
32 : QueryBuilder(store, T::tableName(), Select)
33 {
34 addColumns(T::fullColumnNames());
35 }
36
37 /**
38 Returns the result of this SELECT query.
39 */
41 {
42 return T::extractResult(dataStore(), query());
43 }
44};
45
46} // namespace Server
47} // 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 Mon Nov 4 2024 16:31:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.