File indexing completed on 2024-04-28 15:58:50

0001 /* This file is part of the KDE project
0002    Copyright (C) 2003 Joseph Wenninger<jowenn@kde.org>
0003    Copyright (C) 2005-2010 Jarosław Staniek <staniek@kde.org>
0004 
0005    This program is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU Library General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 
0010    This program is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013    Library General Public License for more details.
0014 
0015    You should have received a copy of the GNU Library General Public License
0016    along with this program; see the file COPYING.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019 */
0020 
0021 #ifndef KDB_MYSQLCURSOR_H
0022 #define KDB_MYSQLCURSOR_H
0023 
0024 #include "KDbCursor.h"
0025 
0026 class KDbConnection;
0027 class MysqlCursorData;
0028 
0029 class MysqlCursor: public KDbCursor
0030 {
0031 public:
0032     MysqlCursor(KDbConnection* conn, const KDbEscapedString& sql,
0033                 KDbCursor::Options options = KDbCursor::Option::None);
0034     MysqlCursor(KDbConnection* conn, KDbQuerySchema* query,
0035                 KDbCursor::Options options = KDbCursor::Option::None);
0036     ~MysqlCursor() override;
0037 
0038     QVariant value(int pos) override;
0039     const char** recordData() const override;
0040     bool drv_storeCurrentRecord(KDbRecordData* data) const override;
0041     bool drv_open(const KDbEscapedString& sql) override;
0042     bool drv_close() override;
0043     void drv_getNextRecord() override;
0044     void drv_appendCurrentRecordToBuffer() override;
0045     void drv_bufferMovePointerNext() override;
0046     void drv_bufferMovePointerPrev() override;
0047     void drv_bufferMovePointerTo(qint64 to) override;
0048 
0049     //! Implemented for KDbResultable
0050     QString serverResultName() const override;
0051 
0052 private:
0053     void storeResult();
0054     MysqlCursorData * const d;
0055     Q_DISABLE_COPY(MysqlCursor)
0056 };
0057 
0058 #endif