This interface describes minimum required functionality from Active Record model attribute.
You can find more information in comments below.
class IDbAttribute
{
protected:
String m_sName; // Name of the column in database
bool m_bNull; // Whether the attribute value is supposed to be treated as empty/null
bool m_bChanged; // Whether attribute value was changed
virtual void SetInternal(const DbValue &value, const bool &changed) = 0; // Set attribute value and mark it as changed/unchanged
public:
String const &sName; // Name of the column in database
bool const &bNull; // Whether the attribute value is supposed to be treated as empty/null
bool const &bChanged; // Whether attribute value was changed
IDbAttribute(const String &name); // Constructor. "name" is the name of the corresponding column in database table
virtual void Set(const DbValue &value) = 0; // Set attribute value
virtual DbValue Get() const = 0; // Return attribute value in form of DbValue
virtual DbValue Old() const = 0; // Return old attribute value in form of DbValue. If attribute was not changed yet, return current value
void SetNull(); // Set to treat attribute value as empty/null
};
Namespace: | nitisa |
Include: | Nitisa/Interfaces/IDbAttribute.h |