Title: [662] trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java: Fix problem with the column return double information when the same table exists in different schema
- Revision
- 662
- Author
- olabini
- Date
- 2007-07-02 09:02:28 -0400 (Mon, 02 Jul 2007)
Log Message
Fix problem with the column return double information when the same table exists in different schema
Modified Paths
Diff
Modified: trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java (661 => 662)
--- trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java 2007-07-01 21:47:20 UTC (rev 661)
+++ trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java 2007-07-02 13:02:28 UTC (rev 662)
@@ -226,12 +226,23 @@
Connection c = (Connection)recv.dataGetStruct();
try {
DatabaseMetaData metadata = c.getMetaData();
+ String schemaName = null;
if(metadata.storesUpperCaseIdentifiers()) {
table_name = table_name.toUpperCase();
} else if(metadata.storesLowerCaseIdentifiers()) {
table_name = table_name.toLowerCase();
}
- ResultSet results = metadata.getColumns(c.getCatalog(),null,table_name,null);
+ ResultSet schemas = metadata.getSchemas();
+ String username = metadata.getUserName();
+ while(schemas.next()) {
+ if(schemas.getString(1).equalsIgnoreCase(username)) {
+ schemaName = schemas.getString(1);
+ break;
+ }
+ }
+ schemas.close();
+
+ ResultSet results = metadata.getColumns(c.getCatalog(),schemaName,table_name,null);
return unmarshal_columns(recv, metadata, results);
} catch(SQLException e) {
if(c.isClosed()) {
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel