Skip to content

Commit

Permalink
HHH-14744 : Refactor contextual information for SchemaManagementTool …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
gbadner authored and Sanne committed Aug 25, 2021
1 parent f4f4d49 commit a70b994
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
import org.hibernate.dialect.pagination.AbstractLimitHandler;
import org.hibernate.dialect.pagination.LimitHandler;
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.exception.LockAcquisitionException;
import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
Expand Down Expand Up @@ -658,4 +662,23 @@ public boolean doesReadCommittedCauseWritersToBlockReaders() {
public boolean canCreateSchema() {
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 );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1029,18 +1029,13 @@ private PrimaryKeyInformation extractPrimaryKeyInformation(
* in conjunction with a table's index descriptions
* </li>
* <li>
* {@link DatabaseMetaData#tableIndexClustered} -
* this is a clustered index
* </li>
* <li>
* {@link DatabaseMetaData#tableIndexHashed} -
* this is a hashed index
* </li>
* <li>
* {@link DatabaseMetaData#tableIndexOther} -
* this is some other style of index
* Any value other than {@link DatabaseMetaData#tableIndexStatistic} -
* this indicates that a table's index description
* (not statisics) is being returned.
* </li>
* </ul>
* NOTE: Hibernate ignores statistics and does not
* care about the actual type of index.
* </li>
* <li>
* column label {@link #getResultSetColumnNameLabel} -
Expand Down

0 comments on commit a70b994

Please sign in to comment.