From ad32f3824c4d4cbfd8927aa09306570777c5bb24 Mon Sep 17 00:00:00 2001 From: "Dailey, Alaric" Date: Tue, 20 Oct 2026 08:39:44 -0500 Subject: [PATCH 01/11] Make HasRows report whether rows exist --- .../FbDataReaderTests.cs | 33 +++++++++++++++ .../FirebirdClient/FbDataReader.cs | 40 +++++++++++++++++-- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs b/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs index c87c804bc..5828dffac 100644 --- a/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs +++ b/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs @@ -54,6 +54,39 @@ public async Task ReadTest() } } + [Test] + public async Task HasRowsIsFalseForAnEmptyResultTest() + { + // DbDataReader.HasRows: "true if the DbDataReader contains one or more rows; otherwise false." + await using (var command = new FbCommand("select INT_FIELD from TEST where 1 = 0", Connection)) + { + await using (var reader = await command.ExecuteReaderAsync()) + { + Assert.IsFalse(reader.HasRows); + Assert.IsFalse(await reader.ReadAsync()); + } + } + } + + [Test] + public async Task HasRowsDoesNotSkipTheFirstRowTest() + { + await using (var command = new FbCommand("select INT_FIELD from TEST where INT_FIELD in (1, 2) order by INT_FIELD", Connection)) + { + await using (var reader = await command.ExecuteReaderAsync()) + { + Assert.IsTrue(reader.HasRows); + Assert.IsTrue(reader.HasRows); + Assert.IsTrue(await reader.ReadAsync()); + Assert.AreEqual(1, reader.GetInt32(0)); + Assert.IsTrue(reader.Read()); + Assert.AreEqual(2, reader.GetInt32(0)); + Assert.IsFalse(reader.Read()); + Assert.IsTrue(reader.HasRows, "HasRows describes the result, not the current position"); + } + } + } + [Test] public async Task ReadClobTest() { diff --git a/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs b/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs index 0cf1d40c4..903fc03c8 100644 --- a/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs +++ b/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs @@ -51,6 +51,9 @@ public sealed class FbDataReader : DbDataReader private bool _eof; private bool _isClosed; private int _position; + private DbValue[] _peekedRow; + private bool _hasPeekedRow; + private bool _hasRows; private int _recordsAffected; private Dictionary _columnsIndexesOrdinal; private Dictionary _columnsIndexesOrdinalCI; @@ -102,9 +105,25 @@ public override int Depth } } + /// + /// DbDataReader.HasRows: "true if the DbDataReader contains one or more rows; otherwise false." Before the first + /// Read this fetches one row ahead; Read then returns that row. + /// public override bool HasRows { - get { return _command.HasFields; } + get + { + if (!_hasRows && !_isClosed && !_hasPeekedRow && _position == StartPosition && _command != null && _command.HasFields && !IsCommandBehavior(CommandBehavior.SchemaOnly)) + { + using (var explicitCancellation = ExplicitCancellation.Enter(CancellationToken.None, _command.Cancel)) + { + _peekedRow = _command.Fetch(); + } + _hasPeekedRow = true; + _hasRows = _peekedRow != null; + } + return _hasRows; + } } public override bool IsClosed @@ -166,6 +185,8 @@ public override void Close() _command = null; _connection = null; _row = null; + _peekedRow = null; + _hasPeekedRow = false; _schemaTable = null; _fields = null; } @@ -195,6 +216,8 @@ public override async Task CloseAsync() _command = null; _connection = null; _row = null; + _peekedRow = null; + _hasPeekedRow = false; _schemaTable = null; _fields = null; } @@ -229,10 +252,11 @@ public override bool Read() { using (var explicitCancellation = ExplicitCancellation.Enter(CancellationToken.None, _command.Cancel)) { - _row = _command.Fetch(); + _row = TakePeekedRow(out var peeked) ? peeked : _command.Fetch(); if (_row != null) { _position++; + _hasRows = true; return true; } else @@ -259,10 +283,11 @@ public override async Task ReadAsync(CancellationToken cancellationToken) { using (var explicitCancellation = ExplicitCancellation.Enter(cancellationToken, _command.Cancel)) { - _row = await _command.FetchAsync(explicitCancellation.CancellationToken).ConfigureAwait(false); + _row = TakePeekedRow(out var peeked) ? peeked : await _command.FetchAsync(explicitCancellation.CancellationToken).ConfigureAwait(false); if (_row != null) { _position++; + _hasRows = true; return true; } else @@ -1012,6 +1037,15 @@ private FbDbType GetProviderType(int i) return (FbDbType)_fields[i].DbDataType; } + private bool TakePeekedRow(out DbValue[] row) + { + row = _peekedRow; + var hadPeekedRow = _hasPeekedRow; + _peekedRow = null; + _hasPeekedRow = false; + return hadPeekedRow; + } + private void UpdateRecordsAffected() { if (_command != null && !_command.IsDisposed) From a31867d8b189f60a2daece932f1aeb65260c3673 Mon Sep 17 00:00:00 2001 From: "Dailey, Alaric" Date: Wed, 4 Nov 2026 08:49:17 -0600 Subject: [PATCH 02/11] Keep stored procedure output when HasRows peeks HasRows fetches one row ahead. For a stored procedure that row is the output-parameter row, so closing the reader without calling Read left SetOutputParameters with an empty queue and the output parameters unset. Close and CloseAsync now pass the peeked row to SetOutputParameters. Also drop a duplicated HasRows assertion and document why _hasPeekedRow is kept. Co-Authored-By: Claude Haiku 5.5 --- .../FbDataReaderTests.cs | 53 ++++++++++++++++++- .../FirebirdClient/FbDataReader.cs | 9 +++- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs b/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs index 5828dffac..05b7773a5 100644 --- a/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs +++ b/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs @@ -75,7 +75,6 @@ public async Task HasRowsDoesNotSkipTheFirstRowTest() { await using (var reader = await command.ExecuteReaderAsync()) { - Assert.IsTrue(reader.HasRows); Assert.IsTrue(reader.HasRows); Assert.IsTrue(await reader.ReadAsync()); Assert.AreEqual(1, reader.GetInt32(0)); @@ -87,6 +86,58 @@ public async Task HasRowsDoesNotSkipTheFirstRowTest() } } + [Test] + public async Task HasRowsThenCloseKeepsStoredProcedureOutputParametersTest() + { + await using (var create = Connection.CreateCommand()) + { + create.CommandText = "RECREATE PROCEDURE HASROWS_OUTPUT (P1 INTEGER) RETURNS (R1 INTEGER) AS BEGIN R1 = P1 * 2; END"; + await create.ExecuteNonQueryAsync(); + } + + await using (var command = new FbCommand("EXECUTE PROCEDURE HASROWS_OUTPUT(?)", Connection)) + { + command.CommandType = CommandType.StoredProcedure; + command.Parameters.Add("P1", FbDbType.Integer).Value = 21; + var output = command.Parameters.Add("R1", FbDbType.Integer); + output.Direction = ParameterDirection.Output; + + await using (var reader = await command.ExecuteReaderAsync()) + { + Assert.IsTrue(reader.HasRows); + await reader.CloseAsync(); + } + + Assert.AreEqual(42, output.Value, "HasRows must not consume the stored procedure output row"); + } + } + + [Test] + public void HasRowsThenCloseKeepsStoredProcedureOutputParametersSyncTest() + { + using (var create = Connection.CreateCommand()) + { + create.CommandText = "RECREATE PROCEDURE HASROWS_OUTPUT (P1 INTEGER) RETURNS (R1 INTEGER) AS BEGIN R1 = P1 * 2; END"; + create.ExecuteNonQuery(); + } + + using (var command = new FbCommand("EXECUTE PROCEDURE HASROWS_OUTPUT(?)", Connection)) + { + command.CommandType = CommandType.StoredProcedure; + command.Parameters.Add("P1", FbDbType.Integer).Value = 21; + var output = command.Parameters.Add("R1", FbDbType.Integer); + output.Direction = ParameterDirection.Output; + + using (var reader = command.ExecuteReader()) + { + Assert.IsTrue(reader.HasRows); + reader.Close(); + } + + Assert.AreEqual(42, output.Value, "HasRows must not consume the stored procedure output row"); + } + } + [Test] public async Task ReadClobTest() { diff --git a/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs b/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs index 903fc03c8..c9e53707a 100644 --- a/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs +++ b/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs @@ -51,6 +51,9 @@ public sealed class FbDataReader : DbDataReader private bool _eof; private bool _isClosed; private int _position; + // Row fetched ahead by HasRows. _hasPeekedRow is needed because a peek that found nothing + // leaves _peekedRow null, and that must still count as "already fetched" so the statement is not + // fetched again. _peekedRow is only non-null while _hasPeekedRow is true. private DbValue[] _peekedRow; private bool _hasPeekedRow; private bool _hasRows; @@ -169,7 +172,8 @@ public override void Close() { if (_command.CommandType == CommandType.StoredProcedure) { - _command.SetOutputParameters(); + // HasRows may already have fetched the output row; hand it over rather than losing it. + _command.SetOutputParameters(_peekedRow); } if (_command.HasImplicitTransaction) { @@ -200,7 +204,8 @@ public override async Task CloseAsync() { if (_command.CommandType == CommandType.StoredProcedure) { - await _command.SetOutputParametersAsync(CancellationToken.None).ConfigureAwait(false); + // HasRows may already have fetched the output row; hand it over rather than losing it. + await _command.SetOutputParametersAsync(_peekedRow, CancellationToken.None).ConfigureAwait(false); } if (_command.HasImplicitTransaction) { From eac17191d751bf6e6013319d04c91b053573318c Mon Sep 17 00:00:00 2001 From: "Dailey, Alaric" Date: Wed, 11 Nov 2026 18:39:26 -0600 Subject: [PATCH 03/11] Use async reads in HasRows regression test --- .../FbDataReaderTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs b/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs index 05b7773a5..8148cde16 100644 --- a/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs +++ b/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs @@ -78,9 +78,9 @@ public async Task HasRowsDoesNotSkipTheFirstRowTest() Assert.IsTrue(reader.HasRows); Assert.IsTrue(await reader.ReadAsync()); Assert.AreEqual(1, reader.GetInt32(0)); - Assert.IsTrue(reader.Read()); + Assert.IsTrue(await reader.ReadAsync()); Assert.AreEqual(2, reader.GetInt32(0)); - Assert.IsFalse(reader.Read()); + Assert.IsFalse(await reader.ReadAsync()); Assert.IsTrue(reader.HasRows, "HasRows describes the result, not the current position"); } } From 574d8c4f1d6a053f9ff9481d0b615dff940d0fb0 Mon Sep 17 00:00:00 2001 From: "Dailey, Alaric" Date: Fri, 13 Nov 2026 05:02:44 -0600 Subject: [PATCH 04/11] Avoid repeated fetches after reader EOF --- .../FbDataReaderTests.cs | 1 + .../FirebirdClient/FbDataReader.cs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs b/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs index 8148cde16..6c9d7c727 100644 --- a/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs +++ b/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs @@ -64,6 +64,7 @@ public async Task HasRowsIsFalseForAnEmptyResultTest() { Assert.IsFalse(reader.HasRows); Assert.IsFalse(await reader.ReadAsync()); + Assert.IsFalse(await reader.ReadAsync()); } } } diff --git a/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs b/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs index c9e53707a..68695400f 100644 --- a/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs +++ b/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs @@ -244,6 +244,10 @@ public override async ValueTask DisposeAsync() public override bool Read() { CheckState(); + if (_eof) + { + return false; + } if (IsCommandBehavior(CommandBehavior.SchemaOnly)) { @@ -275,6 +279,10 @@ public override bool Read() public override async Task ReadAsync(CancellationToken cancellationToken) { CheckState(); + if (_eof) + { + return false; + } if (IsCommandBehavior(CommandBehavior.SchemaOnly)) { From 3b45d3ddc8845b1d7bbce116c99cc992de268e3f Mon Sep 17 00:00:00 2001 From: "Dailey, Alaric" Date: Sat, 28 Nov 2026 11:32:09 -0600 Subject: [PATCH 05/11] test: add progress markers to embedded HasRows regression --- .../FbDataReaderTests.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs b/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs index 6c9d7c727..817e4f3b5 100644 --- a/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs +++ b/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs @@ -76,12 +76,17 @@ public async Task HasRowsDoesNotSkipTheFirstRowTest() { await using (var reader = await command.ExecuteReaderAsync()) { + TestContext.Progress.WriteLine("HasRows test: before HasRows"); Assert.IsTrue(reader.HasRows); + TestContext.Progress.WriteLine("HasRows test: after HasRows"); Assert.IsTrue(await reader.ReadAsync()); + TestContext.Progress.WriteLine("HasRows test: after first ReadAsync"); Assert.AreEqual(1, reader.GetInt32(0)); Assert.IsTrue(await reader.ReadAsync()); + TestContext.Progress.WriteLine("HasRows test: after second ReadAsync"); Assert.AreEqual(2, reader.GetInt32(0)); Assert.IsFalse(await reader.ReadAsync()); + TestContext.Progress.WriteLine("HasRows test: after EOF ReadAsync"); Assert.IsTrue(reader.HasRows, "HasRows describes the result, not the current position"); } } From 7d8a86b4c1ef148c578c02aeee95512eaa3214a6 Mon Sep 17 00:00:00 2001 From: "Dailey, Alaric" Date: Sat, 28 Nov 2026 11:35:45 -0600 Subject: [PATCH 06/11] test: narrow embedded HasRows crash location --- src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs b/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs index 817e4f3b5..f1354f87d 100644 --- a/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs +++ b/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs @@ -81,7 +81,9 @@ public async Task HasRowsDoesNotSkipTheFirstRowTest() TestContext.Progress.WriteLine("HasRows test: after HasRows"); Assert.IsTrue(await reader.ReadAsync()); TestContext.Progress.WriteLine("HasRows test: after first ReadAsync"); + TestContext.Progress.WriteLine("HasRows test: before first GetInt32"); Assert.AreEqual(1, reader.GetInt32(0)); + TestContext.Progress.WriteLine("HasRows test: after first GetInt32"); Assert.IsTrue(await reader.ReadAsync()); TestContext.Progress.WriteLine("HasRows test: after second ReadAsync"); Assert.AreEqual(2, reader.GetInt32(0)); From 8a2ef09fd9f3b860ae78937ba924ab5db651b7ab Mon Sep 17 00:00:00 2001 From: "Dailey, Alaric" Date: Sat, 28 Nov 2026 11:44:25 -0600 Subject: [PATCH 07/11] fix: keep HasRows and async reads on same fetch path --- .../FirebirdClient/FbDataReader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs b/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs index 68695400f..63d6ab594 100644 --- a/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs +++ b/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs @@ -110,7 +110,7 @@ public override int Depth /// /// DbDataReader.HasRows: "true if the DbDataReader contains one or more rows; otherwise false." Before the first - /// Read this fetches one row ahead; Read then returns that row. + /// Read this fetches one row ahead through the async statement path; Read then returns that row. /// public override bool HasRows { @@ -120,7 +120,7 @@ public override bool HasRows { using (var explicitCancellation = ExplicitCancellation.Enter(CancellationToken.None, _command.Cancel)) { - _peekedRow = _command.Fetch(); + _peekedRow = _command.FetchAsync(explicitCancellation.CancellationToken).GetAwaiter().GetResult(); } _hasPeekedRow = true; _hasRows = _peekedRow != null; From dffa01ff2dd00624dc575857a4b22c4509945794 Mon Sep 17 00:00:00 2001 From: "Dailey, Alaric" Date: Sat, 28 Nov 2026 11:44:52 -0600 Subject: [PATCH 08/11] test: remove temporary embedded diagnostics --- .../FbDataReaderTests.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs b/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs index f1354f87d..6c9d7c727 100644 --- a/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs +++ b/src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs @@ -76,19 +76,12 @@ public async Task HasRowsDoesNotSkipTheFirstRowTest() { await using (var reader = await command.ExecuteReaderAsync()) { - TestContext.Progress.WriteLine("HasRows test: before HasRows"); Assert.IsTrue(reader.HasRows); - TestContext.Progress.WriteLine("HasRows test: after HasRows"); Assert.IsTrue(await reader.ReadAsync()); - TestContext.Progress.WriteLine("HasRows test: after first ReadAsync"); - TestContext.Progress.WriteLine("HasRows test: before first GetInt32"); Assert.AreEqual(1, reader.GetInt32(0)); - TestContext.Progress.WriteLine("HasRows test: after first GetInt32"); Assert.IsTrue(await reader.ReadAsync()); - TestContext.Progress.WriteLine("HasRows test: after second ReadAsync"); Assert.AreEqual(2, reader.GetInt32(0)); Assert.IsFalse(await reader.ReadAsync()); - TestContext.Progress.WriteLine("HasRows test: after EOF ReadAsync"); Assert.IsTrue(reader.HasRows, "HasRows describes the result, not the current position"); } } From 300fa8c4c2bccf52723a3644329348c4ce33a395 Mon Sep 17 00:00:00 2001 From: "Dailey, Alaric" Date: Sat, 28 Nov 2026 12:15:44 -0600 Subject: [PATCH 09/11] revert: keep synchronous HasRows fetch --- .../FirebirdClient/FbDataReader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs b/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs index 63d6ab594..68695400f 100644 --- a/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs +++ b/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDataReader.cs @@ -110,7 +110,7 @@ public override int Depth /// /// DbDataReader.HasRows: "true if the DbDataReader contains one or more rows; otherwise false." Before the first - /// Read this fetches one row ahead through the async statement path; Read then returns that row. + /// Read this fetches one row ahead; Read then returns that row. /// public override bool HasRows { @@ -120,7 +120,7 @@ public override bool HasRows { using (var explicitCancellation = ExplicitCancellation.Enter(CancellationToken.None, _command.Cancel)) { - _peekedRow = _command.FetchAsync(explicitCancellation.CancellationToken).GetAwaiter().GetResult(); + _peekedRow = _command.Fetch(); } _hasPeekedRow = true; _hasRows = _peekedRow != null; From f947ab53b1a603fb5605cf438bfbd061b68ff42c Mon Sep 17 00:00:00 2001 From: "Dailey, Alaric" Date: Fri, 4 Dec 2026 19:17:28 -0600 Subject: [PATCH 10/11] ci: require Firebird 5.0.4 for the FB50 suites The embedded HasRows tests crash the Firebird 5.0.0 engine (the CI build, WI-V5.0.0.1306) on the second fetch after a HasRows peek. The crash does not occur on 5.0.4. - Download the official 5.0.4 Windows release for FB50 instead of the test-infrastructure archive. - Copy fbclient.dll to fbembed.dll when the release does not ship it; the embedded client loads fbembed.dll. - Fail the run when the started server reports a version below MinimumVersion (5.0.4 for FB50). Co-Authored-By: Claude Haiku 5.5 --- tests.ps1 | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests.ps1 b/tests.ps1 index 6af9ac102..dde088717 100644 --- a/tests.ps1 +++ b/tests.ps1 @@ -12,9 +12,11 @@ $baseDir = Split-Path -Parent $PSCommandPath $FirebirdConfiguration = @{ FB50 = @{ - Download = 'https://github.com/FirebirdSQL/NETProvider-tests-infrastructure/raw/master/fb50.7z' + # Official 5.0.4 release. The embedded suite crashes the engine on 5.0.0 (see HasRows tests), so 5.0.4 is required. + Download = 'https://github.com/FirebirdSQL/firebird/releases/download/v5.0.4/Firebird-5.0.4.1812-0-windows-x64.zip' Executable = '.\firebird.exe' Args = @('-a') + MinimumVersion = [version]'5.0.4' } FB40 = @{ Download = 'https://github.com/FirebirdSQL/NETProvider-tests-infrastructure/raw/master/fb40.7z' @@ -59,14 +61,25 @@ function Prepare() { echo "Extracting $fbDownloadName" 7z x -bsp0 -bso0 $fbDownloadName rm $fbDownloadName + # The embedded client is loaded as fbembed.dll; the official release only ships fbclient.dll. + if (!(Test-Path .\fbembed.dll)) { + cp .\fbclient.dll .\fbembed.dll + } cp -Recurse -Force .\* $testsProviderDir ni firebird.log -ItemType File | Out-Null echo "Starting Firebird" $process = Start-Process -FilePath $selectedConfiguration.Executable -ArgumentList $selectedConfiguration.Args -PassThru - echo "Version: $($process.MainModule.FileVersionInfo.FileVersion)" + $fbVersionText = $process.MainModule.FileVersionInfo.FileVersion + echo "Version: $fbVersionText" $script:firebirdProcess = $process + if ($selectedConfiguration.MinimumVersion) { + $fbVersion = [version]([regex]::Match($fbVersionText, '\d+\.\d+\.\d+').Value) + if ($fbVersion -lt $selectedConfiguration.MinimumVersion) { + throw "Firebird $fbVersion is older than the required $($selectedConfiguration.MinimumVersion)" + } + } echo "=== END ===" } From bab8d9c13e6b76bbe0d84e0ddabcbbfd59f1e376 Mon Sep 17 00:00:00 2001 From: "Dailey, Alaric" Date: Sat, 5 Dec 2026 05:27:34 -0600 Subject: [PATCH 11/11] ci: take the FB50 security database and config from the infrastructure archive The official Firebird 5.0.4 Windows release ships an uninitialized SECURITY5.FDB (no SYSDBA account, so every Default-server test fails with "Install incomplete") and a firebird.conf whose wire-crypt defaults reject the CryptDisabled and CryptRequired suites. Keep the official 5.0.4 binaries and overlay SECURITY5.FDB and firebird.conf from the test-infrastructure archive, which the suites were written against. Co-Authored-By: Claude Haiku 5.5 --- tests.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests.ps1 b/tests.ps1 index dde088717..e9e3127f6 100644 --- a/tests.ps1 +++ b/tests.ps1 @@ -17,6 +17,10 @@ $FirebirdConfiguration = @{ Executable = '.\firebird.exe' Args = @('-a') MinimumVersion = [version]'5.0.4' + # The official release ships an uninitialized security database and a different firebird.conf; + # the test suite needs the prepared SYSDBA account and wire-crypt settings from the infrastructure archive. + ConfigDownload = 'https://github.com/FirebirdSQL/NETProvider-tests-infrastructure/raw/master/fb50.7z' + ConfigFiles = @('SECURITY5.FDB', 'firebird.conf') } FB40 = @{ Download = 'https://github.com/FirebirdSQL/NETProvider-tests-infrastructure/raw/master/fb40.7z' @@ -65,6 +69,11 @@ function Prepare() { if (!(Test-Path .\fbembed.dll)) { cp .\fbclient.dll .\fbembed.dll } + if ($selectedConfiguration.ConfigDownload) { + Invoke-RestMethod -Uri $selectedConfiguration.ConfigDownload -OutFile fb_config.7z + 7z x -y -bsp0 -bso0 fb_config.7z $selectedConfiguration.ConfigFiles + rm fb_config.7z + } cp -Recurse -Force .\* $testsProviderDir ni firebird.log -ItemType File | Out-Null