kexi

kexidbcursor.h
1/***************************************************************************
2 * kexidbcursor.h
3 * This file is part of the KDE project
4 * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.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 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
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 KROSS_KEXIDB_KEXIDBCURSOR_H
21#define KROSS_KEXIDB_KEXIDBCURSOR_H
22
23#include <tqstring.h>
24
25#include <api/object.h>
26#include <api/variant.h>
27#include <api/list.h>
28#include <api/class.h>
29
30#include <kexidb/cursor.h>
31#include <kexidb/roweditbuffer.h>
32
33namespace Kross { namespace KexiDB {
34
35 // Forward declaration.
36 class KexiDBConnection;
37
85 class KexiDBCursor : public Kross::Api::Class<KexiDBCursor>
86 {
87 public:
88 KexiDBCursor(::KexiDB::Cursor* cursor);
89 virtual ~KexiDBCursor();
90 virtual const TQString getClassName() const;
91
92 private:
93
95 bool open();
97 bool isOpened();
99 bool reopen();
101 bool close();
102
104 bool moveFirst();
106 bool moveLast();
108 bool movePrev();
110 bool moveNext();
111
113 bool bof();
115 bool eof();
116
120 TQ_LLONG at();
122 uint fieldCount();
124 TQVariant value(uint index);
127 bool setValue(uint index, TQVariant value);
128
132 bool save();
133
134 private:
135 ::KexiDB::Cursor* m_cursor;
136
137 class Record {
138 public:
139 ::KexiDB::RowData rowdata;
141 Record(::KexiDB::Cursor* cursor)
142 : buffer( new ::KexiDB::RowEditBuffer(true) )
143 {
144 cursor->storeCurrentRow(rowdata);
145 }
146 ~Record()
147 {
148 delete buffer;
149 }
150 };
151 TQMap<TQ_LLONG, Record*> m_modifiedrecords;
152
153 void clearBuffers();
154 };
155
156}}
157
158#endif
159
Provides database cursor functionality.
Definition cursor.h:67
virtual void storeCurrentRow(RowData &data) const =0
provides data for single edited database row KexiDB::RowEditBuffer provides data for single edited ro...
A connection to a database.
TQValueVector< TQVariant > RowData
structure for storing single record with type information
Definition connection.h:47
KrossKexiDB provides access to the KexiDB database functionality.