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

◆ MakeAutoIncInserter()

template<EntityValueType ENTITY>
template<ConflictAction CONFLICT_ACTION = ConflictAction::Abort>
requires AutoIncEntityValueType<ENTITY>
constexpr auto sqt::DataContext< ENTITY >::MakeAutoIncInserter ( )
staticconstexprnoexcept

Creates an inserter for inserting an entity into the database table, automatically generating the primary key value.

Template Parameters
CONFLICT_ACTIONThe conflict action to be used when an unique constraint violation occurs. The default action is sqt::ConflictAction::Abort.
Returns
A new inserter instance.

This method is similar to the MakeInserter() method, except that the primary key column is not inserted and its value is automatically generated.

The MakeAutoIncReplacer() method is a shorthand for MakeAutoIncInserter<sqt::ConflictAction::Replace>().

Note
This method is only available if the entity type has an auto-incremented primary key. Use the SQT_PRIMARY_KEY_AUTO_INC macro to define an auto-incremented primary key.

For an easier-to-use method, use the AutoIncInsert() method from the easy style interface.

See also
sqt::DataContext<>::AutoIncInsert()
sqt::DataContext<>::MakeAutoIncReplacer()
SQT_PRIMARY_KEY_AUTO_INC