25 lines
687 B
C++
25 lines
687 B
C++
#include <Void/Sqlite/AsyncPool.hpp>
|
|
|
|
#include <atomic>
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <unistd.h>
|
|
|
|
int main()
|
|
{
|
|
const auto dir = std::filesystem::temp_directory_path() /
|
|
("void-sqlite-async-pkg-" + std::to_string(::getpid()));
|
|
std::error_code ec;
|
|
std::filesystem::remove_all(dir, ec);
|
|
std::filesystem::create_directories(dir, ec);
|
|
|
|
Void::Sqlite::AsyncPoolOptions opts;
|
|
opts.path = dir / "pkg.db";
|
|
opts.reader_connections = 2;
|
|
auto pool = Void::Sqlite::AsyncPool::open(opts);
|
|
const bool ok = pool.has_value() && pool->stats().reader_connections == 2 &&
|
|
pool->close_and_join().has_value();
|
|
std::filesystem::remove_all(dir, ec);
|
|
return ok ? 0 : 1;
|
|
}
|