Skip to content

Commit cdfaa29

Browse files
authored
Add RecordVersionStatistics to FbStatisticalFlags (#125)
1 parent 4c0cc64 commit cdfaa29

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

src/FirebirdSql.Data.FirebirdClient.Tests/FbServicesTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,22 @@ public async Task StatisticsTest()
223223
await statisticalSvc.ExecuteAsync();
224224
}
225225

226+
[Test]
227+
public async Task StatisticsRecordVersionTest()
228+
{
229+
var sb = new StringBuilder();
230+
var statisticalSvc = new FbStatistical();
231+
statisticalSvc.ConnectionString = BuildServicesConnectionString(ServerType, Compression, WireCrypt, true);
232+
statisticalSvc.Options = FbStatisticalFlags.RecordVersionStatistics;
233+
statisticalSvc.ServiceOutput += (object sender, ServiceOutputEventArgs e) =>
234+
{
235+
sb.AppendLine(e.Message);
236+
};
237+
await statisticalSvc.ExecuteAsync();
238+
var statisticalOutput = sb.ToString();
239+
Assert.IsTrue(statisticalOutput.Contains("Average record length"),"Record statistics not found");
240+
}
241+
226242
[Test]
227243
public async Task FbLogTest()
228244
{

src/FirebirdSql.Data.FirebirdClient/Services/FbStatisticalFlags.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,43 @@
1616
//$Authors = Carlos Guzman Alvarez, Jiri Cincura ([email protected])
1717

1818
using System;
19+
using System.ComponentModel;
1920

2021
namespace FirebirdSql.Data.Services;
2122

23+
/// <summary>
24+
/// Flags used by FbStatistical.Options
25+
/// </summary>
2226
[Flags]
2327
public enum FbStatisticalFlags
2428
{
29+
/// <summary>
30+
/// analyze data pages
31+
/// </summary>
2532
DataPages = 0x01,
33+
34+
/// <summary>
35+
/// DatabaseLog - no longer used by firebird
36+
/// </summary>
2637
DatabaseLog = 0x02,
38+
39+
/// <summary>
40+
/// analyze header page ONLY
41+
/// </summary>
2742
HeaderPages = 0x04,
43+
44+
/// <summary>
45+
/// analyze index leaf pages
46+
/// </summary>
2847
IndexPages = 0x08,
48+
49+
/// <summary>
50+
/// analyze system relations in addition to user tables
51+
/// </summary>
2952
SystemTablesRelations = 0x10,
53+
54+
/// <summary>
55+
/// analyze average record and version length
56+
/// </summary>
57+
RecordVersionStatistics = 0x20,
3058
}

src/FirebirdSql.Data.TestsBase/FbTestsBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ public static FbConnectionStringBuilder BuildServicesConnectionStringBuilder(FbS
196196
builder.Database = FbTestsSetup.Database(serverType, compression, wireCrypt);
197197
}
198198
builder.ServerType = serverType;
199+
builder.Port = FbTestsSetup.Port;
199200
return builder;
200201
}
201202

0 commit comments

Comments
 (0)