HHH-16611 Switch NameQualifierSupport for Sybase to BOTH

This commit is contained in:
Christian Beikov 2023-08-07 15:54:44 +02:00
parent feb3b3fc36
commit 67c52f87bc
7 changed files with 50 additions and 20 deletions

17
Jenkinsfile vendored
View File

@ -59,6 +59,9 @@ stage('Configure') {
if ( pullRequest.labels.contains( 'hana' ) ) {
this.environments.add( new BuildEnvironment( dbName: 'hana_cloud', dbLockableResource: 'hana-cloud', dbLockResourceAsHost: true ) )
}
if ( pullRequest.labels.contains( 'sybase' ) ) {
this.environments.add( new BuildEnvironment( dbName: 'sybase_jconn' ) )
}
}
helper.configure {
@ -235,6 +238,13 @@ stage('Build') {
sh "./docker_db.sh sybase"
state[buildEnv.tag]['containerName'] = "sybase"
break;
case "sybase_jconn":
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
docker.image('nguoianphu/docker-sybase').pull()
}
sh "./docker_db.sh sybase"
state[buildEnv.tag]['containerName'] = "sybase"
break;
case "cockroachdb":
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
docker.image('cockroachdb/cockroach:v22.2.2').pull()
@ -256,8 +266,11 @@ stage('Build') {
withEnv(["RDBMS=${buildEnv.dbName}"]) {
try {
if (buildEnv.dbLockableResource == null) {
timeout( [time: buildEnv.longRunning ? 480 : 120, unit: 'MINUTES'] ) {
sh cmd
withCredentials([file(credentialsId: 'sybase-jconnect-driver', variable: 'jconnect_driver')]) {
sh 'cp $jconnect_driver ./drivers/jconn4.jar'
timeout( [time: buildEnv.longRunning ? 480 : 120, unit: 'MINUTES'] ) {
sh cmd
}
}
}
else {

View File

@ -32,6 +32,8 @@ elif [ "$RDBMS" == "mssql" ] || [ "$RDBMS" == "mssql_2017" ]; then
goal="-Pdb=mssql_ci"
elif [ "$RDBMS" == "sybase" ]; then
goal="-Pdb=sybase_ci"
elif [ "$RDBMS" == "sybase_jconn" ]; then
goal="-Pdb=sybase_jconn_ci"
elif [ "$RDBMS" == "tidb" ]; then
goal="-Pdb=tidb"
elif [ "$RDBMS" == "hana_cloud" ]; then

View File

@ -88,7 +88,7 @@ ext {
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
// Disable prepared statement caching to avoid issues with changing schemas
'jdbc.url' : 'jdbc:sybase:Tds:' + dbHost + ':5000/hibernate_orm_test',
'jdbc.url' : 'jdbc:sybase:Tds:' + dbHost + ':9000/hibernate_orm_test',
'connection.init_sql' : 'set ansinull on set quoted_identifier on'
],
mysql : [

View File

@ -309,7 +309,7 @@ public class SybaseDialect extends AbstractTransactSQLDialect {
@Override
public String getCurrentSchemaCommand() {
return "select db_name()";
return "select user_name()";
}
@Override
@ -477,9 +477,7 @@ public class SybaseDialect extends AbstractTransactSQLDialect {
@Override
public NameQualifierSupport getNameQualifierSupport() {
// No support for schemas: https://userapps.support.sap.com/sap/support/knowledge/en/2591730
// Authorization schemas seem to be something different: https://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36272.1550/html/commands/X48762.htm
return NameQualifierSupport.CATALOG;
return NameQualifierSupport.BOTH;
}
@Override

View File

@ -435,6 +435,9 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
catch (SQLException ignore) {
LOG.sqlWarning( ignore.getErrorCode(), ignore.getSQLState() );
}
catch (AbstractMethodError ignore) {
// jConnect and jTDS report that they "support" schemas, but they don't really
}
}
return currentSchema;
}
@ -498,6 +501,9 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
catch (SQLException ignore) {
LOG.sqlWarning( ignore.getErrorCode(), ignore.getSQLState() );
}
catch (AbstractMethodError ignore) {
// jConnect and jTDS report that they "support" schemas, but they don't really
}
}
return currentSchemaFilter;
}
@ -523,7 +529,7 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
catalogFilter = toMetaDataObjectName( extractionContext.getDefaultCatalog() );
}
else {
catalogFilter = "";
catalogFilter = null;
}
}
}
@ -548,7 +554,7 @@ public abstract class AbstractInformationExtractorImpl implements InformationExt
schemaFilter = toMetaDataObjectName( extractionContext.getDefaultSchema() );
}
else {
schemaFilter = "";
schemaFilter = null;
}
}
}

View File

@ -6,13 +6,10 @@
*/
package org.hibernate.orm.test.schemamanager;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.ManyToOne;
import org.hibernate.dialect.OracleDialect;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.tool.schema.spi.SchemaManagementException;
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
@ -20,11 +17,14 @@ import org.hibernate.testing.orm.junit.ServiceRegistry;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.hibernate.testing.orm.junit.Setting;
import org.hibernate.testing.orm.junit.SkipForDialect;
import org.hibernate.tool.schema.spi.SchemaManagementException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.ManyToOne;
import static org.hibernate.cfg.AvailableSettings.DEFAULT_SCHEMA;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@ -36,8 +36,8 @@ import static org.junit.jupiter.api.Assertions.fail;
@DomainModel(annotatedClasses = {SchemaManagerExplicitSchemaTest.Book.class, SchemaManagerExplicitSchemaTest.Author.class})
@SessionFactory(exportSchema = false)
@ServiceRegistry(settings = @Setting(name = DEFAULT_SCHEMA, value = "schema_manager_test"))
@SkipForDialect(dialectClass = OracleDialect.class, reason = "Oracle tests run in the DBO schema")
@RequiresDialectFeature(feature= DialectFeatureChecks.SupportsTruncateTable.class)
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsTruncateTable.class)
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportSchemaCreation.class)
public class SchemaManagerExplicitSchemaTest {
@BeforeEach

View File

@ -38,6 +38,7 @@ stage('Configure') {
new BuildEnvironment( dbName: 'db2_10_5', longRunning: true ),
new BuildEnvironment( dbName: 'mssql_2017' ), // Unfortunately there is no SQL Server 2008 image, so we have to test with 2017
// new BuildEnvironment( dbName: 'sybase_16' ), // There only is a Sybase ASE 16 image, so no pint in testing that nightly
new BuildEnvironment( dbName: 'sybase_jconn' ),
// Long running databases
new BuildEnvironment( dbName: 'cockroachdb', node: 'cockroachdb', longRunning: true ),
new BuildEnvironment( dbName: 'cockroachdb_22_1', node: 'cockroachdb', longRunning: true ),
@ -220,6 +221,13 @@ stage('Build') {
sh "./docker_db.sh sybase"
state[buildEnv.tag]['containerName'] = "sybase"
break;
case "sybase_jconn":
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
docker.image('nguoianphu/docker-sybase').pull()
}
sh "./docker_db.sh sybase"
state[buildEnv.tag]['containerName'] = "sybase"
break;
case "cockroachdb":
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
docker.image('cockroachdb/cockroach:v22.2.2').pull()
@ -248,8 +256,11 @@ stage('Build') {
withEnv(["RDBMS=${buildEnv.dbName}"]) {
try {
if (buildEnv.dbLockableResource == null) {
timeout( [time: buildEnv.longRunning ? 480 : 120, unit: 'MINUTES'] ) {
sh cmd
withCredentials([file(credentialsId: 'sybase-jconnect-driver', variable: 'jconnect_driver')]) {
sh 'cp $jconnect_driver ./drivers/jconn4.jar'
timeout( [time: buildEnv.longRunning ? 480 : 120, unit: 'MINUTES'] ) {
sh cmd
}
}
}
else {