Akonadi

selectquerybuilder.h
1 /*
2  SPDX-FileCopyrightText: 2007 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef AKONADI_SELECTQUERYBUILDER_H
8 #define AKONADI_SELECTQUERYBUILDER_H
9 
10 #include "storage/querybuilder.h"
11 
12 namespace Akonadi
13 {
14 namespace Server
15 {
16 /**
17  Helper class for creating and executing database SELECT queries.
18 */
19 template<typename T> class SelectQueryBuilder : public QueryBuilder
20 {
21 public:
22  /**
23  Creates a new query builder.
24  */
26  : QueryBuilder(T::tableName(), Select)
27  {
28  addColumns(T::fullColumnNames());
29  }
30 
31  /**
32  Returns the result of this SELECT query.
33  */
35  {
36  return T::extractResult(query());
37  }
38 };
39 
40 } // namespace Server
41 } // namespace Akonadi
42 
43 #endif
QVector< T > result()
Returns the result of this SELECT query.
Helper class for creating and executing database SELECT queries.
void addColumns(const QStringList &cols)
Adds the given columns to a select query.
SelectQueryBuilder()
Creates a new query builder.
QSqlQuery & query()
Returns the query, only valid after exec().
Helper class to construct arbitrary SQL queries.
Definition: querybuilder.h:31
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jun 30 2022 03:51:46 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.