<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -24,11 +24,20 @@ module PLSQL
       @connection
     end
     
-    def connection=(raw_conn)
+    def raw_connection=(raw_conn)
       @connection = raw_conn ? Connection.create(raw_conn) : nil
       reset_instance_variables
     end
 
+    def connection=(conn)
+      if conn.is_a?(::PLSQL::Connection)
+        @connection = conn
+        reset_instance_variables
+      else
+        self.raw_connection = conn
+      end
+    end
+
     def activerecord_class=(ar_class)
       @connection = ar_class ? Connection.create(nil, ar_class) : nil
       reset_instance_variables
@@ -122,7 +131,7 @@ module PLSQL
     def find_other_schema(name)
       return nil unless @first &amp;&amp; connection
       if select_first(&quot;SELECT username FROM all_users WHERE username = :username&quot;, name.to_s.upcase)
-        Schema.new(connection.raw_connection, name, false)
+        Schema.new(connection, name, false)
       else
         nil
       end</diff>
      <filename>lib/plsql/schema.rb</filename>
    </modified>
    <modified>
      <diff>@@ -114,4 +114,7 @@ describe &quot;ActiveRecord connection&quot; do
     plsql.default_timezone.should == :utc
   end
   
+  it &quot;should have the same connection as default schema&quot; do
+    plsql.hr.connection.should == plsql.connection
+  end
 end
\ No newline at end of file</diff>
      <filename>spec/plsql/schema_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3e4ce8456c097c4c48fa160a43dbdb85ee8c172b</id>
    </parent>
  </parents>
  <author>
    <name>Edgars Beigarts</name>
    <email>ebeigarts@alise.lv</email>
  </author>
  <url>http://github.com/rsim/ruby-plsql/commit/e8038ae83ea9bef1ece9d966bdaf3d7ec9e50a23</url>
  <id>e8038ae83ea9bef1ece9d966bdaf3d7ec9e50a23</id>
  <committed-date>2009-06-05T05:09:26-07:00</committed-date>
  <authored-date>2009-05-15T04:44:28-07:00</authored-date>
  <message>Share connections between schemas when using #activerecord_class (fixes OCIInvalidHandle in development mode with activerecord 2.2+)

Signed-off-by: Raimonds Simanovskis &lt;raymonds72@gmail.com&gt;</message>
  <tree>3695ef6a434ec89385e525e34fa5ed894b70b52f</tree>
  <committer>
    <name>Raimonds Simanovskis</name>
    <email>raymonds72@gmail.com</email>
  </committer>
</commit>
