-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correction of the return values of the DatabaseInfo methods for determining the insert, read and delete operations #1183
base: master
Are you sure you want to change the base?
Conversation
…ort Firebird Server 2.0.
…per table since the last connection to the database
…per table since the last connection to the database. fixes FirebirdSQL#1157
…into DatabaseInfo
IDictionary<short, ulong> readSeqCount = dbInfo.GetReadSeqCount(); | ||
IDictionary<short, ulong> readIdxCount = dbInfo.GetReadIdxCount(); | ||
|
||
var fbCommand = new FbCommand("SELECT MAX(INT_FIELD) FROM TEST", Connection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await using
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
IDictionary<short, ulong> readSeqCount = dbInfo.GetReadSeqCount(); | ||
IDictionary<short, ulong> readIdxCount = dbInfo.GetReadIdxCount(); | ||
|
||
var fbCommand = new FbCommand("INSERT INTO TEST (INT_FIELD) VALUES (900)", Connection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await using
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
IDictionary<string, short> tableNameList = GetTableNameList(); | ||
short tableIdTest = tableNameList["TEST"]; | ||
|
||
var fbCommand = new FbCommand("INSERT INTO TEST (INT_FIELD) VALUES (900)", Connection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await using
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -51,6 +53,22 @@ public static string ToHexString(this byte[] b) | |||
return BitConverter.ToString(b).Replace("-", string.Empty); | |||
} | |||
|
|||
public static IDictionary<short, ulong> GetTableStatistic(this byte[] b, int aLength) | |||
{ | |||
int capacity = aLength > 3 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put it on single line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
case IscCodes.isc_info_update_count: | ||
case IscCodes.isc_info_read_seq_count: | ||
case IscCodes.isc_info_read_idx_count: | ||
info.Add( buffer.GetTableStatistic( length ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra spaces around (
/)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
private IDictionary<short, ulong> GetAffectedTables(IDictionary<short, ulong> aStatisticInfoBefore, IDictionary<short, ulong> aStatisticInfoAfter) | ||
{ | ||
var result = new Dictionary<short, ulong>(); | ||
foreach (KeyValuePair<short, ulong> keyValuePair in aStatisticInfoAfter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use var
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
{ | ||
if (aStatisticInfoBefore.TryGetValue(keyValuePair.Key, out ulong value)) | ||
{ | ||
ulong counter = keyValuePair.Value - value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use var
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
if (counter > 0) | ||
result.Add(keyValuePair.Key, counter); | ||
} | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add }
/{
for consistency sake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
return result; | ||
} | ||
|
||
private IDictionary<string, short> GetTableNameList() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove private
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -51,6 +53,22 @@ public static string ToHexString(this byte[] b) | |||
return BitConverter.ToString(b).Replace("-", string.Empty); | |||
} | |||
|
|||
public static IDictionary<short, ulong> GetTableStatistic(this byte[] b, int aLength) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove a
prefix on argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
These changes make it possible to analyze the performance of queries.