16#include "../../detail/SociTypes.inc"
21import :connection_config;
35using Column = orm::query::detail::Column;
61using OrderBy = orm::query::detail::OrderBy;
202 class BackendRuntime;
203 class CommandGenerator;
205 struct InsertIfAbsentSpec;
232 std::optional<query::QueryValue::Value>
value;
235 [[nodiscard]]
auto isNull() const noexcept ->
bool
237 return not
value.has_value();
244 std::optional<query::QueryValue>
value;
250 if (
value.has_value())
252 return value->getLogicalType();
258 throw std::invalid_argument{
"A NULL statement parameter requires an explicit logical type"};
263 if (
value.has_value())
283 std::span<const StatementParameter>
parameters;
303 "Backend does not support migrations"};
305 virtual auto beginMigration(soci::session&, std::string_view)
const ->
void
308 "Backend does not support migrations"};
313 "Backend does not support migrations"};
319 "Backend does not support migration history inspection"};
324 "Backend does not support migration history creation"};
327 [[nodiscard]]
virtual auto migrationJournalTable(soci::session&, std::string_view)
const -> std::string
332 virtual auto endMigration(soci::session&, std::string_view)
const ->
void {}
335 virtual auto onConnect(soci::session& session)
const ->
void = 0;
336 [[nodiscard]]
virtual auto tableExists(soci::session& session, std::string_view tableName)
const ->
bool = 0;
342 [[nodiscard]]
virtual auto
347 virtual auto bind(soci::values& values, std::string_view name,
const BoundValue& value)
const ->
void = 0;
352 "Backend does not support Binary16 parameter inspection"};
398 [[nodiscard]]
virtual auto quoteIdentifier(std::string_view identifier)
const -> std::string = 0;
399 [[nodiscard]]
virtual auto bindMarker(std::string_view logicalName)
const -> std::string = 0;
400 [[nodiscard]]
virtual auto
402 std::optional<std::size_t> maxStringLength = std::nullopt)
const -> std::string = 0;
404 std::optional<std::size_t>)
const -> std::string
409 bool ifNotExists)
const -> std::string = 0;
414 [[nodiscard]]
virtual auto renderDefaultInsert(std::string_view tableName)
const -> std::string
416 return "INSERT INTO " +
quoteIdentifier(tableName) +
" DEFAULT VALUES;";
418 [[nodiscard]]
virtual auto renderDropTable(std::string_view tableName,
bool ifExists)
const -> std::string = 0;
423 bool )
const -> std::string
425 return std::string{expression};
440 [[nodiscard]]
virtual auto
442 std::optional<std::size_t> maxStringLength = std::nullopt)
const -> std::string = 0;
A backend-neutral database runtime error.
virtual auto compiledSqlFlavor() const noexcept -> CompiledSqlFlavor
virtual auto capabilities() const noexcept -> const BackendCapabilities &=0
virtual auto type() const noexcept -> BackendType=0
virtual auto runtime() const noexcept -> const BackendRuntime &=0
virtual auto dialect() const noexcept -> const SqlDialect &=0
virtual auto commandGenerator() const noexcept -> const CommandGenerator &=0
virtual auto hasStatementParameter(soci::statement &, std::string_view) const -> bool
virtual auto open(soci::session &session, ConnectionConfigView config) const -> void=0
virtual auto migrationTable(soci::session &) const -> std::string
virtual auto bind(soci::values &values, std::string_view name, const BoundValue &value) const -> void=0
virtual auto executeInsertIfAbsent(soci::session &session, StatementView statement, const InsertIfAbsentSpec &conflict) const -> std::size_t
virtual auto onConnect(soci::session &session) const -> void=0
virtual auto endMigration(soci::session &, std::string_view) const -> void
virtual auto migrationJournalTable(soci::session &, std::string_view) const -> std::string
virtual auto executeMigrationScript(soci::session &, std::string_view) const -> void
virtual auto migrationHistoryExists(soci::session &, std::string_view) const -> bool
virtual auto validateMigrationSession(soci::session &) const -> void
virtual auto translateError(const soci::soci_error &error, DatabaseErrorCode fallback, std::string_view operation) const -> DatabaseError=0
virtual auto limits(soci::session &session) const -> BackendRuntimeLimits=0
virtual auto normalizeAffectedRows(long long affectedRows) const -> std::size_t=0
virtual auto beginMigration(soci::session &, std::string_view) const -> void
virtual auto createMigrationHistory(soci::session &, std::string_view) const -> void
virtual auto statementErrorInvalidatesTransaction(const soci::soci_error &) const noexcept -> bool
virtual auto tableExists(soci::session &session, std::string_view tableName) const -> bool=0
virtual auto renderStringLengthConstraint(std::string_view, std::optional< std::size_t >) const -> std::string
virtual auto renderCreateTablePrefix(std::string_view tableName, bool ifNotExists) const -> std::string=0
virtual auto bindMarker(std::string_view logicalName) const -> std::string=0
virtual auto renderPagination(const PaginationSpec &pagination) const -> std::string=0
virtual auto renderDefaultInsert(std::string_view tableName) const -> std::string
virtual auto renderInsertIfAbsent(const InsertIfAbsentSpec &insert) const -> std::string=0
virtual auto renderAutoIncrementPrimaryKey(std::string_view columnName) const -> std::string=0
virtual auto toSqlType(model::ColumnType type, std::optional< std::size_t > maxStringLength=std::nullopt) const -> std::string=0
virtual auto quoteIdentifier(std::string_view identifier) const -> std::string=0
virtual auto renderAggregateResult(std::string_view expression, bool) const -> std::string
virtual auto renderCreateTableSuffix() const -> std::string
virtual auto renderDropTable(std::string_view tableName, bool ifExists) const -> std::string=0
virtual auto toSqlType(model::ColumnType type, std::optional< std::size_t > maxStringLength=std::nullopt) const -> std::string=0
orm::query::detail::Column Column
orm::query::detail::PredicateNode PredicateNode
orm::query::detail::Projection Projection
orm::query::detail::AggregateLogicalExpression AggregateLogicalExpression
orm::query::detail::AggregatePredicate AggregatePredicate
orm::query::detail::BetweenExpression BetweenExpression
orm::query::detail::RawExpression RawExpression
orm::query::detail::NullOperator NullOperator
orm::query::detail::ProjectionSource ProjectionSource
orm::query::detail::LogicalOperator LogicalOperator
orm::query::detail::OrderDirection OrderDirection
orm::query::detail::ComparisonOperator ComparisonOperator
orm::query::detail::AggregateNotExpression AggregateNotExpression
orm::query::detail::LogicalExpression LogicalExpression
orm::query::detail::AggregateExpression AggregateExpression
orm::query::detail::AggregatePredicateNodePtr AggregatePredicateNodePtr
orm::query::detail::AggregatePredicateNode AggregatePredicateNode
orm::query::detail::PredicateNodePtr PredicateNodePtr
orm::query::detail::AggregateFunction AggregateFunction
orm::query::detail::NotExpression NotExpression
orm::query::detail::NullExpression NullExpression
orm::query::detail::ListExpression ListExpression
orm::query::detail::ComparisonExpression ComparisonExpression
orm::query::detail::UpdateValue UpdateValue
orm::query::detail::OrderBy OrderBy
orm::query::detail::UpdateAssignment UpdateAssignment
orm::query::detail::AggregateComparisonExpression AggregateComparisonExpression
orm::query::detail::ListOperator ListOperator
orm::query::detail::BetweenOperator BetweenOperator
orm::query::detail::CollectionExpression CollectionExpression
orm::query::detail::CollectionOperator CollectionOperator
auto isWithinValueLimits(const BoundValue &bound, const BackendValueLimits &limits, const BackendRuntimeLimits &runtime={}) noexcept -> bool
std::vector< query::QueryValue > PrimaryKey
query::detail::UpdateSpec UpdateSpec
query::detail::Predicate Predicate
query::detail::SelectSpec SelectSpec
binding::PrimaryKey PrimaryKey
consteval auto columnName()
MigrationCapabilities migrations
auto supportsColumnType(model::ColumnType type) const -> bool
SchemaCapabilities schema
BackendValueLimits valueLimits
std::vector< model::ColumnType > supportedColumnTypes
MutationCapabilities mutations
RelationCapabilities relations
auto operator==(const BackendCapabilities &) const -> bool=default
std::optional< UtcTimestamp > minUtcTimestamp
auto operator==(const BackendRuntimeLimits &) const -> bool=default
std::optional< std::size_t > maxBindParameters
std::optional< UtcTimestamp > maxUtcTimestamp
std::optional< std::size_t > maxIndexBytes
std::optional< LocalDateTime > minLocalDateTime
std::optional< Date > minDate
std::optional< unsigned long long > maxUnsignedLongLong
std::optional< UtcTimestamp > maxUtcTimestamp
std::optional< UtcTimestamp > minUtcTimestamp
auto operator==(const BackendValueLimits &) const -> bool=default
std::optional< LocalDateTime > maxLocalDateTime
std::optional< Date > maxDate
std::optional< query::QueryValue::Value > value
model::UuidStorage uuidStorage
model::ColumnType logicalType
auto isNull() const noexcept -> bool
std::vector< std::string > columns
std::vector< std::string > valueExpressions
std::vector< std::string > conflictColumns
auto operator==(const InsertIfAbsentSpec &) const -> bool=default
auto operator==(const MigrationCapabilities &) const -> bool=default
MigrationAtomicity atomicity
AffectedRowsSupport affectedRows
auto operator==(const MutationCapabilities &) const -> bool=default
bool atomicInsertIfAbsent
auto operator==(const QueryCapabilities &) const -> bool=default
bool offsetRequiresOrderBy
bool distinctOrderByRequiresProjectedColumn
std::optional< std::size_t > maxOrderedStringLength
bool collectionPredicates
bool strictProjectionGrouping
auto operator==(const RelationCapabilities &) const -> bool=default
bool collectionPredicates
bool compositeEndpointKeys
bool compositePrimaryKeys
bool createTableIfNotExists
auto operator==(const SchemaCapabilities &) const -> bool=default
bool autoIncrementPrimaryKey
std::optional< query::QueryValue > value
auto getBoundValue() const -> BoundValue
model::UuidStorage uuidStorage
auto getLogicalType() const -> model::ColumnType
std::optional< model::ColumnType > nullType
std::span< const StatementParameter > parameters
std::vector< StatementParameter > parameters