Content


NTL
Core
CDbValidatorExists

CDbValidatorExists


Exists validator checks whether corresponding record exists in database.

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

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

    CDbValidatorExists();

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

    static ReleasablePtr<CDbValidatorExists> Create(); // Helper static method to create validator in form used in model rule adding methods 
    
    template<class Model> CDbValidatorExists *setTarget(); // Set table to compare using it from specified Active Record model 
};
Namespace: nitisa
Include: Nitisa/Db/DbValidatorExists.h