43 const QSqlDatabase DB_;
45 std::array<QSqlQuery_ptr, InsertAction::StaticCount () + 1> Queries_;
46 const QString InsertSuffix_;
50 , InsertSuffix_ {
" INTO " + data.Table_ +
51 " (" + data.Fields_.join (
", ") +
") VALUES (" +
52 data.BoundFields_.join (
", ") +
");" }
58 auto& query = Queries_ [action.
Selector_.index ()];
61 query = std::make_shared<QSqlQuery> (DB_);
62 query->prepare (GetInsertPrefix (action) + InsertSuffix_);
70 [] (InsertAction::DefaultTag) { return
"INSERT"; },
71 [] (InsertAction::IgnoreTag) { return
"INSERT OR IGNORE"; },
82 inline static const QString
Binary {
"BLOB" };
89 return std::make_unique<InsertQueryBuilder> (db, data);
static const QString IntAutoincrement
auto MakeInsertQueryBuilder(const QSqlDatabase &db, const CachedFieldsData &data) const
InsertQueryBuilder(const QSqlDatabase &db, const CachedFieldsData &data)
auto Visit(const Either< Left, Right > &either, Args &&... args)
static const QString Binary
ActionSelector_t Selector_
std::shared_ptr< QSqlQuery > QSqlQuery_ptr
QSqlQuery_ptr GetQuery(InsertAction action) override