test(data): cover sessions, SQLite binding and PostgreSQL wire client

Shared session tests run on SQLite and PostgreSQL (types, nulls,
placeholders, transactions, constraint errors, COPY/bulk escaping,
cancellation). PostgreSQL tests cover SCRAM/MD5/cleartext/trust auth,
TLS, result decoding, bytea, LISTEN/NOTIFY, error mapping, pooling and
broken-connection recovery, and the statement cache. In-memory SQLite
now pools shared-cache connections and retries SQLITE_LOCKED.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 09:50:31 +00:00
1 parent 46cee365dc
commit 14567ecac3
8 files changed
+1015 -22

No files matched your search

+3 -3
View File
@@ -26,7 +26,8 @@ internal sealed record SqliteSettings(string DataSource, int PoolSize)
/// <summary>
/// SQLite through the system library (BRIEF §6.2). Up to <c>Pool Size</c> connections serve concurrent
/// readers (WAL); writes are serialised in-process by one async write lock, so writers wait in a queue instead
/// of spinning on SQLITE_BUSY. In-memory databases use a single shared-cache connection.
/// of spinning on SQLITE_BUSY. An in-memory database is a shared-cache URI that lives while the pool holds a
/// connection; its table locks (SQLITE_LOCKED) are retried by the sessions.
/// </summary>
public sealed class SqliteDatabase : IDatabase
{
@@ -51,7 +52,6 @@ public sealed class SqliteDatabase : IDatabase
if (_memory)
{
_filename = $"file:titano-{Guid.NewGuid():N}?mode=memory&cache=shared";
_maxConnections = 1;
}
else
{
@@ -59,8 +59,8 @@ public sealed class SqliteDatabase : IDatabase
var directory = System.IO.Path.GetDirectoryName(Path);
if (!string.IsNullOrEmpty(directory)) Directory.CreateDirectory(directory);
_filename = Path;
_maxConnections = settings.PoolSize;
}
_maxConnections = settings.PoolSize;
_slots = new SemaphoreSlim(_maxConnections, _maxConnections);
}