53 template <db::ConnectionConfiguration Config>
69 template <
db::ConnectionConfiguration Config>
81 template <
typename SchemaType>
87 template <
typename SchemaType>
127 explicit
Database(
db::CommandGeneratorFactory registry,
db::ConnectionConfigView
config);
130 friend struct
migrations::detail::DatabaseAccess;
134 auto beginInsertManySavepoint() -> std::
string;
135 auto rollbackToInsertManySavepoint(std::string_view name) ->
void;
136 auto releaseInsertManySavepoint(std::string_view name) ->
void;
137 auto executeSavepointCommand(std::string_view command, std::string_view operation) ->
void;
138 auto markTransactionFailed() noexcept ->
void;
139 auto restoreHealthyTransactionState() noexcept ->
void;
140 [[nodiscard]] auto hasApplicationTransaction() const noexcept ->
bool;
141 auto checkTransactionStart() const ->
void;
144 auto closeFailedTransactionSession() noexcept ->
void;
146 auto executeMutation(const
db::Statement& statement, std::string_view operation) -> std::
size_t;
147 auto executeMutation(
db::StatementView statement, std::string_view operation) -> std::
size_t;
148 auto executeInsertIfAbsent(const
db::Statement& statement, const
db::InsertIfAbsentSpec& conflict,
149 std::string_view operation) -> std::
size_t;
150 auto executeSql(std::string_view statement, std::string_view operation) ->
void;
151 auto ensureSessionUsable(std::string_view operation) const ->
void;
152 auto ensureBoundValueSupported(const
db::BoundValue& value, std::string_view operation) ->
void;
153 auto ensureDdlSupported(std::string_view operation) const ->
void;
154 auto ensureSchemaSupported(
model::ModelView
model,
bool includeJunctions, std::string_view operation) ->
void;
155 auto ensureStringValueSupported(const
model::ColumnView& column, const std::optional<
query::QueryValue>& value,
156 std::string_view operation) const ->
void;
157 auto relationEndpointExists(
model::ModelView
model, const
db::binding::PrimaryKey& key) ->
bool;
158 auto tableExists(std::string_view tableName) ->
bool;
159 auto ensureEndpointKeySupported(
model::ModelView
model, const
db::binding::PrimaryKey& key,
160 std::string_view operation) const ->
void;
161 auto ensureRelationTableEndpointsExist(
model::ModelView owner) ->
void;
162 [[nodiscard]] auto getBackend() const -> const
db::BackendProvider&;
163 [[nodiscard]] auto getCommandGenerator() const -> const
db::CommandGenerator&;
164 [[nodiscard]] auto getBackendRuntimeLimits() ->
db::BackendRuntimeLimits;
165 auto ensureStatementWithinBindLimit(std::
size_t parameterCount, std::string_view operation) ->
void;
166 auto ensureModelSupported(
model::ModelView
model, std::string_view operation) const ->
void;
167 auto ensureQuerySupported(
model::ModelView
model, const
query::detail::SelectSpec& spec) const ->
void;
168 auto ensureQuerySupported(
model::ModelView
model,
db::detail::SqlQueryView
query) const ->
void;
169 auto ensureQueryTypesSupported(
model::ModelView
model,
db::detail::SqlQueryView
query,
170 std::string_view operation) const ->
void;
171 auto ensurePredicateSupported(
model::ModelView
model, const
query::detail::Predicate& predicate,
172 std::string_view operation) const ->
void;
173 auto ensurePredicateSupported(const
query::detail::Predicate& predicate, std::string_view operation) const ->
void;
174 auto ensurePredicateSupported(
bool containsCollection, std::string_view operation) const ->
void;
175 auto ensureAffectedRowsAvailable(std::string_view operation) const ->
void;
176 auto requireCapability(
bool supported, std::string_view operation, std::string_view message) const ->
void;
178 std::string_view operation) ->
void;
181 std::unique_ptr<
soci::transaction> transaction;
183 bool transactionFailed = false;
184 bool migrationActive = false;
185 std::
size_t insertManySavepointSequence = 0;
186 db::BackendType backendType;
187 db::CommandGeneratorFactory commandGeneratorFactory;
188 const
db::BackendProvider* backend =
nullptr;