This repository is StormByte Database: the C++26 SQL layer of the StormByte suite.
It depends on StormByte-Logger 2.0.0 or newer, which vendors StormByte-String and StormByte Base. Public headers live under StormByte/database/.
One API covers SQLite, PostgreSQL and MariaDB. You do not construct those backends as generic objects. They are base classes: derive your schema, call the backend constructor, prepare statements and hook connect/disconnect there.
The suite is split on purpose. Base, Buffer, Config, Crypto, Logger, Multimedia, Network, String and System are other repositories. This repository does not implement them.
StormByte::Database::Database with Connect / Disconnect, Query / SilentQuery, named prepared statements and RAII transactions.Value (NULL, integers, double, text, blob, bool) with safe numeric Get<T>().ColumnNotFound / OutOfBounds).nullptr is SQL NULL, ExpectedRows on execute.BeginTransaction(IsolationLevel) returns Expected<Transaction, TransactionError>; failed starts are reported as a value, and an uncommitted transaction rolls back on destruction.GetTelemetry() returns a thread-safe, cumulative StormByte::Shared handle with operation counts, outcomes, rows and latency min/mean/max. SQLite, PostgreSQL and MariaDB provide derived telemetry with backend-specific error counters; retained handles remain readable after disconnect/destruction.SslMode for MariaDB and PostgreSQL. SQLite ignores it.| Module | Role | API |
|---|---|---|
| Base | Exceptions, Expected, serialization, strings, UUID, concepts | /StormByte |
| Buffer | FIFO, SharedFIFO, Ring, Producer/Consumer and multi-stage pipelines | /StormByte-Buffer |
| Config | Human-readable text and versioned binary documents (groups, lists, raw bytes) | /StormByte-Config |
| Crypto | Hash, compress, encrypt, sign and key agreement — Crypto++ never leaves the private tree | /StormByte-Crypto |
| Database | This repository | /StormByte-Database |
| Logger | Stream logger with levels, headers, human-readable sizes and redaction (ThreadedLog) | /StormByte-Logger |
| Multimedia | Decode, encode and containers without raw FFmpeg types; codecs enabled only if present | /StormByte-Multimedia |
| Network | Framed packets, Client/Server, IPv4/IPv6 TCP and Buffer pipelines (compress/encrypt) | /StormByte-Network |
| String | Owned UTF-8 / wide text that can cross a DLL boundary | /StormByte-String |
| System | Processes, pipes and environment variables across Linux, Windows and macOS | /StormByte-System |
Needs a C++26 compiler, CMake 3.28 or newer, and StormByte-Logger 2.0.0 or newer. Logger supplies the bundled StormByte-String and StormByte Base dependencies used by Database. Enable the backends you want (WITH_SQLITE, WITH_POSTGRES, WITH_MARIADB: OFF, SYSTEM or BUNDLED); SYSTEM discovers installed connectors and BUNDLED builds them.
Shared vs static follows CMake BUILD_SHARED_LIBS (default ON). -DBUILD_SHARED_LIBS=OFF builds a static archive. In static mode BuildMaster flattens private vendor dependencies into the consumer link closure; users do not need to repack vendor archives. The shared library keeps Database replaceable as its own DLL/shared object.
Headers are #include <StormByte/database/….hxx>. Namespace root is StormByte::Database. Moving a connected backend transfers ownership of its connection; the moved-from backend is disconnected.
MariaDB / Postgres follow the same pattern: subclass, pass host / user / password / database (and port on MariaDB), optionally SetSslMode before Connect(). PostgreSQL connection parameters are passed separately, so credentials may contain quotes and backslashes.
Malformed or out-of-range numeric values returned by a backend are reported through ExpectedRows as query errors.
nullptr binds SQL NULL. Missing statement names raise UnknownSTMT through ExpectedRows.
Telemetry records operation attempts, successes/failures, total/minimum/mean/maximum latency, rows returned, and categorized backend events. It does not retain SQL text or bind values. Its getters are safe to call while operations run; snapshots may reflect updates that complete during the read. The Shared handle owns the same cumulative telemetry object and remains valid after the database is disconnected or destroyed.
Questions and bugs: GitHub issues on this repository. Sponsorship: github.com/sponsors/StormBytePP.
Issues only on this repository. Fork and open a pull request against master.
Dual license: GNU Lesser General Public License v3.0 or later, or a commercial license from the copyright holder. See [LICENSE](LICENSE), COPYING.LGPLv3 and https://www.gnu.org/licenses/lgpl-3.0.html. Third-party trees under thirdparty/ keep their own licenses.