This is an additional template class supposed to be used as a parent class for Active Record models. This class adds search, mass update and mass delete operations.
You can find more information in comments below.
template<class BaseType>
class TDbActiveRecord :public CDbBaseActiveRecord
{
public:
TDbActiveRecord(const String &table); // Constructor
static ReleasablePtr<TDbActiveQuery<BaseType>> Find(); // Return active query
static ReleasablePtr<BaseType> FindOne(); // Return first found record
static ReleasablePtr<BaseType> FindOne(DbCondition condition); // Return first found record by condition
static ReleasablePtr<BaseType> FindOne(const DbConditions &conditions); // Return first found record by conditions joined by AND operator
static std::vector<ReleasablePtr<BaseType>> FindAll(); // Return all found records
static std::vector<ReleasablePtr<BaseType>> FindAll(DbCondition condition); // Return all found records by condition
static std::vector<ReleasablePtr<BaseType>> FindAll(const DbConditions &conditions); // Return all found records by conditions joined by AND operator
static void UpdateAll(const DbSet &data); // Update all records with specified key => value (column => value) data
static void UpdateAll(const DbSet &data, DbCondition condition); // Update all records corresponding to specified condition with specified key => value (column => value) data
static void UpdateAll(const DbSet &data, const DbConditions &conditions); // Update all records corresponding to specified conditions joined by AND operator with specified key => value (column => value) data
static void DeleteAll(); // Delete all records
static void DeleteAll(DbCondition condition); // Delete all records corresponding to specified condition
static void DeleteAll(const DbConditions &conditions); // Delete all records corresponding to specified conditions joined by AND operator
};
Namespace: | nitisa |
Include: | Nitisa/Db/DbActiveRecord.h |