Title: [907] trunk/activerecord-jdbc: Attempt a fix for Rubyforge 18059
Revision
907
Author
nicksieger
Date
2008-02-14 10:23:01 -0500 (Thu, 14 Feb 2008)

Log Message

Attempt a fix for Rubyforge 18059

Modified Paths


Diff

Modified: trunk/activerecord-jdbc/lib/active_record/connection_adapters/jdbc_adapter.rb (906 => 907)


--- trunk/activerecord-jdbc/lib/active_record/connection_adapters/jdbc_adapter.rb	2008-02-13 22:11:52 UTC (rev 906)
+++ trunk/activerecord-jdbc/lib/active_record/connection_adapters/jdbc_adapter.rb	2008-02-14 15:23:01 UTC (rev 907)
@@ -342,19 +342,19 @@
               next unless index_name
               index_name.downcase!
               column_name = resultset.get_string(Jdbc::IndexMetaData::COLUMN_NAME).downcase
-              
+
               next if primary_keys.include? column_name
-              
+
               # We are working on a new index
               if current_index != index_name
                 current_index = index_name
                 table_name = resultset.get_string(Jdbc::IndexMetaData::TABLE_NAME).downcase
                 non_unique = resultset.get_boolean(Jdbc::IndexMetaData::NON_UNIQUE)
-                
+
                 # empty list for column names, we'll add to that in just a bit
                 indexes << IndexDefinition.new(table_name, index_name, !non_unique, [])
               end
-              
+
               # One or more columns can be associated with an index
               indexes.last.columns << column_name
             end
@@ -404,7 +404,19 @@
 
     end
 
+    module ShadowCoreMethods
+      def alias_chained_method(meth, feature, target)
+        if instance_methods.include?("#{meth}_without_#{feature}")
+          alias_method "#{meth}_without_#{feature}".to_sym, target
+        else
+          alis_method meth, target
+        end
+      end
+    end
+
     class JdbcAdapter < AbstractAdapter
+      extend ShadowCoreMethods
+
       attr_reader :config
 
       ADAPTER_TYPES = ::JdbcSpec.constants.map{|c|
@@ -484,14 +496,15 @@
         @connection.reconnect!
         @connection
       end
-      
+
       def disconnect!
         @connection.disconnect!
       end
 
-      def select_all(sql, name = nil)
+      def jdbc_select_all(sql, name = nil)
         select(sql, name)
       end
+      alias_chained_method :select_all, :query_cache, :jdbc_select_all
 
       def select_rows(sql, name = nil)
         rows = []
@@ -508,8 +521,7 @@
           _execute(sql,name)
         end
       end
-      
-      
+
       # we need to do it this way, to allow Rails stupid tests to always work
       # even if we define a new execute method. Instead of mixing in a new
       # execute, an _execute should be mixed in.
@@ -523,18 +535,21 @@
         end
       end
 
-      def update(sql, name = nil) #:nodoc:
+      def jdbc_update(sql, name = nil) #:nodoc:
         execute(sql, name)
       end
+      alias_chained_method :update, :query_dirty, :jdbc_update
 
-      def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
+      def jdbc_insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
         id = execute(sql, name = nil)
         id_value || id
       end
+      alias_chained_method :insert, :query_dirty, :jdbc_insert
 
-      def columns(table_name, name = nil)
+      def jdbc_columns(table_name, name = nil)
         @connection.columns(table_name.to_s)
       end
+      alias_chained_method :columns, :query_cache, :jdbc_columns
 
       def tables
         @connection.tables

Modified: trunk/activerecord-jdbc/src/java/jdbc_adapter/JdbcAdapterInternalService.java (906 => 907)


--- trunk/activerecord-jdbc/src/java/jdbc_adapter/JdbcAdapterInternalService.java	2008-02-13 22:11:52 UTC (rev 906)
+++ trunk/activerecord-jdbc/src/java/jdbc_adapter/JdbcAdapterInternalService.java	2008-02-14 15:23:01 UTC (rev 907)
@@ -59,8 +59,7 @@
 import org.jruby.RubyString;
 import org.jruby.RubySymbol;
 import org.jruby.RubyTime;
-import org.jruby.
-exceptions.RaiseException;
+import org.jruby.exceptions.RaiseException;
 import org.jruby.javasupport.Java;
 import org.jruby.javasupport.JavaEmbedUtils;
 import org.jruby.javasupport.JavaObject;
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to