Fix Sybase Connection#getSchema() throws an exception

This commit is contained in:
Andrea Boriero 2021-08-30 17:45:57 +02:00 committed by Andrea Boriero
parent c01734adca
commit aaba4767fe
2 changed files with 12 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
import org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy; import org.hibernate.engine.jdbc.env.spi.IdentifierCaseStrategy;
import org.hibernate.engine.jdbc.env.spi.IdentifierHelper; import org.hibernate.engine.jdbc.env.spi.IdentifierHelper;
import org.hibernate.engine.jdbc.env.spi.IdentifierHelperBuilder; import org.hibernate.engine.jdbc.env.spi.IdentifierHelperBuilder;
import org.hibernate.engine.jdbc.env.spi.NameQualifierSupport;
import org.hibernate.engine.spi.LoadQueryInfluencers; import org.hibernate.engine.spi.LoadQueryInfluencers;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.query.CastType; import org.hibernate.query.CastType;
@ -287,4 +288,9 @@ public class SybaseDialect extends AbstractTransactSQLDialect {
return super.buildIdentifierHelper( builder, dbMetaData ); return super.buildIdentifierHelper( builder, dbMetaData );
} }
@Override
public NameQualifierSupport getNameQualifierSupport() {
return NameQualifierSupport.CATALOG;
}
} }

View File

@ -406,6 +406,9 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
} }
private Identifier getCurrentSchema(JdbcEnvironment jdbcEnvironment) { private Identifier getCurrentSchema(JdbcEnvironment jdbcEnvironment) {
if ( jdbcEnvironment.getNameQualifierSupport() == NameQualifierSupport.CATALOG ) {
return null;
}
if ( currentSchema != null ) { if ( currentSchema != null ) {
return currentSchema; return currentSchema;
} }
@ -427,6 +430,9 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
} }
private Identifier getCurrentCatalog(JdbcEnvironment jdbcEnvironment) { private Identifier getCurrentCatalog(JdbcEnvironment jdbcEnvironment) {
if ( jdbcEnvironment.getNameQualifierSupport() == NameQualifierSupport.SCHEMA ) {
return null;
}
if ( currentCatalog != null ) { if ( currentCatalog != null ) {
return currentCatalog; return currentCatalog;
} }