Title: [532] trunk/activerecord-jdbc: Don't look cursors for Oracle.
- Revision
- 532
- Author
- olabini
- Date
- 2007-05-04 04:57:49 -0400 (Fri, 04 May 2007)
Log Message
Don't look cursors for Oracle. These changes makes sure all result sets and statements are closed
Modified Paths
Diff
Modified: trunk/activerecord-jdbc/lib/active_record/connection_adapters/jdbc_adapter.rb (531 => 532)
--- trunk/activerecord-jdbc/lib/active_record/connection_adapters/jdbc_adapter.rb 2007-05-03 13:37:26 UTC (rev 531)
+++ trunk/activerecord-jdbc/lib/active_record/connection_adapters/jdbc_adapter.rb 2007-05-04 08:57:49 UTC (rev 532)
@@ -264,6 +264,8 @@
else
raise
end
+ ensure
+ metadata.close rescue nil
end
private
Modified: trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java (531 => 532)
--- trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java 2007-05-03 13:37:26 UTC (rev 531)
+++ trunk/activerecord-jdbc/src/java/JdbcAdapterInternalService.java 2007-05-04 08:57:49 UTC (rev 532)
@@ -92,8 +92,14 @@
}
public static IRubyObject set_connection(IRubyObject recv, IRubyObject conn) {
+ Connection c = (Connection)recv.dataGetStruct();
+ if(c != null) {
+ try {
+ c.close();
+ } catch(Exception e) {}
+ }
recv.setInstanceVariable("@connection",conn);
- Connection c = (Connection)(((JavaObject)conn.getInstanceVariable("@java_object")).getValue());
+ c = (Connection)(((JavaObject)conn.getInstanceVariable("@java_object")).getValue());
recv.dataWrapStruct(c);
return recv;
}
@@ -190,27 +196,6 @@
}
}
- /*
- column_name = col['column_name']
- column_name = column_name.downcase if metadata.storesUpperCaseIdentifiers
- precision = col["column_size"]
- scale = col["decimal_digits"]
- precision = precision.to_i if precision
- scale = scale.to_i if precision
- coltype = col["type_name"]
- if precision && precision > 0
- coltype << "(#{precision}"
- coltype << ",#{scale}" if scale && scale > 0
- coltype << ")"
- end
- c = ActiveRecord::ConnectionAdapters::JdbcColumn.new(@config, column_name, col['column_def'],
- coltype, col['is_nullable'] != 'NO')
- columns << c
- if tps[c.type] && tps[c.type][:limit].nil?
- c.limit = nil
- c.precision = nil unless c.type == :decimal
- end
-*/
public static IRubyObject columns(IRubyObject recv, IRubyObject[] args) throws SQLException, IOException {
String table_name = args[0].toString();
while(true) {
@@ -293,6 +278,10 @@
}
}
+ try {
+ rs.close();
+ } catch(Exception e) {}
+
return runtime.newArray(columns);
}
@@ -311,6 +300,11 @@
while(result_set.next()) {
keyNames.add(runtime.newString(result_set.getString(4).toLowerCase()));
}
+
+ try {
+ result_set.close();
+ } catch(Exception e) {}
+
return runtime.newArray(keyNames);
}
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel