StormByte-Database 3.0.0
C++26 database module of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Database Namespace Reference

Database module of the StormByte suite. More...

Namespaces

namespace  MariaDB
 MariaDB backend of the Database module.
namespace  MSSQL
 Microsoft SQL Server backend using FreeTDS DB-Library.
namespace  Postgres
 PostgreSQL backend of the Database module.
namespace  SQLite
 SQLite backend of the Database module.

Classes

class  Database
 Abstract backend. More...
class  Exception
 Root exception for Database. More...
class  ConnectionError
 Connection failed. More...
class  WrongValueType
 Value accessed as the wrong type. More...
class  ColumnNotFound
 Column name missing from a Row. More...
class  OutOfBounds
 Column index out of range. More...
class  QueryException
 Base for query errors. More...
class  UnknownSTMT
 Prepared statement name is not registered. More...
class  ExecuteError
 Query or statement execution failed. More...
class  TransactionError
 Beginning a database transaction failed. More...
class  NamedValue
 Value plus column name. More...
class  PreparedSTMT
 Abstract prepared statement. More...
class  Row
 One result row: ordered NamedValues with lookup by column name. More...
class  Rows
 Ordered collection of result rows. More...
struct  OperationMetrics
 Immutable view of cumulative metrics for one operation category. More...
class  Telemetry
 Thread-safe cumulative telemetry for one database connection. More...
class  Transaction
 RAII transaction. More...
class  Value
 Type-erased SQL value (NULL, integers, double, text, blob, bool). More...

Typedefs

using ValuesVariant
 Column alternatives stored on Base's heap.
using ExpectedRows = Expected<Rows, QueryException>
 Query result: Rows or QueryException.

Enumerations

enum class  Backend { PostgreSQL , MariaDB , SQLite , MSSQL }
 Database backends whose build-time availability can be queried. More...
enum class  Operation : std::uint8_t {
  Connect , Disconnect , Query , SilentQuery ,
  PrepareStatement , PreparedStatement , BeginTransaction , CommitTransaction ,
  RollbackTransaction , Count
}
 Database operation categories measured by telemetry. More...
enum class  BackendEvent : std::uint8_t {
  Warning , Busy , Constraint , Io ,
  Connection , Serialization , Deadlock , LockTimeout ,
  Other , Count
}
 Shared error and warning categories for backend-specific telemetry. More...
enum class  SslMode { Default , Disable , Prefer , Require }
 TLS policy for MariaDB / PostgreSQL. More...
enum class  IsolationLevel {
  Default , ReadUncommitted , ReadCommitted , RepeatableRead ,
  Serializable
}
 Isolation for BeginTransaction(). More...

Functions

constexpr bool Available (Backend backend) noexcept
 Report whether a backend was enabled when this library was configured.

Detailed Description

Database module of the StormByte suite.

Typedef Documentation

◆ ExpectedRows

◆ ValuesVariant

Initial value:

Column alternatives stored on Base's heap.

Safe::Monostate is SQL NULL.

Enumeration Type Documentation

◆ Backend

enum class StormByte::Database::Backend
strong

Database backends whose build-time availability can be queried.

Enumerator
PostgreSQL 

PostgreSQL backend, selected by WITH_POSTGRES.

MariaDB 

MariaDB backend, selected by WITH_MARIADB.

SQLite 

SQLite backend, selected by WITH_SQLITE.

MSSQL 

Microsoft SQL Server backend, selected by WITH_MSSQL.

◆ BackendEvent

enum class StormByte::Database::BackendEvent : std::uint8_t
strong

Shared error and warning categories for backend-specific telemetry.

Enumerator
Warning 

Non-fatal warning reported by a backend.

Busy 

Busy, locked, or lock-timeout condition.

Constraint 

Constraint violation.

Io 

Storage or transport I/O failure.

Connection 

Connection or protocol failure.

Serialization 

Transaction serialization conflict.

Deadlock 

Deadlock victim or equivalent conflict.

LockTimeout 

Lock wait timed out.

Other 

Backend failure without a narrower category.

Count 

Number of backend event categories.

◆ IsolationLevel

Isolation for BeginTransaction().

Mapping is backend-specific.

Enumerator
Default 

Backend default.

ReadUncommitted 

Dirty reads where supported.

ReadCommitted 

Committed data only.

RepeatableRead 

Stable reads in the transaction.

Serializable 

Full serializability where supported.

◆ Operation

enum class StormByte::Database::Operation : std::uint8_t
strong

Database operation categories measured by telemetry.

Enumerator
Connect 

Connection attempts.

Disconnect 

Disconnect calls.

Query 

Queries that return rows.

SilentQuery 

Queries that return only success or failure.

PrepareStatement 

Prepared-statement registration attempts.

PreparedStatement 

Prepared-statement execution attempts.

BeginTransaction 

Transaction begin attempts.

CommitTransaction 

Transaction commit attempts.

RollbackTransaction 

Explicit and automatic rollback attempts.

Count 

Number of operation categories.

◆ SslMode

enum class StormByte::Database::SslMode
strong

TLS policy for MariaDB / PostgreSQL.

SQLite ignores it.

Enumerator
Default 

Driver default.

Disable 

No TLS.

Prefer 

TLS if the server offers it.

Require 

Fail if TLS cannot be used.

Function Documentation

◆ Available()

bool StormByte::Database::Available ( Backend backend)
inlineconstexprnoexcept

Report whether a backend was enabled when this library was configured.

Parameters
backendBackend to query.
Returns
True for SYSTEM or BUNDLED, false for OFF or an unknown backend value.
Note
This compile-time query does not check server connectivity or runtime dependencies.