DBAClientX.MySql 1.0.18

dotnet add package DBAClientX.MySql --version 1.0.18
                    
NuGet\Install-Package DBAClientX.MySql -Version 1.0.18
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DBAClientX.MySql" Version="1.0.18" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DBAClientX.MySql" Version="1.0.18" />
                    
Directory.Packages.props
<PackageReference Include="DBAClientX.MySql" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DBAClientX.MySql --version 1.0.18
                    
#r "nuget: DBAClientX.MySql, 1.0.18"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DBAClientX.MySql@1.0.18
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DBAClientX.MySql&version=1.0.18
                    
Install as a Cake Addin
#tool nuget:?package=DBAClientX.MySql&version=1.0.18
                    
Install as a Cake Tool

DbaClientX.MySql

MySQL provider for DbaClientX (MySqlConnector). Supports non-query, scalar, queries, streaming, transactions, bulk insert.

  • Target Frameworks: net8.0, net472
  • NuGet: DBAClientX.MySql

Install

dotnet add package DBAClientX.MySql

Quick examples

Execute scalar:

var my = new DBAClientX.MySql();
var count = my.ExecuteScalar(
    host: "localhost", database: "app", username: "user", password: "p@ss",
    query: "SELECT COUNT(*) FROM users WHERE is_active=1"
);

Stream stored procedure results (netstandard2.1+/net8.0):

await foreach (DataRow row in my.ExecuteStoredProcedureStreamAsync(
    host: "localhost", database: "app", username: "user", password: "p@ss",
    procedure: "get_recent_users",
    cancellationToken: ct))
{
    // consume row
}

Typed mapped query:

var rows = await my.QueryAsListAsync(
    connectionString: "Server=localhost;Database=app;User ID=user;Password=p@ss;SslMode=Required",
    query: "SELECT id, name FROM users ORDER BY id",
    map: row => new UserRow(
        Id: row.GetInt32(row.GetOrdinal("id")),
        Name: row.GetString(row.GetOrdinal("name"))),
    cancellationToken: ct);

For larger result sets, use QueryStreamAsync<T> with the same mapper shape to avoid buffering all rows.

Non-query from a full connection string:

await my.ExecuteNonQueryAsync(
    connectionString: "Server=localhost;Database=app;User ID=user;Password=p@ss;SslMode=Required",
    query: "UPDATE users SET last_seen=UTC_TIMESTAMP() WHERE id=@id",
    parameters: new Dictionary<string, object?> { ["@id"] = 1 },
    cancellationToken: ct);

Scalar from a full connection string:

var count = await my.ExecuteScalarAsync(
    connectionString: "Server=localhost;Database=app;User ID=user;Password=p@ss;SslMode=Required",
    query: "SELECT COUNT(*) FROM users",
    cancellationToken: ct);

Stored procedure from a full connection string:

var result = await my.ExecuteStoredProcedureAsync(
    connectionString: "Server=localhost;Database=app;User ID=user;Password=p@ss;SslMode=Required",
    procedure: "get_recent_users",
    parameters: new Dictionary<string, object?> { ["p_limit"] = 100 },
    cancellationToken: ct);

Estimated query plans

Capture a native SELECT/WITH plan without executing the explained statement:

using DBAClientX.QueryPlans;
using MySqlConnector;

var plan = await my.ExplainQueryPlanAsync(connectionString,
    "SELECT u.id FROM users AS u WHERE u.id=@id",
    new Dictionary<string, object?> { ["id"] = 42 },
    new Dictionary<string, MySqlDbType> { ["id"] = MySqlDbType.Int32 },
    cancellationToken: ct);

foreach (var step in plan.Steps)
    Console.WriteLine($"{step.Detail}: native name={step.Table}, rows examined={step.Estimates?.RowsRead}");

The synchronous method has the same contract. Named @name and ?name parameters use the existing MySqlConnector binding, including typed nulls. Scripts, executable comments, positional parameters and EXPLAIN/ANALYZE controls are rejected. Capture uses a separate TLS connection and read-only transaction, with pooling and automatic enlistment disabled. It preserves active client transactions, never replays native commands, and checks cancellation after cleanup before delivering a plan. Native transaction startup/disposal defaults to five seconds; rollback has its own five-second deadline and native cancellation uses two seconds. The client's CommandTimeout controls capture; when unset, the supplied connection's native command timeout applies.

MySQL and MariaDB reject EXPLAIN of writes in read-only transactions. Capture therefore supports SELECT/WITH permitted by that transaction, and does not offer a writable mode. Session NO_BACKSLASH_ESCAPES and ANSI_QUOTES are rejected before EXPLAIN because they change lexical interpretation. Native EXPLAIN may acquire metadata locks and invoke optimizer functions. A read-only transaction constrains persistent table writes, not external function effects. Use appropriate permissions for the statements being planned.

Offline import explicitly selects the native format:

var imported = MySqlQueryPlanParser.Parse(sql, explainJson,
    MySqlQueryPlanFormat.MySqlJsonV1); // Or MariaDbJson

The reader supports MySQL JSON v1 and MariaDB estimated JSON, including nested loops, materialized subqueries, unions, ordering and window groups. Other JSON versions, runtime ANALYZE counters, duplicate properties and unknown wrappers containing operators are rejected. Documents are limited to 16,777,216 characters, 128 JSON nesting levels and 4096 operators. IDs are assigned by the reader in preorder, not taken from native select_id.

Native table_name may be an alias or a synthesized name such as <derived2>; the reader preserves it without guessing the base table, schema, database or separate alias from SQL. MySQL rows_examined_per_scan and MariaDB rows populate RowsRead. OutputRows and TableRows remain unknown. MySQL rows_produced_per_join and prefix_cost describe a cumulative join prefix; they remain in Detail rather than becoming per-operator output or subtree estimates. Query-block query_cost populates SubtreeCost in native units. Scan/search labels describe access methods and cannot establish full traversal; native FullScans and QueryPlanAssert are unsupported.

.NET Framework uses System.Text.Json for native JSON parsing; .NET 8 and .NET 10 use their in-box implementation. Existing provider and plan constructors are unchanged.

See also

  • Core mapping + invoker: DBAClientX.Core
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.18 131 10/31/2026
1.0.17 110 10/23/2026
1.0.16 101 10/23/2026
1.0.15 110 10/15/2026
1.0.14 96 10/12/2026
1.0.13 107 10/12/2026
1.0.12 101 10/10/2026
1.0.11 100 10/10/2026
1.0.10 129 9/30/2026
1.0.9 109 9/21/2026
1.0.8 3,690 8/21/2026
0.16.0 122 8/20/2026
0.15.0 133 8/14/2026
0.14.0 136 8/2/2026
0.13.0 142 8/2/2026
0.12.0 131 7/12/2026
0.11.0 138 7/12/2026
0.10.0 144 6/28/2026
0.9.0 143 6/21/2026
0.8.0 137 6/20/2026
Loading failed