KDb

KDbProperties.h
1/* This file is part of the KDE project
2 Copyright (C) 2005 Jarosław Staniek <staniek@kde.org>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KDB_DBPROPERTIES_H
21#define KDB_DBPROPERTIES_H
22
23#include "KDbResult.h"
24
25class KDbConnection;
26
27//! @todo implement KConfigBase interface here?
28
29//! A set of storable database properties.
30/*! This is a convenience class that allows to store global database properties without a need
31 for creating and maintain custom table.
32 KDbProperties object is accessible only using KDbConnection::databaseProperties() method.
33 */
34class KDB_EXPORT KDbProperties : public KDbResultable
35{
36 Q_DECLARE_TR_FUNCTIONS(KDbProperties)
37public:
38 ~KDbProperties() override;
39
40 /*! Sets @a value for property @a name. Optional caption can be also set.
41 If there's no such property defined, it will be added. Existing value will be overwritten.
42 Note that to execute this method, database must be opened in read-write mode.
43 @return true on successful data. KDbConnection */
44 bool setValue(const QString& name, const QVariant& value);
45
46 /*! Sets @a caption for for property @a name.
47 Usually it shouldn't be translated: trnaslation can be performed before displaying. */
48 bool setCaption(const QString& name, const QString& caption);
49
50 //! @return property value for @a propeName available for this driver.
51 //! If there's no such property defined for driver, Null QVariant value is returned.
52 QVariant value(const QString& name);
53
54 //! @return translated property caption for @a name.
55 //! If there's no such property defined for driver, empty string value is returned.
56 QString caption(const QString& name);
57
58 //! @return a list of available property names.
59 QStringList names();
60
61protected:
62 explicit KDbProperties(KDbConnection *conn);
63
64 KDbConnection* m_conn;
65 friend class KDbConnectionPrivate;
66};
67
68#endif
Provides database connection, allowing queries and data modification.
A set of storable database properties.
Interface for classes providing a result.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:20:59 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.