Files
Chronos/src/Titano.Data/Sqlite/SqliteException.cs
T
Claude a09aa16876 feat(data): add database abstractions and SQLite binding
IDatabase/IDbSession/IDbTransaction with positional $n parameters, typed
DbParam and DbRow, SqlDialect helpers, and a P/Invoke binding to the
system SQLite (winsqlite3 / libsqlite3) with WAL pragmas, statement
cache, serialized writes, busy retry, interrupt-based cancellation,
VACUUM INTO backups and restore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-02 09:40:33 +00:00

20 lines
971 B
C#

namespace Titano.Data.Sqlite;
/// <summary>An error returned by SQLite, with its primary and extended result codes.</summary>
public sealed class SqliteException(string message, int extendedResultCode) : DatabaseException(message)
{
/// <summary>Primary result code (low byte), e.g. 19 = SQLITE_CONSTRAINT.</summary>
public int ResultCode => ExtendedResultCode & 0xFF;
/// <summary>Extended result code, e.g. 2067 = SQLITE_CONSTRAINT_UNIQUE.</summary>
public int ExtendedResultCode { get; } = extendedResultCode;
public override int ErrorCode => ExtendedResultCode;
public override bool IsTransient => ResultCode is SqliteNative.SQLITE_BUSY or SqliteNative.SQLITE_LOCKED;
public override bool IsUniqueViolation => ExtendedResultCode is SqliteNative.SQLITE_CONSTRAINT_UNIQUE or SqliteNative.SQLITE_CONSTRAINT_PRIMARYKEY;
public override bool IsForeignKeyViolation => ExtendedResultCode == SqliteNative.SQLITE_CONSTRAINT_FOREIGNKEY;
}