@@ -316,7 +316,7 @@ public void FinishQuerying()
316
316
// In order to handle this case, we issue a dummy query that will consume the pending cancellation.
317
317
// See https://bugs.mysql.com/bug.php?id=45679
318
318
Log . Debug ( "Session{0} sending 'SLEEP(0)' command to clear pending cancellation" , m_logArguments ) ;
319
- var payload = QueryPayload . Create ( SupportsQueryAttributes , "SELECT SLEEP(0) INTO @ \uE001 MySqlConnector \uE001 Sleep;" ) ;
319
+ var payload = SupportsQueryAttributes ? s_sleepWithAttributesPayload : s_sleepNoAttributesPayload ;
320
320
#pragma warning disable CA2012 // Safe because method completes synchronously
321
321
SendAsync ( payload , IOBehavior . Synchronous , CancellationToken . None ) . GetAwaiter ( ) . GetResult ( ) ;
322
322
payload = ReceiveReplyAsync ( IOBehavior . Synchronous , CancellationToken . None ) . GetAwaiter ( ) . GetResult ( ) ;
@@ -1637,7 +1637,8 @@ private async Task GetRealServerDetailsAsync(IOBehavior ioBehavior, Cancellation
1637
1637
Log . Debug ( "Session{0} detected proxy; getting CONNECTION_ID(), VERSION() from server" , m_logArguments ) ;
1638
1638
try
1639
1639
{
1640
- await SendAsync ( QueryPayload . Create ( SupportsQueryAttributes , "SELECT CONNECTION_ID(), VERSION();" ) , ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
1640
+ var payload = SupportsQueryAttributes ? s_selectConnectionIdVersionWithAttributesPayload : s_selectConnectionIdVersionNoAttributesPayload ;
1641
+ await SendAsync ( payload , ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
1641
1642
1642
1643
// column count: 2
1643
1644
await ReceiveReplyAsync ( ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
@@ -1646,7 +1647,6 @@ private async Task GetRealServerDetailsAsync(IOBehavior ioBehavior, Cancellation
1646
1647
await ReceiveReplyAsync ( ioBehavior , CancellationToken . None ) . ConfigureAwait ( false ) ;
1647
1648
await ReceiveReplyAsync ( ioBehavior , CancellationToken . None ) . ConfigureAwait ( false ) ;
1648
1649
1649
- PayloadData payload ;
1650
1650
if ( ! SupportsDeprecateEof )
1651
1651
{
1652
1652
payload = await ReceiveReplyAsync ( ioBehavior , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -1916,6 +1916,10 @@ protected override void OnStatementBegin(int index)
1916
1916
static readonly PayloadData s_setNamesUtf8mb4NoAttributesPayload = QueryPayload . Create ( false , "SET NAMES utf8mb4;" ) ;
1917
1917
static readonly PayloadData s_setNamesUtf8WithAttributesPayload = QueryPayload . Create ( true , "SET NAMES utf8;" ) ;
1918
1918
static readonly PayloadData s_setNamesUtf8mb4WithAttributesPayload = QueryPayload . Create ( true , "SET NAMES utf8mb4;" ) ;
1919
+ static readonly PayloadData s_sleepNoAttributesPayload = QueryPayload . Create ( false , "SELECT SLEEP(0) INTO @\uE001 MySqlConnector\uE001 Sleep;" ) ;
1920
+ static readonly PayloadData s_sleepWithAttributesPayload = QueryPayload . Create ( true , "SELECT SLEEP(0) INTO @\uE001 MySqlConnector\uE001 Sleep;" ) ;
1921
+ static readonly PayloadData s_selectConnectionIdVersionNoAttributesPayload = QueryPayload . Create ( false , "SELECT CONNECTION_ID(), VERSION();" ) ;
1922
+ static readonly PayloadData s_selectConnectionIdVersionWithAttributesPayload = QueryPayload . Create ( true , "SELECT CONNECTION_ID(), VERSION();" ) ;
1919
1923
static int s_lastId ;
1920
1924
1921
1925
readonly object m_lock ;
0 commit comments