-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Permit skipping metadata for MariaDB (#1301)
Since MariaDB 10.6 (with https://jira.mariadb.org/browse/MDEV-19237), binary result-set skips sending metadata when they haven't changed. This avoids network data and parsing client-side. Signed-off-by: rusher <[email protected]>
- Loading branch information
Showing
14 changed files
with
282 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/MySqlConnector/Protocol/Payloads/ColumnCountPayload.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using MySqlConnector.Protocol.Serialization; | ||
|
||
namespace MySqlConnector.Protocol.Payloads; | ||
|
||
/// <summary> | ||
/// Helper class to parse Column count packet. | ||
/// https://mariadb.com/kb/en/result-set-packets/#column-count-packet | ||
/// Packet contains a columnCount, and - if capability MARIADB_CLIENT_CACHE_METADATA is set - a flag to indicate if metadata follows | ||
/// </summary> | ||
internal sealed class ColumnCountPayload | ||
{ | ||
private ColumnCountPayload(int columnCount, bool metadataFollows) | ||
{ | ||
ColumnCount = columnCount; | ||
MetadataFollows = metadataFollows; | ||
} | ||
|
||
public int ColumnCount { get; } | ||
public bool MetadataFollows { get; } | ||
|
||
public static ColumnCountPayload Create(ReadOnlySpan<byte> span, bool supportsMetaSkip) | ||
{ | ||
var reader = new ByteArrayReader(span); | ||
var columnCount = (int) reader.ReadLengthEncodedInteger(); | ||
var metadataFollows = supportsMetaSkip ? reader.ReadByte() == 1 : true; | ||
return new ColumnCountPayload(columnCount, metadataFollows); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
I didn't notice it at the time, but this change turns off flags that were previously on.
#1445 (comment)