feat(sqlite): harden Sqlite lifecycle/transactions/migrations/ops and add SqliteAsync pool

This commit is contained in:
faumaray committed 2026-11-26 15:17:59 +03:00
1 parent 9925ea1764
commit 427cc9a843
15 files changed
+4438 -134

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
#include <Void/Sqlite/Sqlite.hpp>
int main()
{
Void::Sqlite::OpenOptions opts;
auto db = Void::Sqlite::open_database(":memory:", opts);
if (!db) return 1;
if (!db->exec("CREATE TABLE t(id INTEGER PRIMARY KEY)").has_value()) return 2;
auto tx = db->begin(Void::Sqlite::BeginMode::Immediate);
if (!tx) return 3;
auto st = db->prepare("INSERT INTO t(id) VALUES(?)");
if (!st) return 4;
if (!st->bind_checked(1, Void::Sqlite::ValueView{7}).has_value()) return 5;
if (!st->step().has_value()) return 6;
if (!st->finalize_checked().has_value()) return 7;
if (!tx->commit().has_value()) return 8;
if (!db->close().has_value()) return 9;
return 0;
}