martinjw/dbschemareader

MariaDb is not supported?

Closed this issue · 4 comments

I think MariaDb is not supported. If I convert a MariaDb sql dump to a MySql dump (i.e. just remove the default value from some text fields), and use a MySql database engine instead of a MariaDb engine (swapping is possible using Docker), DatabaseSchemaReader works fine.

If I can find a fix (using MySql for MariaDB, it's a fork of MySql), I'll make a pull request instead.

Hello, you already have a test for MariaDb in DatabaseSchemaReaderTest.IntegrationTests, and it works fine:

[TestMethod, TestCategory("MariaDb")]
public void MariaDbTest()
{
    var connectionString = "Server=127.0.0.1;User ID=root;Password=Secret;Port=3308;Database=nation";
    using (var connection = new MySqlConnector.MySqlConnection(connectionString))
    {
        ProviderChecker.Check(connection);
        var dbReader = new DatabaseReader(connection);
        var schema = dbReader.ReadAll();
        Assert.IsTrue(schema.Tables.Count > 0);
    }
}

But using this constructor, it does not work:

    var connectionString = "Server=127.0.0.1;User ID=root;Password=Secret;Port=3308;Database=nation";
    var dbReader = new DatabaseReader(connectionString, "MySql.Data.MySqlClient");
    var schema = dbReader.ReadAll();
    Assert.IsTrue(schema.Tables.Count > 0);

I tried debugging step by step, but I couldn't find what's wrong in this second way.
If this can be fixed with little code then it will be great, otherwise I can refactor a little my code in the same way as the first test, it works fine.

My test code is using MySqlConnector, but your code is using Oracle's MySql.Data, which is frankly not very friendly to MariaDb. We found MySqlConnector was a good drop-in replacement for MySql.Data, and much faster. We have also use Devart's MySql provider with MariaDb.

Thank you, it works fine! I can use the "MySqlConnector" dbProvider name, I just have to add it in the app.config :

<DbProviderFactories>
     <add name="MySqlConnector"
        invariant="MySqlConnector"
        description="Async MySQL ADO.NET Connector"
        type="MySqlConnector.MySqlConnectorFactory, MySqlConnector, Culture=neutral, PublicKeyToken=d33d3e53aa5f8c92" />
</DbProviderFactories>