BPS C++ API  2.24.4
BpsTable Class Reference

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
 
BpsDatastoredatastore () const
 
BpsTableFieldfield (const QString &aColumn) const
 Get field by column name. More...
 
BpsTableFieldfield (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
 
BpsTableoperator<< (BpsTableField *aField)
 Add a field to the end of the list. More...
 
BpsTableoperator<< (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...
 

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

◆ Command

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() [1/2]

BpsTable::BpsTable ( BpsDatastore aDatastore,
const QString aName,
const QString aOrder = QString(),
const QString aFilter = QString() 
)
Parameters
aDatastoreThe datastore connection used.
aNameThe table name. Can also be a view name, or a subquery in parenthesis like "(select ...)" for read-only applications.
aOrderA list of columns appended to the order by clause, but without the ORDER BY keywords.
aFilterA where clause, but without the WHERE keyword.

◆ BpsTable() [2/2]

BpsTable::BpsTable ( const BpsTable aOther)

The copy constructor.

Parameters
aOtherOther table to copy

Member Function Documentation

◆ canAdd()

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.

◆ canDelete()

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.

◆ canEdit()

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.

◆ canMove()

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.

◆ count()

int BpsTable::count ( ) const
Returns
The total number of field (column) definitions

◆ datastore()

BpsDatastore* BpsTable::datastore ( ) const
Returns
The datastore used.

◆ field() [1/2]

BpsTableField* BpsTable::field ( const QString aColumn) const

Get field by column name.

Parameters
aColumnThe column name.
Returns
The field record, or 0 if not found.

◆ field() [2/2]

BpsTableField* BpsTable::field ( int  aIndex) const

Get field by index.

Parameters
aIndexThe field index, must be in the range 0 ... count()-1.
Returns
The field record.

◆ fieldIndex()

int BpsTable::fieldIndex ( const QString aColumn) const

Get the index of a certain column name.

Parameters
aColumnThe column name.
Returns
Index of the found field when >= 0, -1 if no matching field found.

◆ filter()

QString BpsTable::filter ( ) const
Returns
The current filter conditions.

◆ isCopyEnabled()

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

◆ listCount()

int BpsTable::listCount ( ) const
Returns
The number of list column fields

◆ name()

QString BpsTable::name ( ) const
Returns
The table name, view name or subquery used in place.

◆ operator<<() [1/2]

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
aFieldThe field definition
Returns
Reference to the table object.

◆ operator<<() [2/2]

BpsTable& BpsTable::operator<< ( Command  aCommand)

Apply a field control command.

Parameters
aCommandThe command to apply.
Returns
Reference to the table object.

◆ order()

QString BpsTable::order ( ) const
Returns
The current order column list.

◆ rawname()

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. Not af use when a subquery was used as table, instead of a table or view name.

◆ regularCount()

int BpsTable::regularCount ( ) const
Returns
The number of regular field (column) definitions

◆ setCanAdd()

void BpsTable::setCanAdd ( bool  aEnable)

Change the add permission.

Parameters
aEnableThe new permission.

◆ setCanDelete()

void BpsTable::setCanDelete ( bool  aEnable)

Change the delete permission.

Parameters
aEnableThe new permission.

◆ setCanEdit()

void BpsTable::setCanEdit ( bool  aEnable)

Change the edit permission.

Parameters
aEnableThe new permission.

◆ setCanMove()

void BpsTable::setCanMove ( bool  aEnable)

Change the move permissission.

Parameters
aEnableThe new permission.

◆ setCopyEnabled()

void BpsTable::setCopyEnabled ( bool  aEnable)

Change the copy enabling.

Parameters
aEnableThe new copy enable state.

◆ setFilter()

void BpsTable::setFilter ( const QString aFilter)

Set the select filter.

Parameters
aFilterA where clause, but without the WHERE keyword.

◆ setName()

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.

Parameters
aNameThe new table name.

◆ setOrder()

void BpsTable::setOrder ( const QString aOrder)

Set the select order.

Parameters
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: