File indexing completed on 2024-05-05 16:47:17

0001 /* This file is part of the KDE project
0002 Copyright (C) 2007   Sharan Rao <sharanrao@gmail.com>
0003 
0004 This program 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 program 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 program; see the file COPYING. 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 SYBASEDB_H
0021 #define SYBASEDB_H
0022 
0023 #include "KDbDriver.h"
0024 
0025 //! Sybase database driver.
0026 class SybaseDriver : public KDbDriver
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     /*!
0032      * Constructor sets database features and
0033      * maps the types in KDbField::Type to the Sybase types.
0034      */
0035     SybaseDriver(QObject *parent, const QVariantList &args);
0036 
0037     virtual ~SybaseDriver();
0038 
0039     virtual bool isSystemDatabaseName(const QString &n) const;
0040 
0041     //! Escape a string for use as a value
0042     virtual KDbEscapedString escapeString(const QString& str) const;
0043     virtual KDbEscapedString escapeString(const QByteArray& str) const;
0044 
0045     //! Escape BLOB value \a array
0046     virtual KDbEscapedString escapeBLOB(const QByteArray& array) const;
0047 
0048 protected:
0049     virtual QByteArray drv_escapeIdentifier(const QString& str) const;
0050     virtual QByteArray drv_escapeIdentifier(const QByteArray& str) const;
0051     virtual KDbConnection *drv_createConnection(const KDbConnectionData& connData,
0052                                                 const KDbConnectionOptions &options);
0053     virtual bool drv_isSystemFieldName(const QString& n) const;
0054     virtual KDbEscapedString addLimitTo1(const QString& sql, bool add = true);
0055 
0056 private:
0057     static const char *m_keywords[];
0058     QSet<QByteArray> m_systemDatabases;
0059 };
0060 
0061 #endif