This class implements the BPS table field validator.
More...
#include <bpsfieldvalidator.h>
This class implements the BPS table field validator.
◆ Status
Return status from check function.
Enumerator |
---|
StatusOK | All checks passed ok.
|
StatusMissing | Mandatory field but input missing.
|
StatusInvalid | Input is invalid (too short, too long, wrong format or data).
|
StatusDuplicate | Unique field, but same value found in other record.
|
StatusBadRef | Key not found in referenced relation table.
|
StatusNotPositive | Numeric value is not positive.
|
StatusUnknown | Unknown status (mostly an application bug, not a regular value).
|
◆ BpsFieldValidator()
- Parameters
-
aDatastore | The datastore connection to use. |
aTable | The name of the table to validate for. |
◆ checkDelete()
bool BpsFieldValidator::checkDelete |
( |
const QVariantMap & |
aValues | ) |
|
Checks if the record data is valid to delete.
Stops on first fail and sets the values for lastStatus() and lastColumn().
- Parameters
-
aValues | List of column name / value pairs for the record to check. |
- Returns
- True if all column checks passed, false otherwise.
- Exceptions
-
BpsException | Thrown when db access fails or validator is broken. |
◆ checkInsert()
bool BpsFieldValidator::checkInsert |
( |
const QVariantMap & |
aValues | ) |
|
Checks if the record data is valid for insertion.
Stops on first fail and sets the values for lastStatus() and lastColumn().
- Parameters
-
aValues | List of column name / value pairs for the record to check. |
- Returns
- True if all column checks passed, false otherwise.
- Exceptions
-
BpsException | Thrown when db access fails or validator is broken. |
◆ checkUpdate()
bool BpsFieldValidator::checkUpdate |
( |
const QVariantMap & |
aValues | ) |
|
Checks if the record data is valid for update.
Stops on first fail and sets the values for lastStatus() and lastColumn().
- Parameters
-
aValues | List of column name / value pairs for the record to check. |
- Returns
- True if all column checks passed, false otherwise.
- Exceptions
-
BpsException | Thrown when db access fails or validator is broken. |
◆ lastColumn()
QString BpsFieldValidator::lastColumn |
( |
| ) |
const |
- Returns
- Column on which the the last error occurred. Empty in case last check passed.
◆ lastStatus()
Status BpsFieldValidator::lastStatus |
( |
| ) |
const |
- Returns
- The last status set by the recent check method.
◆ message()
Get standard message for a status.
- Parameters
-
aStatus | The status to get the message for. |
- Returns
- Standard message for failure status. For StatusOK an empty string is returned.
The documentation for this class was generated from the following file: