Skip to content

Commit

Permalink
Synchronized edmx with RunningConnectionTable connection management.
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackbirdSQL committed Feb 2, 2024
1 parent ecf561b commit 8f99350
Show file tree
Hide file tree
Showing 50 changed files with 1,012 additions and 676 deletions.
Binary file modified BlackbirdDsl/BlackbirdDsl.rc
Binary file not shown.
8 changes: 4 additions & 4 deletions BlackbirdDsl/BlackbirdDsl.rc2
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 10,1,2,1
PRODUCTVERSION 10,1,2,1
FILEVERSION 10,1,2,2
PRODUCTVERSION 10,1,2,2
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -32,12 +32,12 @@ BLOCK "1c0904b0"
BEGIN
VALUE "CompanyName", "BlackbirdSql"
VALUE "FileDescription", "Blackbird Dsl Parser"
VALUE "FileVersion", "10.1.2.1"
VALUE "FileVersion", "10.1.2.2"
VALUE "InternalName", "BlackbirdDsl.dll"
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", "BlackbirdDsl.dll"
VALUE "ProductName", "BlackbirdDsl"
VALUE "ProductVersion", "10.1.2.1"
VALUE "ProductVersion", "10.1.2.2"
END
END
BLOCK "VarFileInfo"
Expand Down
6 changes: 3 additions & 3 deletions BlackbirdDsl/Include/AssemblyInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#define Assembly_Copyright L"Copyright © BlackbirdSql 2023"
#define Assembly_Description L"BlackbirdSql DSL Parser"
#define File_Version 10,1,2,1
#define File_Version_Str "10.1.2.1"
#define File_Version 10,1,2,2
#define File_Version_Str "10.1.2.2"

//CLR assembly version
#define Assembly_Version L"10.1.2.1"
#define Assembly_Version L"10.1.2.2"

59 changes: 25 additions & 34 deletions BlackbirdSql.Common/Controls/ResultsPane/StatisticsPropertySet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,17 @@ public enum EnStatisticSpecialAction



public struct StatisticEntity
public struct StatisticEntity(string name, EnStatisticSpecialAction specialAction, bool calculateAverage = true)
{
public static ResourceManager ResMgr => AttributeResources.ResourceManager;

public string Name;
public string Name = name;
public EnStatisticSpecialAction SpecialAction = specialAction;
public bool CalculateAverage = calculateAverage;

public readonly string DisplayName => ResMgr.GetString("StatisticsPanelStat" + Name);

public EnStatisticSpecialAction SpecialAction;
public static ResourceManager ResMgr => AttributeResources.ResourceManager;

public bool CalculateAverage;
public readonly string DisplayName => ResMgr.GetString("StatisticsPanelStat" + Name);

public StatisticEntity(string name, EnStatisticSpecialAction specialAction, bool calculateAverage = true)
{
Name = name;
SpecialAction = specialAction;
CalculateAverage = calculateAverage;
}
}


Expand All @@ -52,27 +45,27 @@ public StatisticEntity(string name, EnStatisticSpecialAction specialAction, bool
/// <summary>
/// Array of statistics categories
/// </summary>
public static readonly string[] SCategoryNames = new string[5]
{
public static readonly string[] SCategoryNames =
[
AttributeResources.StatisticsPanelCategorySnapshotTimestamp,
AttributeResources.StatisticsPanelCategoryQueryProfileStats,
AttributeResources.StatisticsPanelCategoryNetworkStats,
AttributeResources.StatisticsPanelCategoryTimeStats,
AttributeResources.StatisticsPanelCategoryServerStats
};
];


/// <summary>
/// Delegates for generating Statistic category values.
/// </summary>
public static readonly GetCategoryValueDelegate[] SCategoryValueDelegates = new GetCategoryValueDelegate[5]
{
public static readonly GetCategoryValueDelegate[] SCategoryValueDelegates =
[
new GetCategoryValueDelegate(GetTimeOfExecution),
null,
null,
null,
null,
};
];


/// <summary>
Expand All @@ -84,54 +77,52 @@ public StatisticEntity(string name, EnStatisticSpecialAction specialAction, bool
/// 3. Including it in the StatisticsConnection.Load() method, and
/// 4. Including it in StatisticsControl.RetrieveStatisticsIfNeeded()
/// </summary>
public static readonly StatisticEntity[][] SStatisticEntities = new StatisticEntity[5][]
{
public static readonly StatisticEntity[][] SStatisticEntities =
[
// ClientExecutionTime
new StatisticEntity[0],

// QueryProfileStatistics
new StatisticEntity[6]
{
[
new StatisticEntity("IduRowCount", EnStatisticSpecialAction.SIFormat),
new StatisticEntity("InsRowCount", EnStatisticSpecialAction.SIFormat),
new StatisticEntity("UpdRowCount", EnStatisticSpecialAction.SIFormat),
new StatisticEntity("DelRowCount", EnStatisticSpecialAction.SIFormat),
new StatisticEntity("SelectRowCount", EnStatisticSpecialAction.SIFormat),
new StatisticEntity("Transactions", EnStatisticSpecialAction.SIFormat)
},
],

// NetworkStatistics
new StatisticEntity[8]
{
[
new StatisticEntity("ServerRoundtrips", EnStatisticSpecialAction.SIFormat),
new StatisticEntity("BufferCount", EnStatisticSpecialAction.SIFormat, false),
new StatisticEntity("ReadCount", EnStatisticSpecialAction.SIFormat),
new StatisticEntity("WriteCount", EnStatisticSpecialAction.SIFormat),
// new StatisticEntity("ReadIdxCount", EnStatisticSpecialAction.SIFormat),
// new StatisticEntity("ReadSeqCount", EnStatisticSpecialAction.SIFormat),
new StatisticEntity("PurgeCount", EnStatisticSpecialAction.SIFormat),
new StatisticEntity("ExpungeCount", EnStatisticSpecialAction.SIFormat),
new StatisticEntity("Marks", EnStatisticSpecialAction.SIFormat),
new StatisticEntity("PacketSize", EnStatisticSpecialAction.ByteFormat, false)
},
],

// TimeStatistics
new StatisticEntity[3]
{
[
new StatisticEntity("ExecutionStartTimeEpoch", EnStatisticSpecialAction.DateTimeFormat, false),
new StatisticEntity("ExecutionEndTimeEpoch", EnStatisticSpecialAction.DateTimeFormat, false),
new StatisticEntity("ExecutionTimeTicks", EnStatisticSpecialAction.ElapsedTimeFormat),
},
],

// ServerStatistics
new StatisticEntity[6]
{
[
new StatisticEntity("AllocationPages", EnStatisticSpecialAction.SIFormat, false),
new StatisticEntity("CurrentMemory", EnStatisticSpecialAction.ByteFormat),
new StatisticEntity("MaxMemory", EnStatisticSpecialAction.ByteFormat),
new StatisticEntity("DatabaseSizeInPages", EnStatisticSpecialAction.SIFormat, false),
new StatisticEntity("PageSize", EnStatisticSpecialAction.ByteFormat, false),
new StatisticEntity("ActiveUserCount", EnStatisticSpecialAction.SIFormat)
}
};
]
];



Expand Down
29 changes: 11 additions & 18 deletions BlackbirdSql.Common/Controls/ResultsPane/StatisticsSnapshotAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

namespace BlackbirdSql.Common.Controls.ResultsPane;

public class StatisticsSnapshotAgent
public class StatisticsSnapshotAgent(FbConnection connection, StatisticsSnapshotAgent statisticsSnapShotBase = null)
{
private readonly FbConnection _InternalConnection;
private readonly StatisticsSnapshotAgent _StatisticsSnapShotBase = null;
private readonly FbConnection _InternalConnection = connection;
private readonly StatisticsSnapshotAgent _StatisticsSnapShotBase = statisticsSnapShotBase;


// QueryProfileStatistics
Expand Down Expand Up @@ -92,27 +92,20 @@ public class StatisticsSnapshotAgent
public List<string> ActiveUsers => _ActiveUsers;
public long ActiveUserCount => _ActiveUsers == null ? 0L : _ActiveUsers.Count;



public StatisticsSnapshotAgent(FbConnection connection, StatisticsSnapshotAgent statisticsSnapShotBase = null)
{
_InternalConnection = connection;
_StatisticsSnapShotBase = statisticsSnapShotBase;
}

public void Load(QueryManager qryMgr, long rowCount, long recordsAffected, DateTime executionEndTime)
{
_SelectRowCount = rowCount;
_IduRowCount = recordsAffected;



try
{
FbDatabaseInfo info = new(_InternalConnection);

// QueryProfileStatistics
_IduRowCount = recordsAffected;
_InsRowCount = info.GetInsertCount();
_UpdRowCount = info.GetUpdateCount();
_DelRowCount = info.GetDeleteCount();
_SelectRowCount = rowCount;
_Transactions = info.GetActiveTransactionsCount();

// NetworkStatistics
Expand All @@ -121,10 +114,10 @@ public void Load(QueryManager qryMgr, long rowCount, long recordsAffected, DateT
_ReadCount = info.GetReads() - (_StatisticsSnapShotBase != null ? _StatisticsSnapShotBase._ReadCount : 0);
_WriteCount = info.GetWrites() - (_StatisticsSnapShotBase != null ? _StatisticsSnapShotBase._WriteCount : 0);

// _ReadIdxCount = info.GetReadIdxCount() - (_StatisticsSnapShotBase != null ? _StatisticsSnapShotBase._ReadIdxCount : 0);
// _ReadSeqCount = info.GetReadSeqCount() - (_StatisticsSnapShotBase != null ? _StatisticsSnapShotBase._ReadSeqCount : 0);
_ReadIdxCount = 0 - (_StatisticsSnapShotBase != null ? _StatisticsSnapShotBase._ReadIdxCount : 0);
_ReadSeqCount = 0 - (_StatisticsSnapShotBase != null ? _StatisticsSnapShotBase._ReadSeqCount : 0);
_ReadIdxCount = info.GetReadIdxCount() - (_StatisticsSnapShotBase != null ? _StatisticsSnapShotBase._ReadIdxCount : 0);
_ReadSeqCount = info.GetReadSeqCount() - (_StatisticsSnapShotBase != null ? _StatisticsSnapShotBase._ReadSeqCount : 0);
// _ReadIdxCount = 0 - (_StatisticsSnapShotBase != null ? _StatisticsSnapShotBase._ReadIdxCount : 0);
// _ReadSeqCount = 0 - (_StatisticsSnapShotBase != null ? _StatisticsSnapShotBase._ReadSeqCount : 0);

_PurgeCount = info.GetPurgeCount() - (_StatisticsSnapShotBase != null ? _StatisticsSnapShotBase._PurgeCount : 0);
_ExpungeCount = info.GetExpungeCount() - (_StatisticsSnapShotBase != null ? _StatisticsSnapShotBase._ExpungeCount : 0);
Expand Down
49 changes: 39 additions & 10 deletions BlackbirdSql.Common/Ctl/DesignerExplorerServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,23 +317,52 @@ public void ViewCode(IVsDataExplorerNode node, EnModelTargetType targetType)
// Currently our only entry point to AbstractDesignerServices whose warnings are suppressed.
Diag.ThrowIfNotOnUIThread();

MonikerAgent moniker = new(node, targetType);

IList<string> identifierList = moniker.Identifier.ToArray();
EnModelObjectType objectType = moniker.ObjectType;
Guid clsidEditorFactory = new Guid(SystemData.DslEditorFactoryGuid);
// Tracer.Trace(GetType(), "ViewCode()");

MonikerAgent moniker = null;
IList<string> identifierList = null;
EnModelObjectType objectType = EnModelObjectType.Unknown;
Action<DatabaseLocation, bool> callback = null;

if ((objectType == EnModelObjectType.Table || objectType == EnModelObjectType.View)
&& targetType == EnModelTargetType.QueryScript && PersistentSettings.EditorExecuteQueryOnOpen)
Guid clsidEditorFactory = new Guid(SystemData.DslEditorFactoryGuid);

try
{
// Tracer.Trace(GetType(), "ViewCode()", "assigning OnSqlQueryLoaded.");
callback = OnSqlQueryLoaded;
moniker = new(node, targetType);
}
catch (Exception ex)
{
Diag.Dug(ex);
throw;
}


OpenExplorerEditor(node, objectType, identifierList, targetType, clsidEditorFactory, callback, null);
try
{
identifierList = moniker.Identifier.ToArray();
objectType = moniker.ObjectType;

if ((objectType == EnModelObjectType.Table || objectType == EnModelObjectType.View)
&& targetType == EnModelTargetType.QueryScript && PersistentSettings.EditorExecuteQueryOnOpen)
{
callback = OnSqlQueryLoaded;
}
}
catch (Exception ex)
{
Diag.Dug(ex);
throw;
}

try
{
OpenExplorerEditor(node, objectType, identifierList, targetType, clsidEditorFactory, callback, null);
}
catch (Exception ex)
{
Diag.Dug(ex);
throw;
}
}


Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion BlackbirdSql.Common/Properties/AttributeResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@
<value>Rows returned by SELECT statements</value>
</data>
<data name="StatisticsPanelStatServerRoundtrips" xml:space="preserve">
<value>Number of server roundtrips</value>
<value>Number of server fetches</value>
</data>
<data name="StatisticsPanelStatTransactions" xml:space="preserve">
<value>Number of transactions </value>
Expand Down
3 changes: 1 addition & 2 deletions BlackbirdSql.Core/BlackbirdSql.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
<Compile Include="Ctl\Diagnostics\IBEnumerableDescribers.cs" />
<Compile Include="Ctl\Interfaces\IBDataConnectionProperties.cs" />
<Compile Include="Model\AbstractRunningConnectionTable.cs" />
<Compile Include="Ctl\Interfaces\IBDataViewSupport.cs" />
<Compile Include="Ctl\Interfaces\IBAutomationConverter.cs" />
<Compile Include="Ctl\Extensions\Index.cs" />
<Compile Include="Ctl\Extensions\Range.cs" />
Expand Down Expand Up @@ -222,7 +221,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="10.0.0" />
<PackageReference Include="FirebirdSql.Data.FirebirdClient" Version="10.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Data" Version="17.5.33428.388" />
</ItemGroup>

Expand Down
3 changes: 3 additions & 0 deletions BlackbirdSql.Core/Ctl/AbstractAsyncPackage.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Management.Instrumentation;
using System.Threading;
using System.Threading.Tasks;
using BlackbirdSql.Core.Ctl.Interfaces;
Expand Down Expand Up @@ -137,6 +138,8 @@ public virtual IVsSolution VsSolution

public abstract bool InvariantResolved { get; }

public abstract Type SchemaFactoryType { get; }


public Microsoft.VisualStudio.OLE.Interop.IServiceProvider OleServiceProvider
{
Expand Down
Loading

0 comments on commit 8f99350

Please sign in to comment.