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

◆ Replace()

template<EntityValueType ENTITY>
std::int64_t sqt::DataContext< ENTITY >::Replace ( const ENTITY & entity)

Inserts the specified entity into the database table, replacing the existing row.

Parameters
entityThe entity to be inserted.
Returns
The generated row ID of the inserted entity.
Exceptions
sqt::SQLErrorThrown if the insertion fails.

This method is similar to the Insert() method, except that it replaces the existing row if an unique constraint violation occurs.

To automatically generate the primary key value, use AutoIncReplace() method instead.

For more control over the inserted columns, use the more flexible MakeReplacer(ASSIGNMENTS&&...) method from the complex style interface.

See also
sqt::DataContext<>::AutoIncReplace()
sqt::DataContext<>::Insert()
sqt::DataContext<>::MakeReplacer()
sqt::DataContext<>::MakeReplacer(ASSIGNMENTS&&... assignments)