SQT
A C++ ORM framework for SQLite
Loading...
Searching...
No Matches

◆ Delete()

template<EntityValueType ENTITY>
template<typename E = ENTITY>
requires PrimaryKeyEntityValueType<E>
bool sqt::DataContext< ENTITY >::Delete ( const typename TableType< E >::PrimaryKeyType::ValueType & primary_key)

Deletes a row by the specified primary key value from the database table.

Parameters
primary_keyThe primary key value of the row to be deleted.
Returns
true if the row was deleted; otherwise, false if the row with the specified primary key value does not exist.
Exceptions
sqt::SQLErrorThrown if the deletion fails.
Note
This method is only available if the entity type has a primary key. Use the SQT_PRIMARY_KEY or SQT_PRIMARY_KEY_AUTO_INC macro to define a primary key.

For more control over the conditions of which rows to delete, use the MakeDeleter() method from the complex style interface to create a deleter and apply custom conditions.

See also
sqt::DataContext<>::DeleteAll()
sqt::DataContext<>::MakeDeleter()
SQT_PRIMARY_KEY
SQT_PRIMARY_KEY_AUTO_INC