Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
52102e8
Merge AsyncState class, _cachedAsyncState and CachedAsyncState
benrr101 Sep 4, 2025
e980e0f
Add partial for batch RPC mode methods
benrr101 Sep 11, 2025
9332cf6
Merge:
benrr101 Sep 11, 2025
06ec76e
Merge AddBatchCommand
benrr101 Sep 12, 2025
d47b9d2
Merge SetBatchRPCMode and SetBatchRPCModeReadyToExecute
benrr101 Sep 12, 2025
09d6cc9
Merge ClearBatchCommand (and make it private)
benrr101 Sep 12, 2025
e6b56c2
Merging _RPCList and _currentlyExecutingBatch
benrr101 Sep 12, 2025
54af4d5
Merge DebugForceAsyncWriteDelay
benrr101 Sep 12, 2025
f7b4bd9
Merge MaxRPCNameLength, s_cancelIgnoreFailure, CancelIgnoreFailureCal…
benrr101 Sep 12, 2025
f906eb1
Merge: s_diagnosticListener, _parentOperationStarted, _rpcArrayOf1, _…
benrr101 Sep 12, 2025
5473e48
Merge WriteBeginExecuteEvent and WriteEndExecuteEvent (interted if an…
benrr101 Sep 12, 2025
8aeab64
Merge CheckThrowSNIException (made private, rewritten as ?.), OnConne…
benrr101 Sep 12, 2025
28d7c31
Merge BuildParamList (combine a bunch of StringBuilder.Append into Ap…
benrr101 Sep 12, 2025
c2a3f95
Merge ParseAndQuoteIdentifier and QuoteIdentifier (using netcore vers…
benrr101 Sep 12, 2025
b871633
Merge GetRPCObject
benrr101 Sep 12, 2025
1d34c06
Merge SetUpRPCParameters
benrr101 Sep 15, 2025
32feb5a
Merge ShouldSendParameter, CountSendableParameters (inverted logic), …
benrr101 Sep 15, 2025
7700e4e
Merge GetSetOptionsString (made static, renamed to GetOptionsSetStrin…
benrr101 Sep 15, 2025
29ee4fa
Merging GetParameterForOutputValueExtraction (made static, rewrote to…
benrr101 Sep 15, 2025
a2c2953
Merge ReliablePutStateObject, PutStateObject, GetCurrentParameterColl…
benrr101 Sep 15, 2025
7b94854
Merge GetStateObject
benrr101 Sep 15, 2025
7528548
Merge ValidateCommand, ValidateAsyncCommand
benrr101 Sep 15, 2025
dac10ad
Merge CheckNotificationStateAndAutoEnlist, RegisterForConnectionClose…
benrr101 Sep 15, 2025
96132fa
Merge DeriveParameters, GetParameterDirectionFromOleDbDirection
benrr101 Sep 15, 2025
13eae89
Merge TriggerInternalEndAndRetryIfNecessary and CreateLocalCompletion…
benrr101 Sep 15, 2025
1a881c6
Merge OnStatementCompleted
benrr101 Sep 15, 2025
8f55436
Merge UnquoteProcedureName and UnquoteProcedurePart
benrr101 Sep 17, 2025
c743710
Merge ThrowIfReconnectionHasBeenCanceled (inverted, using conditional…
benrr101 Sep 17, 2025
87cfc4f
Merge WaitForAsyncResults
benrr101 Sep 17, 2025
7a079cf
Merge VerifyEndExecuteState (THE LAST ONE)
benrr101 Sep 17, 2025
0088f9d
Delete pre-merge (and now empty) SqlCommand files
benrr101 Sep 18, 2025
c7c6a77
PR comments from copilot
benrr101 Oct 31, 2025
fd6d1c2
Revert a couple changes on BuildParamList
benrr101 Oct 31, 2025
6e2188e
Found a bug in BuildParamList, rolling back a couple changes that wer…
benrr101 Nov 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1124,37 +1124,6 @@ private static int GetParameterCount(SqlParameterCollection parameters)
return parameters != null ? parameters.Count : 0;
}

// Adds quotes to each part of a SQL identifier that may be multi-part, while leaving
// the result as a single composite name.
private static string ParseAndQuoteIdentifier(string identifier, bool isUdtTypeName)
{
string[] strings = SqlParameter.ParseTypeName(identifier, isUdtTypeName);
return QuoteIdentifier(strings);
}

private static string QuoteIdentifier(ReadOnlySpan<string> strings)
{
StringBuilder bld = new StringBuilder();

// Stitching back together is a little tricky. Assume we want to build a full multi-part name
// with all parts except trimming separators for leading empty names (null or empty strings,
// but not whitespace). Separators in the middle should be added, even if the name part is
// null/empty, to maintain proper location of the parts.
for (int i = 0; i < strings.Length; i++)
{
if (0 < bld.Length)
{
bld.Append('.');
}
if (strings[i] != null && 0 != strings[i].Length)
{
ADP.AppendQuotedString(bld, "[", "]", strings[i]);
}
}

return bld.ToString();
}

// returns set option text to turn on format only and key info on and off
// When we are executing as a text command, then we never need
// to turn off the options since they command text is executed in the scope of sp_executesql.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ private void SetUpRPCParameters(_SqlRPC rpc, bool inSchema, SqlParameterCollecti
parts[1] != null // server should not be null or we don't need to remove it
)
{
parameter.TypeName = QuoteIdentifier(parts, 2, 2);
parameter.TypeName = QuoteIdentifier(parts.AsSpan(2, 2));
}
}
}
Expand Down Expand Up @@ -1135,37 +1135,6 @@ private static int GetParameterCount(SqlParameterCollection parameters)
return parameters != null ? parameters.Count : 0;
}

// Adds quotes to each part of a SQL identifier that may be multi-part, while leaving
// the result as a single composite name.
private static string ParseAndQuoteIdentifier(string identifier, bool isUdtTypeName)
{
string[] strings = SqlParameter.ParseTypeName(identifier, isUdtTypeName);
return ADP.BuildMultiPartName(strings);
}

private static string QuoteIdentifier(string[] strings, int offset, int length)
{
StringBuilder bld = new StringBuilder();

// Stitching back together is a little tricky. Assume we want to build a full multi-part name
// with all parts except trimming separators for leading empty names (null or empty strings,
// but not whitespace). Separators in the middle should be added, even if the name part is
// null/empty, to maintain proper location of the parts.
for (int i = offset; i < (offset + length); i++)
{
if (0 < bld.Length)
{
bld.Append('.');
}
if (strings[i] != null && 0 != strings[i].Length)
{
ADP.AppendQuotedString(bld, "[", "]", strings[i]);
}
}

return bld.ToString();
}

// returns set option text to turn on format only and key info on and off
// When we are executing as a text command, then we never need
// to turn off the options since they command text is executed in the scope of sp_executesql.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,39 @@ private static void OnDone(TdsParserStateObject stateObj, int index, IList<_SqlR
current.warnings = stateObj._warnings;
}

/// <summary>
/// Adds quotes to each part of a SQL identifier that may be multi-part, while leaving the
/// result as a single composite name.
/// </summary>
// @TODO: This little utility is either likely duplicated in other places, and likely belongs in some other class.
private static string ParseAndQuoteIdentifier(string identifier, bool isUdtTypeName) =>
QuoteIdentifier(SqlParameter.ParseTypeName(identifier, isUdtTypeName));

// @TODO: This little utility is either likely duplicated in other places, and likely belongs in some other class.
private static string QuoteIdentifier(ReadOnlySpan<string> strings)
{
// Stitching back together is a little tricky. Assume we want to build a full
// multipart name with all parts except trimming separators for leading empty names
// (null or empty strings, but not whitespace). Separators in the middle should be
// added, even if the name part is null/empty, to maintain proper location of the parts
StringBuilder builder = new StringBuilder();
for (int i = 0; i < strings.Length; i++)
{
if (builder.Length > 0)
{
builder.Append('.');
}

string str = strings[i];
if (!string.IsNullOrEmpty(str))
{
ADP.AppendQuotedString(builder, "[", "]", str);
}
}

return builder.ToString();
}

/// <summary>
/// Generates a parameter list string for use with sp_executesql, sp_prepare, and sp_prepexec.
/// </summary>
Expand Down