Content


NTL
Core
CDbValidatorUnique

CDbValidatorUnique


Unique validator checks whether corresponding record is unique in a database table (it is being used to check whether Active Record model is unique).

You can find more information in comments below. Overrided methods can be found in corresponding base class or interface.

class CDbValidatorUnique :public CDbValidator
{
public:
    // IDbValidator methods 
    bool Validate(CDbModel *model, IDbAttribute *attribute, String &error) override;

    CDbValidatorUnique();

    CDbValidatorUnique *setTarget(const String &table, const String &attribute); // Set table and attribute name used to check if corresponding value is unique in database 
    CDbValidatorUnique *setTarget(const String &table, const StringArray &attributes); // Set table and attribute names used to check if corresponding value is unique in database 
    CDbValidatorUnique *setTargetTable(const String &value); // Set table used to check if corresponding value is unique in database 
    CDbValidatorUnique *setTargetAttribute(const String &value); // Set attribute name used to check if corresponding value is unique in database 
    CDbValidatorUnique *setTargetAttribute(const StringArray &value); // Set attribute names used to check if corresponding value is unique in database 

    static ReleasablePtr<CDbValidatorUnique> Create(); // Helper static method to create validator in form used in model rule adding methods 

    template<class Model> CDbValidatorUnique *setTarget(); // Set table to compare using it from specified Active Record model 
};
Namespace: nitisa
Include: Nitisa/Db/DbValidatorUnique.h