HHH-14835 : Fix Sybase Connection#getSchema() throws an exception
(cherry picked from commit aaba4767fe
)
This commit is contained in:
parent
dec331362c
commit
8cecdd3f43
|
@ -6,8 +6,14 @@
|
|||
*/
|
||||
package org.hibernate.dialect;
|
||||
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
|
||||
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.type.descriptor.sql.BlobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.ClobTypeDescriptor;
|
||||
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
||||
|
@ -48,4 +54,21 @@ public class SybaseDialect extends AbstractTransactSQLDialect {
|
|||
public String getCurrentSchemaCommand() {
|
||||
return "select db_name()";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData)
|
||||
throws SQLException {
|
||||
if ( dbMetaData == null ) {
|
||||
builder.setUnquotedCaseStrategy( IdentifierCaseStrategy.MIXED );
|
||||
builder.setQuotedCaseStrategy( IdentifierCaseStrategy.MIXED );
|
||||
}
|
||||
|
||||
return super.buildIdentifierHelper( builder, dbMetaData );
|
||||
}
|
||||
|
||||
@Override
|
||||
public NameQualifierSupport getNameQualifierSupport() {
|
||||
return NameQualifierSupport.CATALOG;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -407,6 +407,9 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
|
|||
}
|
||||
|
||||
private Identifier getCurrentSchema(JdbcEnvironment jdbcEnvironment) {
|
||||
if ( jdbcEnvironment.getNameQualifierSupport() == NameQualifierSupport.CATALOG ) {
|
||||
return null;
|
||||
}
|
||||
if ( currentSchema != null ) {
|
||||
return currentSchema;
|
||||
}
|
||||
|
@ -428,6 +431,9 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
|
|||
}
|
||||
|
||||
private Identifier getCurrentCatalog(JdbcEnvironment jdbcEnvironment) {
|
||||
if ( jdbcEnvironment.getNameQualifierSupport() == NameQualifierSupport.SCHEMA ) {
|
||||
return null;
|
||||
}
|
||||
if ( currentCatalog != null ) {
|
||||
return currentCatalog;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue