Skip to content

Commit

Permalink
ACTIVERECORD_JDBC-116: Fix handling of "schema_name.table_name" in My…
Browse files Browse the repository at this point in the history
…SQL (Dilshod Mukhtarov)
  • Loading branch information
nicksieger committed May 25, 2010
1 parent 1bcdfa6 commit aa760d4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/java/jdbc_adapter/RubyJdbcConnection.java
Expand Up @@ -135,15 +135,18 @@ public Object call(Connection c) throws SQLException {
if (schemaName != null) schemaName = caseConvertIdentifierForJdbc(metadata, schemaName);
table_name = caseConvertIdentifierForJdbc(metadata, table_name);

String catalog = c.getCatalog();
if (schemaName != null) { catalog = schemaName; }

String[] tableTypes = new String[]{"TABLE","VIEW","SYNONYM"};
RubyArray matchingTables = (RubyArray) tableLookupBlock(context.getRuntime(),
c.getCatalog(), schemaName, table_name, tableTypes, false).call(c);
catalog, schemaName, table_name, tableTypes, false).call(c);
if (matchingTables.isEmpty()) {
throw new SQLException("Table " + table_name + " does not exist");
}

results = metadata.getColumns(c.getCatalog(),schemaName,table_name,null);
pkeys = metadata.getPrimaryKeys(c.getCatalog(),schemaName,table_name);
results = metadata.getColumns(catalog,schemaName,table_name,null);
pkeys = metadata.getPrimaryKeys(catalog,schemaName,table_name);
return unmarshal_columns(context, metadata, results, pkeys);
} finally {
close(results);
Expand Down

0 comments on commit aa760d4

Please sign in to comment.