Documents > BPS V2 C++ API
BpsTable Class Reference

Database table descriptor. More...

#include <bpstable.h>

List of all members.

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.
bool canAdd () const
 True if the current user has permission to add records the table.
bool canDelete () const
 True if the current user has permission to delete records from the table.
bool canEdit () const
 True if the current user has permission to edit records in the table.
bool canMove () const
 True if the current user has permission to move records in the table (change parent, normally by drag/drop).
int count () const
BpsDatastoredatastore () const
BpsTableFieldfield (int aIndex) const
 Get field by index.
BpsTableFieldfield (const QString &aColumn) const
 Get field by column name.
int fieldIndex (const QString &aColumn) const
 Get the index of a certain column name.
QString filter () const
bool isCopyEnabled () const
 Copying enabled.
int listCount () const
QString name () const
BpsTableoperator<< (BpsTableField *aField)
 Add a field to the end of the list.
BpsTableoperator<< (Command aCommand)
 Apply a field control command.
QString order () const
QString rawname () const
int regularCount () const
void setCanAdd (bool aEnable)
 Change the add permission.
void setCanDelete (bool aEnable)
 Change the delete permission.
void setCanEdit (bool aEnable)
 Change the edit permission.
void setCanMove (bool aEnable)
 Change the move permissission.
void setCopyEnabled (bool aEnable)
 Change the copy enabling.
void setFilter (const QString &aFilter)
 Set the select filter.
void setOrder (const QString &aOrder)
 Set the select order.

Detailed Description

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.


Member Enumeration Documentation

Table field control commands.

Enumerator:
EndListFields 

End of list displayed fields, following fields loaded but not displayed.

EndRegularFields 

End of regular (view displayed) fields, following fields are additional and loaded on demand only.


Constructor & Destructor Documentation

BpsTable::BpsTable ( BpsDatastore aDatastore,
const QString &  aName,
const QString &  aOrder = QString(),
const QString &  aFilter = QString() 
)
Parameters:
[in]aDatastoreThe datastore connection used.
[in]aNameThe table (or view) name.
[in]aOrderA list of columns appended to the order by clause, but without the ORDER BY keywords.
[in]aFilterA where clause, but without the WHERE keyword.
BpsTable::BpsTable ( const BpsTable aOther)

The copy constructor.

Parameters:
[in]aOtherOther table to copy

Member Function Documentation

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".

Returns:
True if current user has add permission, false if not.
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".

Returns:
True if current user has delete permission, false if not.
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".

Returns:
True if current user has edit permission, false if not.
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".

Returns:
True if current user has move permission, false if not.
int BpsTable::count ( ) const
Returns:
The total number of field (column) definitions
BpsDatastore* BpsTable::datastore ( ) const
Returns:
The datastore used.
BpsTableField* BpsTable::field ( int  aIndex) const

Get field by index.

Parameters:
[in]aIndexThe field index, must be in the range 0 ... count()-1.
Returns:
The field record.
BpsTableField* BpsTable::field ( const QString &  aColumn) const

Get field by column name.

Parameters:
[in]aColumnThe column name.
Returns:
The field record, or 0 if not found.
int BpsTable::fieldIndex ( const QString &  aColumn) const

Get the index of a certain column name.

Parameters:
[in]aColumnThe column name.
Returns:
Index of the found field when >= 0, -1 if no matching field found.
QString BpsTable::filter ( ) const
Returns:
The current filter conditions.
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.

Returns:
True if copying is enabled (apart from any permissions).
int BpsTable::listCount ( ) const
Returns:
The number of list column fields
QString BpsTable::name ( ) const
Returns:
The table (or view) name.
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.

Parameters:
[in]aFieldThe field definition
Returns:
Reference to the table object.
BpsTable& BpsTable::operator<< ( Command  aCommand)

Apply a field control command.

Parameters:
[in]aCommandThe command to apply.
Returns:
Reference to the table object.
QString BpsTable::order ( ) const
Returns:
The current order column list.
QString BpsTable::rawname ( ) const
Returns:
The table (or view) name with the prefix removed. The prefix is all up to and including the first underline in the table or view name.
int BpsTable::regularCount ( ) const
Returns:
The number of regular field (column) definitions
void BpsTable::setCanAdd ( bool  aEnable)

Change the add permission.

Parameters:
[in]aEnableThe new permission.
void BpsTable::setCanDelete ( bool  aEnable)

Change the delete permission.

Parameters:
[in]aEnableThe new permission.
void BpsTable::setCanEdit ( bool  aEnable)

Change the edit permission.

Parameters:
[in]aEnableThe new permission.
void BpsTable::setCanMove ( bool  aEnable)

Change the move permissission.

Parameters:
[in]aEnableThe new permission.
void BpsTable::setCopyEnabled ( bool  aEnable)

Change the copy enabling.

Parameters:
[in]aEnableThe new copy enable state.
void BpsTable::setFilter ( const QString &  aFilter)

Set the select filter.

Parameters:
[in]aFilterA where clause, but without the WHERE keyword.
void BpsTable::setOrder ( const QString &  aOrder)

Set the select order.

Parameters:
[in]aOrderA list of columns appended to the order by clause, but without the ORDER BY keywords.

The documentation for this class was generated from the following file: