@@ -316,7 +316,7 @@ public void FinishQuerying()
316316 // In order to handle this case, we issue a dummy query that will consume the pending cancellation.
317317 // See https://bugs.mysql.com/bug.php?id=45679
318318 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 ;
320320#pragma warning disable CA2012 // Safe because method completes synchronously
321321 SendAsync ( payload , IOBehavior . Synchronous , CancellationToken . None ) . GetAwaiter ( ) . GetResult ( ) ;
322322 payload = ReceiveReplyAsync ( IOBehavior . Synchronous , CancellationToken . None ) . GetAwaiter ( ) . GetResult ( ) ;
@@ -1637,7 +1637,8 @@ private async Task GetRealServerDetailsAsync(IOBehavior ioBehavior, Cancellation
16371637 Log . Debug ( "Session{0} detected proxy; getting CONNECTION_ID(), VERSION() from server" , m_logArguments ) ;
16381638 try
16391639 {
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 ) ;
16411642
16421643 // column count: 2
16431644 await ReceiveReplyAsync ( ioBehavior , cancellationToken ) . ConfigureAwait ( false ) ;
@@ -1646,7 +1647,6 @@ private async Task GetRealServerDetailsAsync(IOBehavior ioBehavior, Cancellation
16461647 await ReceiveReplyAsync ( ioBehavior , CancellationToken . None ) . ConfigureAwait ( false ) ;
16471648 await ReceiveReplyAsync ( ioBehavior , CancellationToken . None ) . ConfigureAwait ( false ) ;
16481649
1649- PayloadData payload ;
16501650 if ( ! SupportsDeprecateEof )
16511651 {
16521652 payload = await ReceiveReplyAsync ( ioBehavior , CancellationToken . None ) . ConfigureAwait ( false ) ;
@@ -1916,6 +1916,10 @@ protected override void OnStatementBegin(int index)
19161916 static readonly PayloadData s_setNamesUtf8mb4NoAttributesPayload = QueryPayload . Create ( false , "SET NAMES utf8mb4;" ) ;
19171917 static readonly PayloadData s_setNamesUtf8WithAttributesPayload = QueryPayload . Create ( true , "SET NAMES utf8;" ) ;
19181918 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();" ) ;
19191923 static int s_lastId ;
19201924
19211925 readonly object m_lock ;
0 commit comments