KDb

MysqlConnection.h
1/* This file is part of the KDE project
2 Copyright (C) 2002 Lucijan Busch <lucijan@gmx.at>
3 Copyright (C) 2003 Joseph Wenninger<jowenn@kde.org>
4 Copyright (C) 2004-2016 Jarosław Staniek <staniek@kde.org>
5
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this program; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22#ifndef KDB_MYSQLCONNECTION_H
23#define KDB_MYSQLCONNECTION_H
24
25#include <QStringList>
26
27#include "KDbConnection.h"
28
29class MysqlConnectionInternal;
30
31/*! @short Provides database connection, allowing queries and data modification.
32*/
34{
35 Q_DECLARE_TR_FUNCTIONS(MysqlConnection)
36public:
37 ~MysqlConnection() override;
38
39 Q_REQUIRED_RESULT KDbCursor *prepareQuery(const KDbEscapedString &sql,
41 = KDbCursor::Option::None) override;
42 Q_REQUIRED_RESULT KDbCursor *prepareQuery(KDbQuerySchema *query,
44 = KDbCursor::Option::None) override;
45
46 Q_REQUIRED_RESULT KDbPreparedStatementInterface *prepareStatementInternal() override;
47
48protected:
49 /*! Used by driver */
52
53 bool drv_connect() override;
54 bool drv_getServerVersion(KDbServerVersionInfo* version) override;
55 bool drv_disconnect() override;
56 bool drv_getDatabasesList(QStringList* list) override;
57 //! reimplemented using "SHOW DATABASES LIKE..." because MySQL stores db names in lower case.
58 bool drv_databaseExists(const QString &dbName, bool ignoreErrors = true) override;
59 bool drv_createDatabase(const QString &dbName = QString()) override;
60 bool drv_useDatabase(const QString &dbName = QString(), bool *cancelled = nullptr,
61 KDbMessageHandler* msgHandler = nullptr) override;
62 bool drv_closeDatabase() override;
63 bool drv_dropDatabase(const QString &dbName = QString()) override;
64 Q_REQUIRED_RESULT KDbSqlResult *drv_prepareSql(const KDbEscapedString &sql) override;
65 bool drv_executeSql(const KDbEscapedString& sql) override;
66
67 //! Implemented for KDbResultable
68 QString serverResultName() const override;
69
70//! @todo move this somewhere to low level class (MIGRATION?)
71 tristate drv_containsTable(const QString &tableName) override;
72
73 void storeResult();
74
75 MysqlConnectionInternal* const d;
76
77 friend class MysqlDriver;
78 friend class MysqlCursorData;
79 friend class MysqlSqlResult;
80private:
81 Q_DISABLE_COPY(MysqlConnection)
82};
83
84#endif
Database specific connection data, e.g. host, port.
Generic options for a single connection. The options are accessible using key/value pairs....
Provides database connection, allowing queries and data modification.
KDbDriver * driver() const
KDbConnectionOptions * options()
Provides database cursor functionality.
Definition KDbCursor.h:69
Database driver's abstraction.
Definition KDbDriver.h:50
Specialized string for escaping.
Prepared statement interface for backend-dependent implementations.
KDbQuerySchema provides information about database query.
The KDbSqlResult class abstracts result of a raw SQL query preparation by KDbConnection::prepareSql()
Provides database connection, allowing queries and data modification.
bool drv_executeSql(const KDbEscapedString &sql) override
Executes query for a raw SQL statement sql without returning resulting records.
KDbSqlResult * drv_prepareSql(const KDbEscapedString &sql) override
Prepares query for a raw SQL statement sql with possibility of returning records.
bool drv_closeDatabase() override
bool drv_useDatabase(const QString &dbName=QString(), bool *cancelled=nullptr, KDbMessageHandler *msgHandler=nullptr) override
QString serverResultName() const override
Implemented for KDbResultable.
bool drv_dropDatabase(const QString &dbName=QString()) override
bool drv_connect() override
bool drv_createDatabase(const QString &dbName=QString()) override
KDbCursor * prepareQuery(const KDbEscapedString &sql, KDbCursor::Options options=KDbCursor::Option::None) override
tristate drv_containsTable(const QString &tableName) override
bool drv_getServerVersion(KDbServerVersionInfo *version) override
bool drv_getDatabasesList(QStringList *list) override
bool drv_disconnect() override
MysqlConnection(KDbDriver *driver, const KDbConnectionData &connData, const KDbConnectionOptions &options)
bool drv_databaseExists(const QString &dbName, bool ignoreErrors=true) override
reimplemented using "SHOW DATABASES LIKE..." because MySQL stores db names in lower case.
KDbPreparedStatementInterface * prepareStatementInternal() override
MySQL database driver.
Definition MysqlDriver.h:30
3-state logical type with three values: true, false and cancelled and convenient operators.
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.