EvidentSolutions / dalesbred

Dalesbred - a database access library for Java
https://dalesbred.org
MIT License
54 stars 15 forks source link

MariaDB Dialect Request #55

Closed Conrad-T-Pino closed 3 months ago

Conrad-T-Pino commented 3 months ago
Table below excerpted from About MariaDB Connector/J § Infrequently Used Parameters Parameter Description
useMysqlMetadata databaseMetaData.getDatabaseProductName() return "MariaDB" or "MySQL" according to server type (since 2.4.0). This option permit to force returning "MySQL" even if server is MariaDB to permit compatibility with frameworks that doesn't support MariaDB.
Default: false. Since 2.4.1

The latest MariaDB stable release is version 11.4 series.

komu commented 3 months ago

It should be easy. First of all, most of the dialects do nothing special, e.g. MySQLDialect is just literally just:

https://github.com/EvidentSolutions/dalesbred/blob/c7b40ec0abea13aaf2805972f239fcd239828bc0/dalesbred/src/main/java/org/dalesbred/dialect/MySQLDialect.java#L28-L29

PostgreSQLDialect has some special code to support PostgreSQL's native enums and OracleDialect has workaround for array-handling, since Oracle's own JDBC driver does (or atleast did) not support the standard API.

So the actual dialect implementation would probably be empty just as MySQLDialect. And I should note that even without a custom implementation Dalesbred will work: it will just log a startup warning that it could not autodetect the database.

The actual detection logic is also straightforward:

https://github.com/EvidentSolutions/dalesbred/blob/4f53ff697e7a005f187668ac8a98777297e4c176/dalesbred/src/main/java/org/dalesbred/dialect/Dialect.java#L91-L127

I don't believe that other changes are required.

Conrad-T-Pino commented 3 months ago

Before first commit to Conrad-T-Pino / dalesbred branch MariaDB I thought a patch review might be useful but if that's not so, please advise what is best for the team.

patch-MariaDBDialect.txt

komu commented 3 months ago

A pull request or a link to a commit is best. With Git you can always rewrite the commit history of a branch if there are cleanups to be made so even if the first commit has problems, it can be cleaned up before merging the branch. So the history of the mainline stays clean even if code needs to be rewritten before mergins.

That said, the patch looks fine so if you'll open a PR I'll merge it.

Conrad-T-Pino commented 3 months ago