Ilwis-Objects
1.0
GIS and Remote Sensing framework for data access and processing
|
#include <databasetable.h>
Public Member Functions | |
DatabaseTable () | |
DatabaseTable (const Resource &resource) | |
void | setDatabase (const QSqlDatabase &base) |
QSqlDatabase | database () const |
bool | createTable () |
bool | addColumn (const QString &name, const IDomain &domain) |
bool | prepare () |
bool | isValid () const |
QString | internalName () const |
template<class T > | |
bool | insertColumn (const QString &col, const QVector< T > &values, const IDomain &dom) |
template<class T > | |
bool | updateColumn (const QString &col, const QVector< T > &values) |
std::vector< QVariant > | record (quint32 n) const |
void | record (quint32 rec, const std::vector< QVariant > &vars, quint32 offset=0) |
std::vector< QVariant > | column (const QString &nme, quint32 start=0, quint32 stop=2e9) const |
std::vector< QVariant > | column (quint32 index, quint32 start=0, quint32 stop=2e9) const |
void | column (const QString &nme, const std::vector< QVariant > &vars, quint32 offset=0) |
void | column (quint32 index, const std::vector< QVariant > &vars, quint32 offset) |
QVariant | cell (const QString &col, quint32 rec, bool asRaw=true) const |
QVariant | cell (quint32, quint32 rec, bool asRaw=true) const |
void | setCell (const QString &col, quint32 rec, const QVariant &inputvar) |
void | setCell (quint32, quint32 rec, const QVariant &var) |
void | drop () |
IlwisTypes | ilwisType () const |
std::vector< quint32 > | select (const QString &conditions) const |
IlwisObject * | clone () |
void | newRecord () |
![]() | |
BaseTable () | |
BaseTable (const Resource &resource) | |
virtual quint32 | recordCount () const |
virtual quint32 | columnCount () const |
virtual void | recordCount (quint32 r) |
virtual bool | addColumn (const QString &name, const QString &domainname) |
virtual bool | addColumn (const ColumnDefinition &def) |
ColumnDefinition | columndefinition (const QString &nme) const |
ColumnDefinition | columndefinition (quint32 index) const |
ColumnDefinition & | columndefinition (quint32 index) |
void | columndefinition (const ColumnDefinition &coldef) |
bool | merge (const IlwisObject *obj, int options) |
void | dataLoaded (bool yesno) |
bool | isDataLoaded () const |
Additional Inherited Members | |
![]() | |
enum | ConnectorMode { cmINPUT =1, cmOUTPUT =2, cmEXTENDED =4 } |
The ConnectorMode enum Describes the state of the instance of the connector. More... | |
enum | StoreMode { smMETADATA =1, smBINARYDATA =2 } |
![]() | |
template<typename T > | |
static T | create (const QString &def) |
template<typename T > | |
static T | create (quint64 id) |
static IlwisObject * | create (const Resource &source, const PrepareOptions &options=PrepareOptions()) |
static IlwisTypes | findType (const QString &source) |
findType More... | |
static QString | type2Name (IlwisTypes t) |
static IlwisTypes | name2Type (const QString &name) |
static void | addTypeFunction (IlwisTypeFunction) |
addTypeFunction More... | |
static IlwisTypes | name2ExtendedType (const QString &dname) |
![]() | |
virtual void | adjustRange (int index) |
void | copyTo (IlwisObject *obj) |
quint32 | columnIndex (const QString &nme) const |
void | columnCount (int cnt) |
QVariant | checkInput (const QVariant &inputVar, quint32 columnIndex) |
void | initValuesColumn (const ColumnDefinition &def) |
void | initRecord (std::vector< QVariant > &values) const |
![]() | |
QHash< QString, ColumnDefinition > | _columnDefinitionsByName |
QHash< quint32, ColumnDefinition > | _columnDefinitionsByIndex |
Represents a table in the database Ilwis-Objects uses. In the default implementation it uses the internal sqllite database that qt has.
DatabaseTable::DatabaseTable | ( | ) |
Constructs an empty DatabaseTable and sets the sql create flag to false.
DatabaseTable::DatabaseTable | ( | const Resource & | resource | ) |
The constructor for a DatabaseTable with a a Resource that is registered in the mastercatalog.
This resource must have a name and an Id.
Code and description are optional.
And sets the sql create flag to false.
source | Resource that has to be used |
|
virtual |
adds a column to the current set of columns of this table
the name string must be unique and the domain must be valid.
if this collumn creates a duplicate nothing will happen.
the collumn will be filled with appropriate defaults depending on the domain
name | the name of a column must be unique among the columns |
domain | the domain of the new column |
Reimplemented from Ilwis::BaseTable.
|
virtual |
returns the value of a single record/field combination ( a cell).
Disabling asRaw (setting it to false) has negative effects on performance.
col | column name |
rec | record number |
asRaw | when set to false it will return the String value on Thematic and Identifier domains |
Implements Ilwis::Table.
|
virtual |
returns the value of a single record/field combination ( a cell).
Disabling asRaw (setting it to false) has negative effects on performance.
index | column index |
asRaw | when set to false it will return the String value on Thematic and Identifier domains |
rec | record number |
Implements Ilwis::Table.
|
virtual |
returns the content of a column with a name in a vector. Will return an empty vector if there is no collumn with that name
nme | name of the column to be returned |
start | The index at which it should start returning values(within the collumn) |
stop | The index at which it should stop returning values(within the collumn) |
Implements Ilwis::Table.
|
virtual |
returns the content of a column at a index in a vector. Will return an empty vector if there is no column with that name
index | the index of the column to be returned |
start | The index at which it should start returning values(within the collumn) |
stop | The index at which it should stop returning values(within the collumn) |
Implements Ilwis::Table.
|
virtual |
sets a column with values from variantlist. The list doesnt need to contain all the rows in a column but may contain a subset.
Note that the rows are in consecutive order.
nme | name of the column to be set |
vars | values of the rows |
offset | starting row form where the values are set. If the number of values to be added goes beyond the size of the table, new records will be added |
Implements Ilwis::Table.
|
virtual |
sets a column with values from variantlist. The list doesnt need to contain all the rows in a column but may contain a subset.
Note that the rows are in consecutive order.
index | index of the column to be set |
vars | values of the rows |
offset | starting row form where the values are set. If the number of values to be added goes beyond the size of the table, new records will be added |
Implements Ilwis::Table.
|
virtual |
Creates a table based on the definitions in the columndefinition members. Will load the data in the specified amount of collumns and rows
Reimplemented from Ilwis::BaseTable.
void DatabaseTable::drop | ( | ) |
Drops the data in this DatabaseTable.
Also removes it from the database, and sets dataloaded and sql create to false.
If anything fails the error can be found on the issuelogger
|
virtual |
Gives the IlwisTypes of this object
Reimplemented from Ilwis::BaseTable.
QString DatabaseTable::internalName | ( | ) | const |
Will try to construct the name of this table using the resource of this DatabaseTable.
The String will be of the following form : "<name>_<id>".
If it fails sUNDEF will be returned.
|
virtual |
a BaseTable is valid if it has rows and columns
Reimplemented from Ilwis::BaseTable.
|
virtual |
Adds a new record to this table It will be filled with appropriate default values depending on the domain(s)
Implements Ilwis::Table.
|
virtual |
tries to Prepares this ilwisobject for use
Reimplemented from Ilwis::BaseTable.
|
virtual |
retrieves a record from a table. A record contains all the fields for one row. This method is implemented in the derivatives
of table as how records are organized is quite different between the derivatives
n | the row/record number of the record |
Implements Ilwis::Table.
|
virtual |
sets a record with values from variantlist. The list doesnt need to contain all the fields in a record but may contain a subset.
Note that the fields are in consecutive order. It is up to the programmer that the order of fields in the list match the order of fields in the table
rec | record that has to be updated. If the record number is beyond the last record or the record is iUNDEF, the record will appended to the end |
vars | the list values to be set |
offset | starting point of the field to be set |
Implements Ilwis::Table.
|
virtual |
Selects the indices of all collumns that meet the conditions specified in the conditions String
so for example: if conditions is
it will return all indices at which collumns 1 and 2 meet the requirements
This function is still under development, only the most basic expressions are implemented at this time
conditions |
Implements Ilwis::Table.
|
virtual |
Sets the value of a single cell
col | column name of the cell to be set |
rec | record number of the cell to be set |
var | the new value of the cell |
Implements Ilwis::Table.
|
virtual |
Sets the value of a single cell
col | index of the column of the cell to be set |
rec | record number of the cell to be set |
var | the new value of the cell |
Implements Ilwis::Table.