Skip to content

MSSQL Schema update and validation #970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 29, 2021
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Hibernate Reactive has been tested with:
- Db2 11.5
- CockroachDB 21.1
- MS SQL Server 2019
- [Hibernate ORM][] 5.6.0.Beta2
- [Hibernate ORM][] 5.6.0.CR1
- [Vert.x Reactive PostgreSQL Client](https://vertx.io/docs/vertx-pg-client/java/) 4.1.4
- [Vert.x Reactive MySQL Client](https://vertx.io/docs/vertx-mysql-client/java/) 4.1.4
- [Vert.x Reactive Db2 Client](https://vertx.io/docs/vertx-db2-client/java/) 4.1.4
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ version = projectVersion
// ./gradlew clean build -PhibernateOrmVersion=5.5.1-SNAPSHOT
ext {
if ( !project.hasProperty('hibernateOrmVersion') ) {
hibernateOrmVersion = '5.6.0.Beta2'
hibernateOrmVersion = '5.6.0.CR1'
}
// For ORM, we need a parsed version (to get the family, ...)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ private String normalizeLabel(String columnLabel) {
return toMetaDataObjectName( Identifier.toIdentifier( columnLabel ) );
}

@Override
protected String getResultSetTableTypesPhysicalTableConstant() {
return "BASE TABLE";
}

@Override
protected <T> T processCatalogsResultSet(ExtractionContext.ResultSetProcessor<T> processor) throws SQLException {
return getExtractionContext().getQueryResults(
Expand All @@ -150,7 +155,7 @@ protected <T> T processSchemaResultSet(
final StringBuilder sb = new StringBuilder()
.append( "select catalog_name as " ).append( getResultSetCatalogLabel() )
.append( " , schema_name as " ).append( getResultSetSchemaLabel() )
.append( " from information_schema.schemata where true" );
.append( " from information_schema.schemata where 1 = 1" );
final List<Object> parameters = new ArrayList<>();
appendClauseAndParameterIfNotNullOrEmpty( " and catalog_name = ", catalog, sb, parameters );
appendClauseAndParameterIfNotNullOrEmpty( " and schema_name like ", schemaPattern, sb, parameters );
Expand Down Expand Up @@ -198,7 +203,7 @@ protected <T> T processTableResultSet(
// Remarks are not available from information_schema.
// Hibernate ORM does not currently do anything with remarks,
// so just return null for now.
.append( " from information_schema.tables where true" );
.append( " from information_schema.tables where 1 = 1" );
List<Object> parameterValues = new ArrayList<>();
appendClauseAndParameterIfNotNullOrEmpty( " and " + catalogColumn + " = ", catalog, sb, parameterValues );
appendClauseAndParameterIfNotNullOrEmpty( " and " + schemaColumn + " like ", schemaPattern, sb, parameterValues );
Expand Down Expand Up @@ -255,7 +260,7 @@ protected <T> T processColumnsResultSet(
// Hibernate's metadata for the column. ORM also considers
// the same column type name as a match, so the SQL code is
// optional. For now, just return null for the SQL type code.
.append( " from information_schema.columns where true" );
.append( " from information_schema.columns where 1 = 1" );

final List<Object> parameterValues = new ArrayList<>();
final String catalogColumn = getDatabaseCatalogColumnName(
Expand Down
Loading