| std::int64_t sqt::DataContext< ENTITY >::Insert | ( | const ENTITY & | entity | ) |
Inserts the specified entity into the database table.
| entity | The entity to be inserted. |
| sqt::SQLError | Thrown if the insertion fails. |
This method inserts the entire entity into the database table, including the primary key. However, the primary key value is not automatically generated even if it is auto-incremented. To automatically generate the primary key value, use AutoIncInsert() instead.
If a unique constraint violation occurs, the insertion will fail and throw an exception. To avoid this, use Replace() or AutoIncReplace() to replace the existing row.
For more control over the conflict action and the inserted columns, use the more flexible MakeInserter() and MakeInserter(ASSIGNMENT&&...) methods from the complex style interface.