#include <DataSource.h>
Public Member Functions | |
DataSource ()=default | |
virtual | ~DataSource ()=default |
virtual Field & | operator[] (size_t fieldIndex)=0 |
virtual Field & | operator[] (const String &fieldName)=0 |
virtual size_t | fieldCount () const =0 |
virtual size_t | recordCount () const =0 |
virtual bool | readField (const char *fieldName, Variant &fieldValue)=0 |
virtual bool | writeField (const char *fieldName, const Variant &fieldValue)=0 |
virtual bool | open () |
virtual bool | close () |
virtual bool | first () |
virtual bool | next () |
virtual bool | prior () |
virtual bool | last () |
virtual bool | find (const String &, const Variant &) |
virtual bool | eof () const |
bool | load () |
bool | save () |
void | exportRowTo (const xdoc::SNode &node, bool compactXmlMode, bool nullLargeData=false) |
virtual void | exportTo (xdoc::Node &parentNode, const String &nodeName, bool compactXmlMode) |
Protected Member Functions | |
virtual bool | loadData () |
virtual bool | saveData () |
Friends | |
class | Fl_Group |
Universal data source for many SPTK widgets.
It's designed as a base class for multiple datasources available in SPTK. The main idea is to provide the simple interface that allows to open the datasource with certain parameters and read or write the datasource fields. And don't you forget to close it :)
|
default |
Default constructor
|
virtualdefault |
Destructor
|
inlinevirtual |
Closes the datasource. Implemented in derved class.
Reimplemented in sptk::Query, and sptk::MemoryDS.
|
inlinevirtual |
Returns true if there are no more records in the datasource. Implemented in derved class.
Reimplemented in sptk::QueryStatementManagement, and sptk::MemoryDS.
void sptk::DataSource::exportRowTo | ( | const xdoc::SNode & | node, |
bool | compactXmlMode, | ||
bool | nullLargeData = false |
||
) |
Saves dataset row data into XDoc
If the compactXmlMode is true, the node would have fields presented as attributues. Otherwise, the fields are stored as subnodes.
node | XDoc node to fill in |
compactXmlMode | Compact XML flag |
nullLargeData | Set text data longer than 256 bytes to null |
|
virtual |
Saves data into XDoc
Opens the dataset, reads every row, and closes dataset. For every row in the dataset, creates the node with the name nodeName. If the compactXmlMode is true, the nodes would have fields presented as attributues. Otherwise, the fields are stored as subnodes.
parentNode | XDoc node to add subnodes to |
nodeName | Name for subnodes |
compactXmlMode | Compact XML flag |
|
pure virtual |
Returns field count in the datasource.
Purely virtual. Should be implemented in derived class
Implemented in sptk::Query, and sptk::MemoryDS.
Moves to the specified record position of the datasource. Implemented in derved class.
Reimplemented in sptk::MemoryDS.
|
inlinevirtual |
Moves to the first record of the datasource. Implemented in derved class.
Reimplemented in sptk::MemoryDS.
|
inlinevirtual |
Moves to the last record of the datasource. Implemented in derved class.
Reimplemented in sptk::MemoryDS.
bool sptk::DataSource::load | ( | ) |
Loads data into the datasource
|
inlineprotectedvirtual |
Loads datasource data. Should be implemented in derived class
Reimplemented in sptk::Query.
|
inlinevirtual |
Moves to the next record of the datasource. Implemented in derved class.
Reimplemented in sptk::Query, and sptk::MemoryDS.
|
inlinevirtual |
Opens the datasource. Implemented in derved class.
Reimplemented in sptk::Query, sptk::DirectoryDS, sptk::MemoryDS, and sptk::ImapDS.
Field access by the field name, const version.
Purely virtual. Should be implemented in derived class
fieldName | Field name |
Implemented in sptk::Query, and sptk::MemoryDS.
|
pure virtual |
Field access by the field index, non-const version
Purely virtual. Should be implemented in derived class
fieldIndex | Field index |
Implemented in sptk::Query, and sptk::MemoryDS.
|
inlinevirtual |
Moves to the prior record of the datasource. Implemented in derved class.
Reimplemented in sptk::MemoryDS.
|
pure virtual |
Reads the field by name from the datasource.
Purely virtual. Should be implemented in derived class
Implemented in sptk::MemoryDS, and sptk::Query.
|
pure virtual |
Returns record count in the datasource.
Purely virtual. Should be implemented in derived class
Implemented in sptk::Query, and sptk::MemoryDS.
bool sptk::DataSource::save | ( | ) |
Saves data from the datasource
|
inlineprotectedvirtual |
Saves data from datasource. Should be implemented in derived class
Reimplemented in sptk::Query.
|
pure virtual |
Writes the field by name from the datasource.
Purely virtual. Should be implemented in derived class
Implemented in sptk::MemoryDS, and sptk::Query.