Database table descriptor. More...
#include <bpstable.h>
Public Types | |
enum | Command { EndListFields , EndRegularFields } |
Table field control commands. More... | |
Public Member Functions | |
BpsTable (BpsDatastore *aDatastore, const QString &aName, const QString &aOrder=QString(), const QString &aFilter=QString()) | |
BpsTable (const BpsTable &aOther) | |
The copy constructor. More... | |
bool | canAdd () const |
True if the current user has permission to add records the table. More... | |
bool | canDelete () const |
True if the current user has permission to delete records from the table. More... | |
bool | canEdit () const |
True if the current user has permission to edit records in the table. More... | |
bool | canMove () const |
True if the current user has permission to move records in the table (change parent, normally by drag/drop). More... | |
int | count () const |
BpsDatastore * | datastore () const |
BpsTableField * | field (const QString &aColumn) const |
Get field by column name. More... | |
BpsTableField * | field (int aIndex) const |
Get field by index. More... | |
int | fieldIndex (const QString &aColumn) const |
Get the index of a certain column name. More... | |
QString | filter () const |
bool | isCopyEnabled () const |
Copying enabled. More... | |
int | listCount () const |
QString | name () const |
BpsTable & | operator<< (BpsTableField *aField) |
Add a field to the end of the list. More... | |
BpsTable & | operator<< (Command aCommand) |
Apply a field control command. More... | |
QString | order () const |
QString | rawname () const |
int | regularCount () const |
void | setCanAdd (bool aEnable) |
Change the add permission. More... | |
void | setCanDelete (bool aEnable) |
Change the delete permission. More... | |
void | setCanEdit (bool aEnable) |
Change the edit permission. More... | |
void | setCanMove (bool aEnable) |
Change the move permissission. More... | |
void | setCopyEnabled (bool aEnable) |
Change the copy enabling. More... | |
void | setFilter (const QString &aFilter) |
Set the select filter. More... | |
void | setName (const QString &aName) |
Set the table name. More... | |
void | setOrder (const QString &aOrder) |
Set the select order. More... | |
Database table descriptor.
This objects are used by the BpsTableModel. The fields should not contain the columns c_key, c_parent, or the column referencing the master table in case of slave tables.
enum BpsTable::Command |
BpsTable::BpsTable | ( | BpsDatastore * | aDatastore, |
const QString & | aName, | ||
const QString & | aOrder = QString() , |
||
const QString & | aFilter = QString() |
||
) |
aDatastore | The datastore connection used. |
aName | The table name. Can also be a view name, or a subquery in parenthesis like "(select ...)" for read-only applications. |
aOrder | A list of columns appended to the order by clause, but without the ORDER BY keywords. |
aFilter | A where clause, but without the WHERE keyword. |
BpsTable::BpsTable | ( | const BpsTable & | aOther | ) |
The copy constructor.
aOther | Other table to copy |
bool BpsTable::canAdd | ( | ) | const |
True if the current user has permission to add records the table.
The initial value is retrieved from the permissions for rawname()+".add".
bool BpsTable::canDelete | ( | ) | const |
True if the current user has permission to delete records from the table.
The initial value is retrieved from the permissions for rawname()+".delete".
bool BpsTable::canEdit | ( | ) | const |
True if the current user has permission to edit records in the table.
The initial value is retrieved from the permissions for rawname()+".edit".
bool BpsTable::canMove | ( | ) | const |
True if the current user has permission to move records in the table (change parent, normally by drag/drop).
The initial value is retrieved from the permissions for rawname()+".move".
int BpsTable::count | ( | ) | const |
BpsDatastore* BpsTable::datastore | ( | ) | const |
BpsTableField* BpsTable::field | ( | const QString & | aColumn | ) | const |
Get field by column name.
aColumn | The column name. |
BpsTableField* BpsTable::field | ( | int | aIndex | ) | const |
Get field by index.
aIndex | The field index, must be in the range 0 ... count()-1. |
int BpsTable::fieldIndex | ( | const QString & | aColumn | ) | const |
Get the index of a certain column name.
aColumn | The column name. |
QString BpsTable::filter | ( | ) | const |
bool BpsTable::isCopyEnabled | ( | ) | const |
Copying enabled.
It applies for example to the table t_stock which is added as slave table to t_articles in the articles master data application: Drag/drop operations with pressed CTRL key should not copy the stock table contents, while other slave table contents should get copied. The initial value is true.
int BpsTable::listCount | ( | ) | const |
QString BpsTable::name | ( | ) | const |
BpsTable& BpsTable::operator<< | ( | BpsTableField * | aField | ) |
Add a field to the end of the list.
The table object takes ownership of the fields, e.g. the fields will get deleted on table destruction.
aField | The field definition |
Apply a field control command.
aCommand | The command to apply. |
QString BpsTable::order | ( | ) | const |
QString BpsTable::rawname | ( | ) | const |
int BpsTable::regularCount | ( | ) | const |
void BpsTable::setCanAdd | ( | bool | aEnable | ) |
Change the add permission.
aEnable | The new permission. |
void BpsTable::setCanDelete | ( | bool | aEnable | ) |
Change the delete permission.
aEnable | The new permission. |
void BpsTable::setCanEdit | ( | bool | aEnable | ) |
Change the edit permission.
aEnable | The new permission. |
void BpsTable::setCanMove | ( | bool | aEnable | ) |
Change the move permissission.
aEnable | The new permission. |
void BpsTable::setCopyEnabled | ( | bool | aEnable | ) |
Change the copy enabling.
aEnable | The new copy enable state. |
void BpsTable::setFilter | ( | const QString & | aFilter | ) |
Set the select filter.
aFilter | A where clause, but without the WHERE keyword. |
void BpsTable::setName | ( | const QString & | aName | ) |
Set the table name.
Can also be a view name, or a subquery in parenthesis like "(select ...)". Make sure the new table/view/subquery includes the same fields as defined.
aName | The new table name. |
void BpsTable::setOrder | ( | const QString & | aOrder | ) |
Set the select order.
aOrder | A list of columns appended to the order by clause, but without the ORDER BY keywords. |