[jOOQ/jOOQ#9460] Support additional Settings.interpreterDialects and add an InterpreterConnectionProvider SPI

This commit is contained in:
Lukas Eder 2019-10-31 11:47:22 +01:00
parent 3d0cc51db2
commit bebb068d27
5 changed files with 54 additions and 6 deletions

1
jOOQ/.gitignore vendored
View File

@ -1,3 +1,4 @@
/target
/jooq.iml
/recording.jfr
/derby.log

View File

@ -119,6 +119,26 @@

View File

@ -43,7 +43,6 @@ import static org.jooq.tools.StringUtils.defaultIfNull;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
import java.util.UUID;
import org.jooq.Configuration;
@ -69,12 +68,19 @@ final class DefaultInterpreterConnectionProvider implements ConnectionProvider {
try {
switch (dialect) {
case DERBY:
return DriverManager.getConnection("jdbc:derby:memory:db;create=true");
case H2:
case DEFAULT:
Properties info = new Properties();
info.put("user", "sa");
info.put("password", "");
return DriverManager.getConnection("jdbc:h2:mem:jooq-ddl-interpretation-" + UUID.randomUUID(), info);
return DriverManager.getConnection("jdbc:h2:mem:jooq-ddl-interpretation-" + UUID.randomUUID(), "sa", "");
case HSQLDB:
// The newer form jdbc:hsqldb:mem:. is not necessarily supported by the driver version yet
return DriverManager.getConnection("jdbc:hsqldb:.");
case SQLITE:
return DriverManager.getConnection("jdbc:sqlite::memory:");
default:
throw new DataAccessException("Unsupported interpretation dialect: " + dialect);

View File

@ -102,7 +102,10 @@ final class SourceMetaProvider implements MetaProvider {
case DEFAULT:
return new DDLInterpreterMetaProvider(configuration, sources).provide();
case DERBY:
case H2:
case HSQLDB:
case SQLITE:
return new DDLMetaProvider(configuration, sources).provide();
default:

20
pom.xml
View File

@ -26,8 +26,11 @@
<properties>
<!-- H2 is used by jOOQ-meta-extensions and a variety of integration tests -->
<!-- These in-memory DBs are used by jOOQ-meta-extensions and a variety of integration tests -->
<h2.version>1.4.200</h2.version>
<sqlite.version>3.25.2</sqlite.version>
<derby.version>10.14.2.0</derby.version>
<hsqldb.version>2.4.0</hsqldb.version>
<!-- From JDK 11 onwards, we need to depend on the JAXB API explicitly -->
<jaxb.version>2.3.1</jaxb.version>
@ -217,6 +220,21 @@
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>${sqlite.version}</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>${derby.version}</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>${hsqldb.version}</version>
</dependency>
<!-- jooq-meta-extensions and integration tests have this dependency -->
<dependency>