Skip to content

Commit fd580fb

Browse files
committed
Support for fb_info_db_guid (#940)
1 parent 74664e8 commit fd580fb

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

Provider/src/FirebirdSql.Data.FirebirdClient.Tests/FbDatabaseInfoTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public void CompleteDatabaseInfoTest()
4949
nameof(FbDatabaseInfo.GetNextAttachmentAsync),
5050
nameof(FbDatabaseInfo.GetNextStatementAsync),
5151
nameof(FbDatabaseInfo.GetReplicaModeAsync),
52-
nameof(FbDatabaseInfo.GetDbFileIdAsync)
52+
nameof(FbDatabaseInfo.GetDbFileIdAsync),
53+
nameof(FbDatabaseInfo.GetDbGuidAsync),
5354
}.Contains(m.Name))
5455
continue;
5556

Provider/src/FirebirdSql.Data.FirebirdClient/Common/IscHelper.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ public static List<object> ParseDatabaseInfo(byte[] buffer)
9292
info.Add(Encoding2.Default.GetString(buffer, pos, length));
9393
break;
9494

95+
case IscCodes.fb_info_db_guid:
96+
info.Add(Guid.ParseExact(Encoding2.Default.GetString(buffer, pos, length), "B"));
97+
break;
98+
9599
case IscCodes.isc_info_base_level:
96100
info.Add(string.Format(CultureInfo.CurrentCulture, "{0}.{1}", buffer[pos], buffer[pos + 1]));
97101
break;

Provider/src/FirebirdSql.Data.FirebirdClient/FirebirdClient/FbDatabaseInfo.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,15 @@ public Task<string> GetDbFileIdAsync(CancellationToken cancellationToken = defau
431431
return GetValueAsync<string>(IscCodes.fb_info_db_file_id, cancellationToken);
432432
}
433433

434+
public Guid GetDbGuid()
435+
{
436+
return GetValue<Guid>(IscCodes.fb_info_db_guid);
437+
}
438+
public Task<Guid> GetDbGuidAsync(CancellationToken cancellationToken = default)
439+
{
440+
return GetValueAsync<Guid>(IscCodes.fb_info_db_guid, cancellationToken);
441+
}
442+
434443
#endregion
435444

436445
#region Constructors

0 commit comments

Comments
 (0)