HHH-15009 Allow augmenting supported physical table types through dialect for H2 2.0.202+ support
This commit is contained in:
parent
fe44411e60
commit
6feb33f4e1
|
@ -3487,6 +3487,10 @@ public abstract class Dialect implements ConversionContext {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void augmentPhysicalTableTypes(List<String> tableTypesList) {
|
||||||
|
// nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
public void augmentRecognizedTableTypes(List<String> tableTypesList) {
|
public void augmentRecognizedTableTypes(List<String> tableTypesList) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,7 @@ public class H2Dialect extends Dialect {
|
||||||
|
|
||||||
public boolean hasOddDstBehavior() {
|
public boolean hasOddDstBehavior() {
|
||||||
// H2 1.4.200 has a bug: https://github.com/h2database/h2database/issues/3184
|
// H2 1.4.200 has a bug: https://github.com/h2database/h2database/issues/3184
|
||||||
return getVersion().isSame( 1, 4, 200 );
|
return getVersion().isSameOrAfter( 1, 4, 200 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -271,6 +271,13 @@ public class H2Dialect extends Dialect {
|
||||||
CommonFunctionFactory.rownum( queryEngine );
|
CommonFunctionFactory.rownum( queryEngine );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void augmentPhysicalTableTypes(List<String> tableTypesList) {
|
||||||
|
if ( getVersion().isSameOrAfter( 2 ) ) {
|
||||||
|
tableTypesList.add( "BASE TABLE" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxVarcharLength() {
|
public int getMaxVarcharLength() {
|
||||||
return 1_048_576;
|
return 1_048_576;
|
||||||
|
|
|
@ -84,13 +84,19 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
|
||||||
""
|
""
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
final List<String> physicalTableTypesList = new ArrayList<>();
|
||||||
if ( ! StringHelper.isBlank( extraPhysicalTableTypesConfig ) ) {
|
if ( ! StringHelper.isBlank( extraPhysicalTableTypesConfig ) ) {
|
||||||
this.extraPhysicalTableTypes = StringHelper.splitTrimmingTokens(
|
Collections.addAll(
|
||||||
|
physicalTableTypesList,
|
||||||
|
StringHelper.splitTrimmingTokens(
|
||||||
",;",
|
",;",
|
||||||
extraPhysicalTableTypesConfig,
|
extraPhysicalTableTypesConfig,
|
||||||
false
|
false
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
extractionContext.getJdbcEnvironment().getDialect().augmentPhysicalTableTypes( physicalTableTypesList );
|
||||||
|
this.extraPhysicalTableTypes = physicalTableTypesList.toArray( new String[0] );
|
||||||
|
|
||||||
final List<String> tableTypesList = new ArrayList<>();
|
final List<String> tableTypesList = new ArrayList<>();
|
||||||
tableTypesList.add( "TABLE" );
|
tableTypesList.add( "TABLE" );
|
||||||
|
@ -98,9 +104,7 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
|
||||||
if ( ConfigurationHelper.getBoolean( AvailableSettings.ENABLE_SYNONYMS, configService.getSettings(), false ) ) {
|
if ( ConfigurationHelper.getBoolean( AvailableSettings.ENABLE_SYNONYMS, configService.getSettings(), false ) ) {
|
||||||
tableTypesList.add( "SYNONYM" );
|
tableTypesList.add( "SYNONYM" );
|
||||||
}
|
}
|
||||||
if ( extraPhysicalTableTypes != null ) {
|
|
||||||
Collections.addAll( tableTypesList, extraPhysicalTableTypes );
|
Collections.addAll( tableTypesList, extraPhysicalTableTypes );
|
||||||
}
|
|
||||||
extractionContext.getJdbcEnvironment().getDialect().augmentRecognizedTableTypes( tableTypesList );
|
extractionContext.getJdbcEnvironment().getDialect().augmentRecognizedTableTypes( tableTypesList );
|
||||||
|
|
||||||
this.tableTypes = tableTypesList.toArray( new String[0] );
|
this.tableTypes = tableTypesList.toArray( new String[0] );
|
||||||
|
@ -1125,7 +1129,7 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
|
||||||
true, // DO require up-to-date results
|
true, // DO require up-to-date results
|
||||||
resultSet -> {
|
resultSet -> {
|
||||||
while ( resultSet.next() ) {
|
while ( resultSet.next() ) {
|
||||||
if ( resultSet.getShort(getResultSetIndexTypeLabel() ) == DatabaseMetaData.tableIndexStatistic ) {
|
if ( resultSet.getShort( getResultSetIndexTypeLabel() ) == DatabaseMetaData.tableIndexStatistic ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue