[jOOQ/jOOQ#17495] Add useParsingConnection property to LiquibaseDatabase and JPADatabase

This includes:

- [jOOQ/jOOQ#17496] Implement ParsingStatement::getWarnings and and ParsingStatement::clearWarnings
This commit is contained in:
Lukas Eder 2024-10-24 11:44:21 +02:00
parent b831e131be
commit fc79af2323
3 changed files with 21 additions and 10 deletions

View File

@ -50,6 +50,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.jooq.impl.DSL;
import org.jooq.meta.TableDefinition;
import org.jooq.meta.extensions.AbstractInterpretingDatabase;
import org.jooq.tools.Convert;

View File

@ -45,6 +45,9 @@ import java.util.Properties;
import java.util.UUID;
import org.jooq.DSLContext;
import org.jooq.SQLDialect;
import org.jooq.conf.ParseUnknownFunctions;
import org.jooq.conf.Settings;
import org.jooq.exception.DataAccessException;
import org.jooq.impl.DSL;
import org.jooq.meta.SchemaDefinition;
@ -90,6 +93,7 @@ public abstract class AbstractInterpretingDatabase extends H2Database {
if (connection == null) {
try {
String unqualifiedSchema = getProperties().getProperty("unqualifiedSchema", "none").toLowerCase();
publicIsDefault = "none".equals(unqualifiedSchema);
Properties info = new Properties();
@ -97,6 +101,12 @@ public abstract class AbstractInterpretingDatabase extends H2Database {
info.put("password", "");
connection = new org.h2.Driver().connect("jdbc:h2:mem:jooq-meta-extensions-" + UUID.randomUUID(), info);
if (Boolean.parseBoolean(getProperties().getProperty("useParsingConnection")))
connection = DSL
.using(connection, SQLDialect.H2, new Settings()
.withParseUnknownFunctions(ParseUnknownFunctions.IGNORE))
.parsingConnection();
export();
}
catch (Exception e) {

View File

@ -261,6 +261,16 @@ final class ParsingStatement implements CallableStatement {
return statement().getResultSetHoldability();
}
@Override
public final SQLWarning getWarnings() throws SQLException {
return statement().getWarnings();
}
@Override
public final void clearWarnings() throws SQLException {
statement().clearWarnings();
}
// -------------------------------------------------------------------------
// XXX: Static statement execution
// -------------------------------------------------------------------------
@ -1434,16 +1444,6 @@ final class ParsingStatement implements CallableStatement {
throw new SQLFeatureNotSupportedException();
}
@Override
public final SQLWarning getWarnings() throws SQLException {
throw new SQLFeatureNotSupportedException();
}
@Override
public final void clearWarnings() throws SQLException {
throw new SQLFeatureNotSupportedException();
}
@Override
public final void closeOnCompletion() throws SQLException {
throw new SQLFeatureNotSupportedException();