KDb

SqliteCursor.h
1 /* This file is part of the KDE project
2  Copyright (C) 2003-2010 JarosÅ‚aw Staniek <[email protected]>
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_SQLITECURSOR_H
21 #define KDB_SQLITECURSOR_H
22 
23 #include <QString>
24 
25 #include "KDbCursor.h"
26 
27 class SqliteCursorData;
28 class SqliteConnection;
29 
30 /*!
31 
32 */
33 class SqliteCursor : public KDbCursor
34 {
35 public:
36  ~SqliteCursor() override;
37  QVariant value(int i) override;
38 
39  /*! [PROTOTYPE] @return internal buffer data. */
40 //! @todo virtual const char *** bufferData()
41  /*! [PROTOTYPE] @return current record data or @c nullptr if there is no current records. */
42  const char ** recordData() const override;
43 
44  bool drv_storeCurrentRecord(KDbRecordData* data) const override;
45 
46  //! Implemented for KDbResultable
47  QString serverResultName() const override;
48 
49 protected:
50  /*! KDbCursor will operate on @a conn, raw @a sql statement will be used to execute query. */
51  SqliteCursor(SqliteConnection* conn, const KDbEscapedString& sql,
52  Options options = KDbCursor::Option::None);
53 
54  /*! KDbCursor will operate on @a conn, @a query schema will be used to execute query. */
55  SqliteCursor(SqliteConnection* conn, KDbQuerySchema* query,
56  Options options = KDbCursor::Option::None);
57 
58  bool drv_open(const KDbEscapedString& sql) override;
59 
60  bool drv_close() override;
61  void drv_getNextRecord() override;
62 
63  void drv_appendCurrentRecordToBuffer() override;
64  void drv_bufferMovePointerNext() override;
65  void drv_bufferMovePointerPrev() override;
66  void drv_bufferMovePointerTo(qint64 at) override;
67 
68 //! @todo virtual void drv_storeCurrentRecord();
69 
70  //PROTOTYPE:
71  /*! Method called when cursor's buffer need to be cleared
72  (only for buffered cursor type), eg. in close(). */
73  void drv_clearBuffer() override;
74 
75  void storeResult();
76 
77  SqliteCursorData * const d;
78 
79  friend class SqliteConnection;
80  Q_DISABLE_COPY(SqliteCursor)
81 };
82 
83 #endif
Provides database cursor functionality.
Definition: KDbCursor.h:68
virtual const char ** recordData() const =0
Specialized string for escaping.
virtual void drv_bufferMovePointerTo(qint64 at)=0
virtual void drv_appendCurrentRecordToBuffer()=0
SQLite-specific connection Following connection options are supported (see KDbConnectionOptions):
virtual QString serverResultName() const
Definition: KDbResult.cpp:209
virtual void drv_clearBuffer()
Definition: KDbCursor.h:285
virtual bool drv_open(const KDbEscapedString &sql)=0
virtual bool drv_storeCurrentRecord(KDbRecordData *data) const =0
Structure for storing single record with type information.
Definition: KDbRecordData.h:36
KDbQuerySchema provides information about database query.
virtual void drv_bufferMovePointerPrev()=0
virtual QVariant value(int i)=0
virtual void drv_bufferMovePointerNext()=0
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jun 25 2022 06:21:34 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.