HHH-14744 : Refactor contextual information for SchemaManagementTool to be more easily extended by Hibernate Reactive

1. Add CockroachDB192Dialect#getNameQualifierSupport and #buildIdentifierHelper.
2. Change semantics for AbstractInformationExtractorImpl#processIndexInfoResultSet
   to be more friendly to subclasses.
This commit is contained in:
Gail Badner 2021-08-16 18:18:01 -07:00 committed by Sanne Grinovero
parent f4f4d49da0
commit a70b994526
2 changed files with 28 additions and 10 deletions

View File

@ -28,6 +28,10 @@ import org.hibernate.dialect.identity.IdentityColumnSupport;
import org.hibernate.dialect.pagination.AbstractLimitHandler; import org.hibernate.dialect.pagination.AbstractLimitHandler;
import org.hibernate.dialect.pagination.LimitHandler; import org.hibernate.dialect.pagination.LimitHandler;
import org.hibernate.dialect.pagination.LimitHelper; import org.hibernate.dialect.pagination.LimitHelper;
import org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy;
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
import org.hibernate.engine.jdbc.env.spi.IdentifierHelperBuilder;
import org.hibernate.engine.jdbc.env.spi.NameQualifierSupport;
import org.hibernate.engine.spi.RowSelection; import org.hibernate.engine.spi.RowSelection;
import org.hibernate.exception.LockAcquisitionException; import org.hibernate.exception.LockAcquisitionException;
import org.hibernate.exception.spi.SQLExceptionConversionDelegate; import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
@ -658,4 +662,23 @@ public class CockroachDB192Dialect extends Dialect {
public boolean canCreateSchema() { public boolean canCreateSchema() {
return false; return false;
} }
@Override
public NameQualifierSupport getNameQualifierSupport() {
// This method is overridden so the correct value will be returned when
// DatabaseMetaData is not available.
return NameQualifierSupport.SCHEMA;
}
@Override
public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData)
throws SQLException {
if ( dbMetaData == null ) {
builder.setUnquotedCaseStrategy( IdentifierCaseStrategy.LOWER );
builder.setQuotedCaseStrategy( IdentifierCaseStrategy.MIXED );
}
return super.buildIdentifierHelper( builder, dbMetaData );
}
} }

View File

@ -1029,18 +1029,13 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
* in conjunction with a table's index descriptions * in conjunction with a table's index descriptions
* </li> * </li>
* <li> * <li>
* {@link DatabaseMetaData#tableIndexClustered} - * Any value other than {@link DatabaseMetaData#tableIndexStatistic} -
* this is a clustered index * this indicates that a table's index description
* </li> * (not statisics) is being returned.
* <li>
* {@link DatabaseMetaData#tableIndexHashed} -
* this is a hashed index
* </li>
* <li>
* {@link DatabaseMetaData#tableIndexOther} -
* this is some other style of index
* </li> * </li>
* </ul> * </ul>
* NOTE: Hibernate ignores statistics and does not
* care about the actual type of index.
* </li> * </li>
* <li> * <li>
* column label {@link #getResultSetColumnNameLabel} - * column label {@link #getResultSetColumnNameLabel} -