Path: redb-route/tests/redb.Route.Tests.Sql/E2E/Infrastructure/FirebirdE2EProvider.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests.Sql/E2E/Infrastructure/FirebirdE2EProvider.cs
----
using System.Data.Common;
using FirebirdSql.Data.FirebirdClient;
namespace redb.Route.Tests.Sql.E2E.Infrastructure;
///
/// Firebird 5 through FirebirdClient (tier 2). Container route-firebird, profile firebird of docker-compose.tests.yml,
/// brought up for a run and removed after it. The connector reaches Firebird with the default placeholderStyle=At.
///
///
/// Pooling is off: a pooled attachment can keep the table in use and have the DROP TABLE of the test's dispose refused.
///
public sealed class FirebirdE2EProvider : SqlE2EProvider
{
private const string EnvironmentVariable = "ROUTE_SQL_FIREBIRD_CS";
private const string DefaultConnectionString =
"User=SYSDBA;Password=1;Database=/var/lib/firebird/data/route_sql.fdb;DataSource=127.0.0.1;Port=3050;Charset=UTF8;" +
"Pooling=false;Connection Timeout=15";
public override string Name => "firebird";
public override DbProviderFactory Factory => FirebirdClientFactory.Instance;
public override string ConnectionString =>
Environment.GetEnvironmentVariable(EnvironmentVariable)?.Trim() is { Length: > 0 } cs ? cs : DefaultConnectionString;
public override string StartHint =>
$"Tier 2, temporary: '{(global::redb.Route.Tests.Shared.TestStand.Up(Name))}' (container route-{Name}), " +
$"and 'docker compose -f redb.Route/docker-compose.tests.yml --profile {Name} down -v' after the run; override the connection with {EnvironmentVariable}.";
public override string CreateTableSql(string table) =>
$"CREATE TABLE {table} (id INTEGER NOT NULL PRIMARY KEY, val VARCHAR(50) NOT NULL)";
public override string CreateNullableTableSql(string table) =>
$"CREATE TABLE {table} (id INTEGER NOT NULL PRIMARY KEY, val VARCHAR(50), n BIGINT)";
public override string ReturningInsertSql(string table) =>
$"INSERT INTO {table} (id, val) VALUES (:#id, :#val) RETURNING id";
public override string NativeReturningInsertSql(string table) =>
$"INSERT INTO {table} (id, val) VALUES (@id, @val) RETURNING id";
public override string TransactionKillingLiteral(string table) =>
$"INSERT INTO {table} (id, val) VALUES (CAST('abc' AS INTEGER), 'x')";
public override string TransactionKillingBatchSql(string table) =>
$"INSERT INTO {table} (id, val) VALUES (CAST(:#id AS INTEGER), :#val)";
public override List> TransactionKillingItems() =>
[
new() { ["id"] = "1", ["val"] = "a" },
new() { ["id"] = "abc", ["val"] = "x" },
new() { ["id"] = "3", ["val"] = "c" },
];
// Measured 2026-09-15 (FirebirdE2ETests): every statement runs under its own implicit savepoint, so a failed one is undone
// and the transaction goes on.
public override int[] LoopContinueDuplicateKeyRows => [1, 3];
public override int[] LoopContinueTransactionKillingRows => [1, 3];
public override bool DuplicateKeyDestroysTransaction => false;
public override bool TransactionKillingErrorDestroysTransaction => false;
public override bool ReportsSavepointSupport => true;
public override bool CommandAfterTransactionKillingErrorIsRejected => false;
public override bool CanCreateBatch => false;
public override bool PrepareRejectsUntypedParameters => false;
}