KexiDB::RowEditBuffer Class Reference
#include <roweditbuffer.h>
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 QMap::clear() to clear buffer contents, QMap::isEmpty() to see if buffer is empty. For more, see QMap documentation.
Notes: added fields should come from the same (common) QuerySchema object. However, this isn't checked at QValue& EditBuffer::operator[]( const Field& f ) level.
Definition at line 74 of file roweditbuffer.h.
Public Types | |
| typedef QMap< QString, QVariant > | SimpleMap |
| typedef QMap< QueryColumnInfo *, QVariant > | DBMap |
Public Member Functions | |
| RowEditBuffer (bool dbAwareBuffer) | |
| ~RowEditBuffer () | |
| bool | isDBAware () const |
| void | clear () |
| bool | isEmpty () const |
| void | insert (QueryColumnInfo &ci, QVariant &val) |
| Inserts value val for db-aware buffer's column ci. | |
| void | insert (const QString &fname, QVariant &val) |
| Inserts value val for not-db-aware buffer's column fname. | |
| const QVariant * | at (QueryColumnInfo &ci, bool useDefaultValueIfPossible=true) const |
| const QVariant * | at (Field &f) const |
| Useful only for not-db-aware buffer. | |
| const QVariant * | at (const QString &fname) const |
| Useful only for not-db-aware buffer. | |
| bool | hasDefaultValueAt (QueryColumnInfo &ci) const |
| Useful only for db-aware buffer:. | |
| const SimpleMap | simpleBuffer () |
| const DBMap | dbBuffer () |
| void | debug () |
| For debugging purposes. | |
Protected Attributes | |
| SimpleMap * | m_simpleBuffer |
| SimpleMap::ConstIterator * | m_simpleBufferIt |
| DBMap * | m_dbBuffer |
| DBMap::Iterator * | m_dbBufferIt |
| QMap< QueryColumnInfo *, bool > * | m_defaultValuesDbBuffer |
| QMap< QueryColumnInfo *, bool >::ConstIterator * | m_defaultValuesDbBufferIt |
Member Typedef Documentation
|
|
Definition at line 77 of file roweditbuffer.h. |
|
|
Definition at line 76 of file roweditbuffer.h. |
Constructor & Destructor Documentation
|
|
Definition at line 28 of file roweditbuffer.cpp. |
|
|
Definition at line 38 of file roweditbuffer.cpp. References m_dbBuffer, m_dbBufferIt, m_defaultValuesDbBuffer, m_simpleBuffer, and m_simpleBufferIt. |
Member Function Documentation
|
|
Useful only for not-db-aware buffer.
Definition at line 83 of file roweditbuffer.cpp. References KexiDBWarn, m_simpleBuffer, and m_simpleBufferIt. |
|
|
Useful only for not-db-aware buffer.
Definition at line 71 of file roweditbuffer.cpp. References KexiDBWarn, m_simpleBuffer, and m_simpleBufferIt. |
|
||||||||||||
|
Useful only for db-aware buffer.
Definition at line 47 of file roweditbuffer.cpp. References hasDefaultValueAt(), KexiDB::isDefaultValueAllowed(), KexiDBWarn, m_dbBuffer, m_dbBufferIt, and m_defaultValuesDbBuffer. |
|
|
Definition at line 95 of file roweditbuffer.cpp. References m_dbBuffer, m_defaultValuesDbBuffer, and m_simpleBuffer. Referenced by KexiTableViewData::clearRowEditBuffer(), and KexiTableViewData::saveRow(). |
|
|
Definition at line 120 of file roweditbuffer.h. Referenced by KexiDB::Connection::insertRow(), and KexiDB::Connection::updateRow(). |
|
|
For debugging purposes.
Definition at line 113 of file roweditbuffer.cpp. References hasDefaultValueAt(), isDBAware(), KexiDBDbg, and m_dbBuffer. |
|
|
Useful only for db-aware buffer:.
Definition at line 115 of file roweditbuffer.h. |
|
||||||||||||
|
Inserts value val for not-db-aware buffer's column fname.
Definition at line 97 of file roweditbuffer.h. |
|
||||||||||||
|
Inserts value val for db-aware buffer's column ci.
Definition at line 89 of file roweditbuffer.h. Referenced by KexiTableViewData::updateRowEditBufferRef(). |
|
|
Definition at line 82 of file roweditbuffer.h. Referenced by debug(), and KexiTableViewData::updateRowEditBufferRef(). |
|
|
Definition at line 104 of file roweditbuffer.cpp. References m_dbBuffer. |
|
|
Definition at line 119 of file roweditbuffer.h. Referenced by KexiTableViewData::saveRow(). |
Member Data Documentation
|
|
Definition at line 128 of file roweditbuffer.h. Referenced by at(), clear(), debug(), isEmpty(), and ~RowEditBuffer(). |
|
|
Definition at line 129 of file roweditbuffer.h. Referenced by at(), and ~RowEditBuffer(). |
|
|
Definition at line 130 of file roweditbuffer.h. Referenced by at(), clear(), and ~RowEditBuffer(). |
|
|
Definition at line 131 of file roweditbuffer.h. |
|
|
Definition at line 126 of file roweditbuffer.h. Referenced by at(), clear(), and ~RowEditBuffer(). |
|
|
Definition at line 127 of file roweditbuffer.h. Referenced by at(), and ~RowEditBuffer(). |
The documentation for this class was generated from the following files:
