PL-10070 Speed up getting information about tables on Oracle

This commit is contained in:
Andrey Subbotin 2018-01-11 10:01:51 +04:00
parent e9c258de8d
commit 533cc126e8
7 changed files with 9 additions and 11 deletions

View File

@ -159,8 +159,8 @@ public class DbUpdaterEngine implements DbUpdater {
connection = getDataSource().getConnection();
DatabaseMetaData dbMetaData = connection.getMetaData();
DbProperties dbProperties = new DbProperties(getConnectionUrl(connection));
boolean useUserForSchemaName = DbmsSpecificFactory.getDbmsFeatures().useUserForSchemaName();
String schemaName = useUserForSchemaName ?
boolean isSchemaByUser = DbmsSpecificFactory.getDbmsFeatures().isSchemaByUser();
String schemaName = isSchemaByUser ?
dbMetaData.getUserName() : dbProperties.getCurrentSchemaProperty();
ResultSet tables = dbMetaData.getTables(null, schemaName, null, null);
boolean found = false;

View File

@ -73,9 +73,7 @@ public interface DbmsFeatures {
boolean isNullsLastSorting();
/**
* Uses user name as schema name for Oracle database
* for correct table lookup {@link java.sql.DatabaseMetaData#getTables}.
* By default it returns all tables for all users in the Oracle database
* @return true if user name must be used when providing schema name for obtaining database metadata
*/
boolean useUserForSchemaName();
boolean isSchemaByUser();
}

View File

@ -69,7 +69,7 @@ public class HsqlDbmsFeatures implements DbmsFeatures {
}
@Override
public boolean useUserForSchemaName() {
public boolean isSchemaByUser() {
return false;
}
}

View File

@ -69,7 +69,7 @@ public class MssqlDbmsFeatures implements DbmsFeatures {
}
@Override
public boolean useUserForSchemaName() {
public boolean isSchemaByUser() {
return false;
}
}

View File

@ -68,7 +68,7 @@ public class MysqlDbmsFeatures implements DbmsFeatures {
}
@Override
public boolean useUserForSchemaName() {
public boolean isSchemaByUser() {
return false;
}
}

View File

@ -74,7 +74,7 @@ public class OracleDbmsFeatures implements DbmsFeatures {
}
@Override
public boolean useUserForSchemaName() {
public boolean isSchemaByUser() {
return true;
}
}

View File

@ -69,7 +69,7 @@ public class PostgresDbmsFeatures implements DbmsFeatures {
}
@Override
public boolean useUserForSchemaName() {
public boolean isSchemaByUser() {
return false;
}
}