HHH-16578 - Minor change to the column information extraction

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2023-05-18 18:04:30 +02:00 committed by Christian Beikov
parent 9dad4c44bb
commit be9692765c
3 changed files with 4 additions and 4 deletions

View File

@ -675,7 +675,7 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
tableInformation,
DatabaseIdentifier.toIdentifier( resultSet.getString( getResultSetColumnNameLabel() ) ),
resultSet.getInt( getResultSetSqlTypeCodeLabel() ),
new StringTokenizer( resultSet.getString( getResultSetTypeNameLabel() ), "() " ).nextToken(),
new StringTokenizer( resultSet.getString( getResultSetTypeNameLabel() ), "()" ).nextToken(),
resultSet.getInt( getResultSetColumnSizeLabel() ),
resultSet.getInt( getResultSetDecimalDigitsLabel() ),
interpretTruthValue( resultSet.getString( getResultSetIsNullableLabel() ) )

View File

@ -136,7 +136,7 @@ public class InformationExtractorJdbcDatabaseMetaDataImpl extends AbstractInform
protected void addColumns(TableInformation tableInformation) {
final ExtractionContext extractionContext = getExtractionContext();
// We use this dummy query to retrieve the table information through the ResultSetMetaData
// This is significantly better than to use the DatabaseMetaData especially on Oracle with synonyms enable
// This is significantly better than to use the DatabaseMetaData especially on Oracle with synonyms enabled
final String tableName = extractionContext.getSqlStringGenerationContext().format(
// The name comes from the database, so the case is correct
// But we quote here to avoid issues with reserved words
@ -157,7 +157,7 @@ public class InformationExtractorJdbcDatabaseMetaDataImpl extends AbstractInform
tableInformation,
DatabaseIdentifier.toIdentifier( columnName ),
metaData.getColumnType( i ),
new StringTokenizer( metaData.getColumnTypeName( i ), "() " ).nextToken(),
new StringTokenizer( metaData.getColumnTypeName( i ), "()" ).nextToken(),
metaData.getPrecision( i ),
metaData.getScale( i ),
interpretNullable( metaData.isNullable( i ) )

View File

@ -255,7 +255,7 @@ public class IndividuallySchemaValidatorImplTest extends BaseUnitTestCase {
if ( metadata.getDatabase().getDialect().getVersion().isSameOrAfter( 2 ) ) {
// Reports "character varying" since 2.0
assertEquals(
"Schema-validation: wrong column type encountered in column [name] in table [SomeSchema.ColumnEntity]; found [character (Types#VARCHAR)], but expecting [integer (Types#INTEGER)]",
"Schema-validation: wrong column type encountered in column [name] in table [SomeSchema.ColumnEntity]; found [character varying (Types#VARCHAR)], but expecting [integer (Types#INTEGER)]",
e.getMessage()
);
}