#include <qlabdatabasecashboxclient.h>
List of all members.
Detailed Description
The QlabDatabaseCashboxClient provides an simpler interface to QlabDatabase class, which better fits cashbox management.
A strip was decided for 2 reasons:
- build a lightweight system for embedding
- embed some cashbox data management peculiarities in an abstract form.
QlabDatabaseCashboxClient provides basic QlabDatabase services, stripped from the multiple backend evaluator, abstract schema obliterator, polymorphic evaluator. On the other hand, it provides some interesting services such as checkUser() (without relying on the huge UserToAcl server class), a simple informMaster() to be used in lieu of the complex MPI messages or MultiWay routing schemes from servers plus some signals to interact with the cashbox logic.
Sample code can be found in labibm4694cashbox.cpp
Public Types
- enum Modes { None,
Select,
Edit,
Delete
}
- Determines the active access mode to underlying data. More...
- enum MasterConversation {
MasterTicketLine,
MasterTicketEnd,
MasterCountOpening,
MasterCountClose,
MasterCountRedrawal,
MasterCountInsertion,
MasterCancelation,
MasterAnomality,
MasterSessionStart,
MasterSessionPause,
MasterSessionReprise,
MasterSessionClose,
MasterSessionLoginError,
MasterSessionSuperLoginError,
MasterLocalMode
}
- Message Types between Cashbox and Server. More...
Public Slots
- QString tableName () const
- Returns the base table name associated with this instance.
- void setTableName (const QString &tblName)
- Sets the base table name to tblNmae.
- QString defaultGetField () const
- Returns the default Get Field association.
- void setDefaultGetField (const QString &fld)
- Sets the default Get Field to fld.
- int sequenceGetNextValue ()
- Returns the next valid ObjectInstanceID.
-
QString getIniVar (const QString §ion, const QString &varname)
-
bool checkUser (const QString &user, const QString &passwd)
- bool informMaster (MasterConversation mc, QObject *clnt)
- informs Master Server of some events data.
-
bool informMaster (MasterConversation mc, const QString &msg)
-
bool postToMaster (const int &userID, const int &cashboxID, const int &ticketNo, const QString &ticketStamp, const QMap< uint, QlabTicketLine * > &act)
- QVariant value (const QString &fld)
- Returns the value for the field fld as a QVariant.
- void setValue (const QString &fld, const QVariant &value)
- Sets the field fld to a value value.
- bool get (const QVariant &itemInfo, bool unique=TRUE)
- Retrieves a dataset from the backend using itemInfo discriminant.
- void create ()
- Creates an empty data set using the default values from the Data Collection descriptor.
- bool store ()
- Stores a dataset to the backend.
- uint size ()
- Returns the dataset size (number of data items in group).
- QSqlRecord * first ()
- Returns the first logical record in dataset.
- QSqlRecord * next ()
- Returns the next logical record in dataset.
- QSqlRecord * last ()
- Returns the last logical record in dataset.
- QSqlRecord * seek (int pos)
- Returns the pos logical record in dataset.
-
void setFilter (const QString &flt)
-
void setOrder (const QString &ord)
-
void select ()
-
QString lastError ()
- void setup ()
- Setup fo the instance.
- bool createConnection (const QString &connectionName)
- Creates the connection for the table.
-
int ticketRecallFromMaster (const QString &recallCode, const QString &recallKey, const QMap< uint, QlabTicketLine * > &act)
-
int ticketPushToMaster (const QMap< uint, QlabTicketLine * > &act)
Signals
- void currentChanged (int recid)
- Emited when the current data Item in Collection has been changed. The signal holds the recid ObjectID.
- void selectionChanged ()
- Selection from the data collection has changed.
- void error (MasterConversation mc, const QString &msg)
- Sends a MasterType and error message.
Public Member Functions
Private Member Functions
-
Q_ENUMS (Modes)
-
Q_ENUMS (MasterConversation)
-
Q_PROPERTY (QString tableName READ tableName WRITE setTableName)
-
Q_PROPERTY (QString defaultGetField READ defaultGetField WRITE setDefaultGetField)
Private Attributes
Member Enumeration Documentation
|
Message Types between Cashbox and Server.
|
|
Determines the active access mode to underlying data.
- Note:
- You'll have to check active mode when dealing with the object.
- Enumeration values:
-
None |
No access mode declared. Client will reject queries |
Select |
Read Mode. Client will agree with the select() method |
Edit |
Edit Mode. Client will allow adding data or editing current data |
Delete |
Delete Mode. Client will accept the del() method |
|
Constructor & Destructor Documentation
QlabDatabaseCashboxClient::QlabDatabaseCashboxClient |
( |
const QString & |
tablename = 0, |
|
|
QObject * |
parent = 0, |
|
|
char * |
name = 0 |
|
) |
|
|
|
Builds a new QlabDatabaseCashboxClient instance for tablename, with parent and with name.
This is the entry point for each and every cashbox to database connection to a table or an associative set.
- Todo:
- Document the underlying associative methods.
|
|
Deletes a QlabDatabase instance |
Member Function Documentation
void QlabDatabaseCashboxClient::create |
( |
|
) |
[slot] |
|
|
Creates an empty data set using the default values from the Data Collection descriptor.
- Note:
- a dataset may have associates with or without size constraints. You'll have to check the data definition schema to see what you get when using this method.
|
bool QlabDatabaseCashboxClient::createConnection |
( |
const QString & |
connectionName |
) |
[slot] |
|
|
Creates the connection for the table.
If a connection to host/dbType/dbname has not yet been initiated, first init and check the connection. Else add this table to the connection list. |
void QlabDatabaseCashboxClient::currentChanged |
( |
int |
recid |
) |
[signal] |
|
|
Emited when the current data Item in Collection has been changed. The signal holds the recid ObjectID.
|
QString QlabDatabaseCashboxClient::defaultGetField |
( |
|
) |
const [slot] |
|
|
Returns the default Get Field association.
|
void QlabDatabaseCashboxClient::error |
( |
MasterConversation |
mc, |
|
|
const QString & |
msg |
|
) |
[signal] |
|
|
Sends a MasterType and error message.
|
QSqlRecord * QlabDatabaseCashboxClient::first |
( |
|
) |
[slot] |
|
|
Returns the first logical record in dataset.
|
bool QlabDatabaseCashboxClient::get |
( |
const QVariant & |
itemInfo, |
|
|
bool |
unique = TRUE |
|
) |
[slot] |
|
|
Retrieves a dataset from the backend using itemInfo discriminant.
The system will return TRUE if an itemset at least has been fetched. |
|
informs Master Server of some events data.
This allows for discussions between the Cashbox Client with master server. You have to pass a MasterConversation mc, and a clnt QObject. The method returns TRUE on success. |
QSqlRecord * QlabDatabaseCashboxClient::last |
( |
|
) |
[slot] |
|
|
Returns the last logical record in dataset.
|
QSqlRecord * QlabDatabaseCashboxClient::next |
( |
|
) |
[slot] |
|
|
Returns the next logical record in dataset.
|
QSqlRecord * QlabDatabaseCashboxClient::seek |
( |
int |
pos |
) |
[slot] |
|
|
Returns the pos logical record in dataset.
|
void QlabDatabaseCashboxClient::selectionChanged |
( |
|
) |
[signal] |
|
|
Selection from the data collection has changed.
|
int QlabDatabaseCashboxClient::sequenceGetNextValue |
( |
|
) |
[slot] |
|
|
Returns the next valid ObjectInstanceID.
|
void QlabDatabaseCashboxClient::setDefaultGetField |
( |
const QString & |
fld |
) |
[slot] |
|
|
Sets the default Get Field to fld.
- Note:
- This should be scarsely used, as the deault system Get association uses the ObjectInstanceID (recid) field.
One can change this to another field only when the primary identifier is something else than standard ObjectInstanceID |
void QlabDatabaseCashboxClient::setTableName |
( |
const QString & |
tblName |
) |
[slot] |
|
|
Sets the base table name to tblNmae.
|
void QlabDatabaseCashboxClient::setup |
( |
|
) |
[slot] |
|
|
Setup fo the instance.
For internal use only.
This has be removed from constructor to allow reconfig when switching from one table to another with the same instance.
While reconfig is a very rarely used option, I had to deal with it to simplify GECIS model importers.
|
void QlabDatabaseCashboxClient::setValue |
( |
const QString & |
fld, |
|
|
const QVariant & |
value |
|
) |
[slot] |
|
|
Sets the field fld to a value value.
- Note:
- If the value variant is invalid, it will be silently discarded, in compliance with the standard setValue() method.
|
uint QlabDatabaseCashboxClient::size |
( |
|
) |
[slot] |
|
|
Returns the dataset size (number of data items in group).
|
bool QlabDatabaseCashboxClient::store |
( |
|
) |
[slot] |
|
|
Stores a dataset to the backend.
The system will return TRUE if all of the set could be stored. |
QString QlabDatabaseCashboxClient::tableName |
( |
|
) |
const [slot] |
|
|
Returns the base table name associated with this instance.
|
QVariant QlabDatabaseCashboxClient::value |
( |
const QString & |
fld |
) |
[slot] |
|
|
Returns the value for the field fld as a QVariant.
|
Member Data Documentation
|
Current active Record in set |
|
Place holder for the default Get Field name |
|
Virtual table name place holder |