@@ -147,7 +147,8 @@ namespace sqlite_reflection {
147147 void Delete (const T& model) const {
148148 const auto type_id = typeid (T).name ();
149149 const auto & record = GetRecord (type_id);
150- Delete (model.id , record);
150+ const auto equal_id_predicate = Equal (&T::id, model.id );
151+ Delete (record, &equal_id_predicate);
151152 }
152153
153154 // / Deletes a given record from the database, which matches a given id.
@@ -156,8 +157,18 @@ namespace sqlite_reflection {
156157 void Delete (int64_t id) const {
157158 const auto type_id = typeid (T).name ();
158159 const auto & record = GetRecord (type_id);
159- Delete (id, record);
160+ const auto equal_id_predicate = Equal (&T::id, id);
161+ Delete (record, &equal_id_predicate);
160162 }
163+
164+ // / Deletes multiple records of a given type from the database, which match a given predicate.
165+ // / This corresponds to an DELETE query in the SQL syntax, with an additional WHERE clause
166+ template <typename T>
167+ void Delete (const QueryPredicateBase* predicate) const {
168+ const auto type_id = typeid (T).name ();
169+ const auto & record = GetRecord (type_id);
170+ Delete (record, predicate);
171+ }
161172
162173 private:
163174 explicit Database (const char * path);
@@ -189,7 +200,7 @@ namespace sqlite_reflection {
189200 void Update (void * p, const Reflection& record) const ;
190201
191202 // / Deletes a single record from the database
192- void Delete (int64_t id, const Reflection& record) const ;
203+ void Delete (const Reflection& record, const QueryPredicateBase* predicate ) const ;
193204
194205 static Database* instance_;
195206 sqlite3* db_;
0 commit comments