Permalink
Browse files

Fix problems introduced by commit aa760d4 - Overriding the catalog wi…

…th the schema will break a MS SQL server database which uses schemas
  • Loading branch information...
1 parent 273f6c5 commit 72e5dc2ba8c2fe2a91352ef35e48664cbe5214f7 @jcosmo jcosmo committed with unknown May 31, 2010
View
9 src/java/jdbc_adapter/MssqlRubyJdbcConnection.java
@@ -79,4 +79,13 @@ protected IRubyObject jdbcToRuby(Ruby runtime, int column, int type, ResultSet r
}
return super.jdbcToRuby(runtime, column, type, resultSet);
}
+
+ /**
+ * SqlServer supports schemas so lets not go using the schema name as the catalog name
+ */
+ @Override
+ protected boolean databaseSupportsSchemas()
+ {
+ return true;
+ }
}
View
8 src/java/jdbc_adapter/RubyJdbcConnection.java
@@ -136,7 +136,8 @@ public Object call(Connection c) throws SQLException {
table_name = caseConvertIdentifierForJdbc(metadata, table_name);
String catalog = c.getCatalog();
- if (schemaName != null) { catalog = schemaName; }
+
+ if (schemaName != null && !databaseSupportsSchemas()) { catalog = schemaName; }
String[] tableTypes = new String[]{"TABLE","VIEW","SYNONYM"};
RubyArray matchingTables = (RubyArray) tableLookupBlock(context.getRuntime(),
@@ -1173,4 +1174,9 @@ public ColumnData(IRubyObject name, int type) {
return columns;
}
}
+
+ protected boolean databaseSupportsSchemas()
+ {
+ return false;
+ }
}

0 comments on commit 72e5dc2

Please sign in to comment.