File indexing completed on 2024-04-21 15:30:13

0001 /* This file is part of the KDE project
0002    Copyright (C) 2003-2016 Jarosław Staniek <staniek@kde.org>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef KDB_DRIVER_P_H
0021 #define KDB_DRIVER_P_H
0022 
0023 #include <QSet>
0024 
0025 #include "KDbUtils.h"
0026 #include "KDbDriverBehavior.h"
0027 
0028 class KDbAdminTools;
0029 class KDbConnection;
0030 class KDbDriver;
0031 class KDbDriverMetaData;
0032 
0033 /*! Private driver's data members. */
0034 class KDbDriverPrivate
0035 {
0036 public:
0037     explicit KDbDriverPrivate(KDbDriver *aDriver);
0038     virtual ~KDbDriverPrivate();
0039 
0040     //! Accessor to the KDbDriverBehavior object for driver @a driver.
0041     inline static const KDbDriverBehavior *behavior(const KDbDriver *driver) { return driver->behavior(); }
0042 
0043     //! @overload
0044     inline static KDbDriverBehavior *behavior(KDbDriver *driver) { return driver->behavior(); }
0045 
0046     KDbDriver *driver;
0047 
0048     KDbDriverBehavior driverBehavior;
0049 
0050     QSet<KDbConnection*> connections;
0051 
0052     /*! Driver's metadata. */
0053     const KDbDriverMetaData *metaData;
0054 
0055     /*! Provides a number of database administration tools for the driver. */
0056     KDbAdminTools *adminTools;
0057 
0058     /*! Driver-specific SQL keywords that need to be escaped if used as an
0059       identifier (e.g. for a table or column name) that aren't also KDbSQL
0060       keywords.  These don't necessarily need to be escaped when displayed by
0061       the front-end, because they won't confuse the parser.  However, they do
0062       need to be escaped before sending to the DB-backend which will have
0063       it's own parser.
0064     */
0065     KDbUtils::StaticSetOfStrings driverSpecificSqlKeywords;
0066 
0067     /*! KDbSQL keywords that need to be escaped if used as an identifier (e.g.
0068     for a table or column name).  These keywords will be escaped by the
0069     front-end, even if they are not recognised by the backend to provide
0070     UI consistency and to allow DB migration without changing the queries.
0071     */
0072     static const char* const kdbSQLKeywords[];
0073 
0074     friend class KDbDriver;
0075 private:
0076     Q_DISABLE_COPY(KDbDriverPrivate)
0077 };
0078 
0079 #endif