You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by GitBox <gi...@apache.org> on 2019/09/02 20:41:43 UTC

[GitHub] [metamodel] kaspersorensen commented on a change in pull request #227: MM-1219 Returning schemas SQL Server

kaspersorensen commented on a change in pull request #227: MM-1219 Returning schemas SQL Server
URL: https://github.com/apache/metamodel/pull/227#discussion_r320043859
 
 

 ##########
 File path: jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java
 ##########
 @@ -778,18 +780,33 @@ private String findDefaultSchema(final String defaultName, final List<String> sc
      * @throws SQLException
      */
     private Set<String> getSchemaSQLServerNames(DatabaseMetaData metaData) throws SQLException {
-        // Distinct schema names. metaData.getTables() is a denormalized
-        // resultset
-        Set<String> schemas = new HashSet<>();
-        ResultSet rs = null;
+        // Distinct schema names. metaData.getTables() is a denormalized resultset
+        final Set<String> schemas = new HashSet<>();
+        ResultSet resultSet = null;
+
+        // Find DBO schema if present
         try {
-            rs = metaData.getTables(_catalogName, null, null, JdbcUtils.getTableTypesAsStrings(_tableTypes));
-            while (rs.next()) {
-                schemas.add(rs.getString("TABLE_SCHEM"));
+            resultSet = metaData.getSchemas();
+            while (resultSet.next()) {
+                if (resultSet.getString("TABLE_SCHEM").equals(DEFAULT_SCHEMA_NAME_SQLSERVER)) {
+                    schemas.add(DEFAULT_SCHEMA_NAME_SQLSERVER);
+					break;
 
 Review comment:
   Weird indentation here

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services