#include <roweditbuffer.h>
Public Types | |
| typedef TQStringVariantMap | SimpleMap |
| typedef TQMap< QueryColumnInfo *, TQVariant > | DBMap |
Public Member Functions | |
| RowEditBuffer (bool dbAwareBuffer) | |
| bool | isDBAware () const |
| void | clear () |
| bool | isEmpty () const |
| void | insert (QueryColumnInfo &ci, TQVariant &val) |
| void | insert (const TQString &fname, TQVariant &val) |
| const TQVariant * | at (QueryColumnInfo &ci, bool useDefaultValueIfPossible=true) const |
| const TQVariant * | at (Field &f) const |
| const TQVariant * | at (const TQString &fname) const |
| bool | hasDefaultValueAt (QueryColumnInfo &ci) const |
| const SimpleMap | simpleBuffer () |
| const DBMap | dbBuffer () |
| void | debug () |
Protected Attributes | |
| SimpleMap * | m_simpleBuffer |
| SimpleMap::ConstIterator * | m_simpleBufferIt |
| DBMap * | m_dbBuffer |
| DBMap::Iterator * | m_dbBufferIt |
| TQMap< QueryColumnInfo *, bool > * | m_defaultValuesDbBuffer |
| TQMap< QueryColumnInfo *, bool >::ConstIterator * | m_defaultValuesDbBufferIt |
Detailed Description
provides data for single edited database row KexiDB::RowEditBuffer provides data for single edited row, needed to perform update at the database backend. Its advantage over pasing e.g. KexiDB::FieldList object is that EditBuffer contains only changed values.
EditBuffer offers two modes: db-aware and not-db-aware. Db-aware buffer addresses a field using references to QueryColumnInfo object, while not-db-aware buffer addresses a field using its name.
Example usage of not-db-aware buffer: QuerySchema *query = ..... EditBuffer buf; buf.insert("name", "Joe"); buf.insert("surname", "Black"); buf.at("name"); //returns "Joe" buf.at("surname"); //returns "Black" buf.at(query->field("surname")); //returns "Black" too Now you can use buf to add or edit records using KexiDB::Connection::updateRow(), KexiDB::Connection::insertRow()
Example usage of db-aware buffer: QuerySchema *query = ..... QueryColumnInfo *ci1 = ....... //e.g. can be obtained from QueryScehma::fieldsExpanded() QueryColumnInfo *ci2 = ....... EditBuffer buf; buf.insert(*ci1, "Joe"); buf.insert(*ci2, "Black"); buf.at(*ci1); //returns "Joe" buf.at(*ci2); //returns "Black" Now you can use buf to add or edit records using KexiDB::Connection::updateRow(), KexiDB::Connection::insertRow()
You can use TQMap::clear() to clear buffer contents, TQMap::isEmpty() to see if buffer is empty. For more, see TQMap documentation.
Notes: added fields should come from the same (common) QuerySchema object. However, this isn't checked at TQValue& EditBuffer::operator[]( const Field& f ) level.
Definition at line 74 of file roweditbuffer.h.
Member Typedef Documentation
◆ DBMap
| typedef TQMap<QueryColumnInfo*,TQVariant> KexiDB::RowEditBuffer::DBMap |
Definition at line 77 of file roweditbuffer.h.
◆ SimpleMap
| typedef TQStringVariantMap KexiDB::RowEditBuffer::SimpleMap |
Definition at line 76 of file roweditbuffer.h.
Constructor & Destructor Documentation
◆ RowEditBuffer()
| RowEditBuffer::RowEditBuffer | ( | bool | dbAwareBuffer | ) |
Definition at line 28 of file roweditbuffer.cpp.
◆ ~RowEditBuffer()
| RowEditBuffer::~RowEditBuffer | ( | ) |
Definition at line 38 of file roweditbuffer.cpp.
Member Function Documentation
◆ at() [1/3]
| const TQVariant * RowEditBuffer::at | ( | const TQString & | fname | ) | const |
Useful only for not-db-aware buffer.
- Returns
- value for field fname
Definition at line 83 of file roweditbuffer.cpp.
◆ at() [2/3]
| const TQVariant * RowEditBuffer::at | ( | Field & | f | ) | const |
Useful only for not-db-aware buffer.
- Returns
- value for field f
Definition at line 71 of file roweditbuffer.cpp.
◆ at() [3/3]
| const TQVariant * RowEditBuffer::at | ( | QueryColumnInfo & | ci, |
| bool | useDefaultValueIfPossible = true |
||
| ) | const |
Useful only for db-aware buffer.
- Returns
- value for column ci If there is no value assigned for the buffer, this method tries to remember and return default value obtained from ci if useDefaultValueIfPossible is true. Note that if the column is declared as unique (especially: primary key), default value will not be used.
Definition at line 47 of file roweditbuffer.cpp.
◆ clear()
| void RowEditBuffer::clear | ( | ) |
Definition at line 95 of file roweditbuffer.cpp.
◆ dbBuffer()
|
inline |
Definition at line 120 of file roweditbuffer.h.
◆ debug()
| void RowEditBuffer::debug | ( | ) |
For debugging purposes.
Definition at line 113 of file roweditbuffer.cpp.
◆ hasDefaultValueAt()
|
inline |
Useful only for db-aware buffer:
- Returns
- true if the value available as at( ci ) is obtained from column's default value
Definition at line 115 of file roweditbuffer.h.
◆ insert() [1/2]
|
inline |
Inserts value val for not-db-aware buffer's column fname.
Definition at line 97 of file roweditbuffer.h.
◆ insert() [2/2]
|
inline |
Inserts value val for db-aware buffer's column ci.
Definition at line 89 of file roweditbuffer.h.
◆ isDBAware()
|
inline |
Definition at line 82 of file roweditbuffer.h.
◆ isEmpty()
| bool RowEditBuffer::isEmpty | ( | ) | const |
Definition at line 104 of file roweditbuffer.cpp.
◆ simpleBuffer()
|
inline |
Definition at line 119 of file roweditbuffer.h.
Member Data Documentation
◆ m_dbBuffer
|
protected |
Definition at line 128 of file roweditbuffer.h.
◆ m_dbBufferIt
|
protected |
Definition at line 129 of file roweditbuffer.h.
◆ m_defaultValuesDbBuffer
|
protected |
Definition at line 130 of file roweditbuffer.h.
◆ m_defaultValuesDbBufferIt
|
protected |
Definition at line 131 of file roweditbuffer.h.
◆ m_simpleBuffer
|
protected |
Definition at line 126 of file roweditbuffer.h.
◆ m_simpleBufferIt
|
protected |
Definition at line 127 of file roweditbuffer.h.
The documentation for this class was generated from the following files:
