refactor(data): pin server output settings and guard busy connections

Pin bytea_output=hex and standard_conforming_strings=on in the startup
packet instead of tracking ParameterStatus values nobody read, so the
legacy bytea escape decoder goes away. A PostgreSQL connection now
refuses a new command while a row stream is still open, and the pool
discards such a connection. Drop unused SQLite declarations.

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 10:13:09 +00:00
1 parent 49fa8c5214
commit 8d9b04c713
7 files changed
+51 -51

No files matched your search

-2
View File
@@ -14,7 +14,6 @@ internal static unsafe class SqliteNative
private static int _resolverInstalled;
public const int SQLITE_OK = 0;
public const int SQLITE_ERROR = 1;
public const int SQLITE_INTERRUPT = 9;
public const int SQLITE_BUSY = 5;
public const int SQLITE_LOCKED = 6;
@@ -70,7 +69,6 @@ internal static unsafe class SqliteNative
[DllImport(Library, ExactSpelling = true)] public static extern int sqlite3_exec(nint db, byte* sql, nint callback, nint arg, out byte* errmsg);
[DllImport(Library, ExactSpelling = true)] public static extern void sqlite3_free(void* p);
[DllImport(Library, ExactSpelling = true)] public static extern byte* sqlite3_errmsg(nint db);
[DllImport(Library, ExactSpelling = true)] public static extern int sqlite3_extended_errcode(nint db);
[DllImport(Library, ExactSpelling = true)] public static extern void sqlite3_interrupt(nint db);
[DllImport(Library, ExactSpelling = true)] public static extern int sqlite3_changes(nint db);
[DllImport(Library, ExactSpelling = true)] public static extern int sqlite3_total_changes(nint db);
+2 -2
View File
@@ -6,8 +6,8 @@ namespace Titano.Data.Sqlite;
/// <summary>
/// A pooled SQLite connection. Statements that write take the database write lock for their duration when no
/// transaction holds it already; SQLITE_BUSY/LOCKED from other processes is retried a few times outside
/// transactions. Cancellation interrupts the running statement with <c>sqlite3_interrupt</c>.
/// transaction holds it already; lock conflicts are retried (see <see cref="StepAsync"/>). Cancellation
/// interrupts the running statement with <c>sqlite3_interrupt</c>.
/// </summary>
internal sealed class SqliteSession(SqliteDatabase database, SqliteConnection connection) : IDbSession
{