Hello community,

here is the log from the commit of package rubygem-arel for openSUSE:Factory 
checked in at 2016-04-28 16:52:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-arel (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-arel.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-arel"

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-arel/rubygem-arel.changes        
2015-08-05 19:14:44.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-arel.new/rubygem-arel.changes   
2016-04-28 16:52:58.000000000 +0200
@@ -1,0 +2,6 @@
+Fri Dec 18 05:28:53 UTC 2015 - [email protected]
+
+- updated to version 7.0.0
+ see installed History.txt
+
+-------------------------------------------------------------------

Old:
----
  arel-6.0.3.gem

New:
----
  arel-7.0.0.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-arel.spec ++++++
--- /var/tmp/diff_new_pack.tz029K/_old  2016-04-28 16:52:59.000000000 +0200
+++ /var/tmp/diff_new_pack.tz029K/_new  2016-04-28 16:52:59.000000000 +0200
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-arel
-Version:        6.0.3
+Version:        7.0.0
 Release:        0
 %define mod_name arel
 %define mod_full_name %{mod_name}-%{version}

++++++ arel-6.0.3.gem -> arel-7.0.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/History.txt new/History.txt
--- old/History.txt     2015-08-04 23:28:25.000000000 +0200
+++ new/History.txt     2015-12-17 21:03:56.000000000 +0100
@@ -1,20 +1,10 @@
-=== 6.0.3 / 2015-08-04
+=== 7.0.0 / 2015-12-17
 
-* Bug fixes
+* Enhancements
 
-  * Fix quoting LIMIT values on Oracle visitor.
-
-=== 6.0.2 / 2015-07-11
-
-* Bug fixes
-
-  * Fix file permission problem on the gem package
-
-=== 6.0.1 / 2015-07-10
-
-* Bug fixes
-
-  * Stop quoting LIMIT values.
+  * Remove deprecated method `Table#primary_key`
+  * Remove engine from the constructor arguments `Arel::Table`
+  * Deprecate automatic type casting within Arel
 
 === 6.0.0 / 2014-11-25
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/MIT-LICENSE.txt new/MIT-LICENSE.txt
--- old/MIT-LICENSE.txt 2015-08-04 23:28:25.000000000 +0200
+++ new/MIT-LICENSE.txt 2015-12-17 21:03:56.000000000 +0100
@@ -1,4 +1,4 @@
-Copyright (c) 2007-2010 Nick Kallen, Bryan Helmkamp, Emilio Tagua, Aaron 
Patterson
+Copyright (c) 2007-2015 Nick Kallen, Bryan Helmkamp, Emilio Tagua, Aaron 
Patterson
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
@@ -18,3 +18,4 @@
 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/README.markdown new/README.markdown
--- old/README.markdown 2015-08-04 23:28:25.000000000 +0200
+++ new/README.markdown 2015-12-17 21:03:56.000000000 +0100
@@ -1,4 +1,4 @@
-# Arel [![Build 
Status](https://secure.travis-ci.org/rails/arel.svg?branch=master)](http://travis-ci.org/rails/arel)
 [![Dependency 
Status](https://gemnasium.com/rails/arel.svg)](https://gemnasium.com/rails/arel)
+# Arel
 
 * http://github.com/rails/arel
 
@@ -222,6 +222,12 @@
  FROM "photos"
 ```
 
-### License
+## Contributing to Arel
 
-Arel is released under the [MIT License](http://opensource.org/licenses/MIT).
+Arel is work of many contributors. You're encouraged to submit pull requests, 
propose
+features and discuss issues.
+
+See [CONTRIBUTING](CONTRIBUTING.md).
+
+## License
+Arel is released under the [MIT 
License](http://www.opensource.org/licenses/MIT).
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/attributes/attribute.rb 
new/lib/arel/attributes/attribute.rb
--- old/lib/arel/attributes/attribute.rb        2015-08-04 23:28:25.000000000 
+0200
+++ new/lib/arel/attributes/attribute.rb        2015-12-17 21:03:56.000000000 
+0100
@@ -12,6 +12,14 @@
       def lower
         relation.lower self
       end
+
+      def type_cast_for_database(value)
+        relation.type_cast_for_database(name, value)
+      end
+
+      def able_to_type_cast?
+        relation.able_to_type_cast?
+      end
     end
 
     class String    < Attribute; end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/crud.rb new/lib/arel/crud.rb
--- old/lib/arel/crud.rb        2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/crud.rb        2015-12-17 21:03:56.000000000 +0100
@@ -3,7 +3,7 @@
   # FIXME hopefully we can remove this
   module Crud
     def compile_update values, pk
-      um = UpdateManager.new @engine
+      um = UpdateManager.new
 
       if Nodes::SqlLiteral === values
         relation = @ctx.from
@@ -26,11 +26,12 @@
     end
 
     def create_insert
-      InsertManager.new @engine
+      InsertManager.new
     end
 
     def compile_delete
-      dm = DeleteManager.new @engine
+      dm = DeleteManager.new
+      dm.take @ast.limit.expr if @ast.limit
       dm.wheres = @ctx.wheres
       dm.from @ctx.froms
       dm
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/delete_manager.rb 
new/lib/arel/delete_manager.rb
--- old/lib/arel/delete_manager.rb      2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/delete_manager.rb      2015-12-17 21:03:57.000000000 +0100
@@ -1,6 +1,6 @@
 module Arel
   class DeleteManager < Arel::TreeManager
-    def initialize engine
+    def initialize
       super
       @ast = Nodes::DeleteStatement.new
       @ctx = @ast
@@ -11,6 +11,11 @@
       self
     end
 
+    def take limit
+      @ast.limit = Nodes::Limit.new(Nodes.build_quoted(limit)) if limit
+      self
+    end
+
     def wheres= list
       @ast.wheres = list
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/insert_manager.rb 
new/lib/arel/insert_manager.rb
--- old/lib/arel/insert_manager.rb      2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/insert_manager.rb      2015-12-17 21:03:57.000000000 +0100
@@ -1,6 +1,6 @@
 module Arel
   class InsertManager < Arel::TreeManager
-    def initialize engine
+    def initialize
       super
       @ast = Nodes::InsertStatement.new
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/nodes/binary.rb new/lib/arel/nodes/binary.rb
--- old/lib/arel/nodes/binary.rb        2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/nodes/binary.rb        2015-12-17 21:03:57.000000000 +0100
@@ -38,9 +38,7 @@
       LessThanOrEqual
       NotEqual
       NotIn
-      NotRegexp
       Or
-      Regexp
       Union
       UnionAll
       Intersect
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/nodes/bind_param.rb 
new/lib/arel/nodes/bind_param.rb
--- old/lib/arel/nodes/bind_param.rb    2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/nodes/bind_param.rb    2015-12-17 21:03:57.000000000 +0100
@@ -1,6 +1,9 @@
 module Arel
   module Nodes
     class BindParam < Node
+      def ==(other)
+        other.is_a?(BindParam)
+      end
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/nodes/casted.rb new/lib/arel/nodes/casted.rb
--- old/lib/arel/nodes/casted.rb        1970-01-01 01:00:00.000000000 +0100
+++ new/lib/arel/nodes/casted.rb        2015-12-17 21:03:57.000000000 +0100
@@ -0,0 +1,40 @@
+module Arel
+  module Nodes
+    class Casted < Arel::Nodes::Node # :nodoc:
+      attr_reader :val, :attribute
+      def initialize val, attribute
+        @val       = val
+        @attribute = attribute
+        super()
+      end
+
+      def nil?; @val.nil?; end
+
+      def eql? other
+        self.class == other.class &&
+            self.val == other.val &&
+            self.attribute == other.attribute
+      end
+      alias :== :eql?
+    end
+
+    class Quoted < Arel::Nodes::Unary # :nodoc:
+      alias :val :value
+      def nil?; val.nil?; end
+    end
+
+    def self.build_quoted other, attribute = nil
+      case other
+        when Arel::Nodes::Node, Arel::Attributes::Attribute, Arel::Table, 
Arel::Nodes::BindParam, Arel::SelectManager, Arel::Nodes::Quoted
+          other
+        else
+          case attribute
+            when Arel::Attributes::Attribute
+              Casted.new other, attribute
+            else
+              Quoted.new other
+          end
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/nodes/delete_statement.rb 
new/lib/arel/nodes/delete_statement.rb
--- old/lib/arel/nodes/delete_statement.rb      2015-08-04 23:28:25.000000000 
+0200
+++ new/lib/arel/nodes/delete_statement.rb      2015-12-17 21:03:57.000000000 
+0100
@@ -1,6 +1,8 @@
 module Arel
   module Nodes
     class DeleteStatement < Arel::Nodes::Binary
+      attr_accessor :limit
+
       alias :relation :left
       alias :relation= :left=
       alias :wheres :right
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/nodes/function.rb 
new/lib/arel/nodes/function.rb
--- old/lib/arel/nodes/function.rb      2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/nodes/function.rb      2015-12-17 21:03:57.000000000 +0100
@@ -3,6 +3,7 @@
     class Function < Arel::Nodes::Node
       include Arel::Predications
       include Arel::WindowPredications
+      include Arel::OrderPredications
       attr_accessor :expressions, :alias, :distinct
 
       def initialize expr, aliaz = nil
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/nodes/matches.rb 
new/lib/arel/nodes/matches.rb
--- old/lib/arel/nodes/matches.rb       2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/nodes/matches.rb       2015-12-17 21:03:57.000000000 +0100
@@ -2,10 +2,12 @@
   module Nodes
     class Matches < Binary
       attr_reader :escape
+      attr_accessor :case_sensitive
 
-      def initialize(left, right, escape = nil)
+      def initialize(left, right, escape = nil, case_sensitive = false)
         super(left, right)
         @escape = escape && Nodes.build_quoted(escape)
+        @case_sensitive = case_sensitive
       end
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/nodes/regexp.rb new/lib/arel/nodes/regexp.rb
--- old/lib/arel/nodes/regexp.rb        1970-01-01 01:00:00.000000000 +0100
+++ new/lib/arel/nodes/regexp.rb        2015-12-17 21:03:57.000000000 +0100
@@ -0,0 +1,14 @@
+module Arel
+  module Nodes
+    class Regexp < Binary
+      attr_accessor :case_sensitive
+
+      def initialize(left, right, case_sensitive = true)
+        super(left, right)
+        @case_sensitive = case_sensitive
+      end
+    end
+
+    class NotRegexp < Regexp; end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/nodes/select_core.rb 
new/lib/arel/nodes/select_core.rb
--- old/lib/arel/nodes/select_core.rb   2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/nodes/select_core.rb   2015-12-17 21:03:57.000000000 +0100
@@ -2,7 +2,7 @@
   module Nodes
     class SelectCore < Arel::Nodes::Node
       attr_accessor :top, :projections, :wheres, :groups, :windows
-      attr_accessor :having, :source, :set_quantifier
+      attr_accessor :havings, :source, :set_quantifier
 
       def initialize
         super()
@@ -14,7 +14,7 @@
         @projections    = []
         @wheres         = []
         @groups         = []
-        @having         = nil
+        @havings        = []
         @windows        = []
       end
 
@@ -35,14 +35,14 @@
         @projections = @projections.clone
         @wheres      = @wheres.clone
         @groups      = @groups.clone
-        @having      = @having.clone if @having
+        @havings     = @havings.clone
         @windows     = @windows.clone
       end
 
       def hash
         [
           @source, @top, @set_quantifier, @projections,
-          @wheres, @groups, @having, @windows
+          @wheres, @groups, @havings, @windows
         ].hash
       end
 
@@ -54,7 +54,7 @@
           self.projections == other.projections &&
           self.wheres == other.wheres &&
           self.groups == other.groups &&
-          self.having == other.having &&
+          self.havings == other.havings &&
           self.windows == other.windows
       end
       alias :== :eql?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/nodes/table_alias.rb 
new/lib/arel/nodes/table_alias.rb
--- old/lib/arel/nodes/table_alias.rb   2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/nodes/table_alias.rb   2015-12-17 21:03:57.000000000 +0100
@@ -13,8 +13,12 @@
         relation.respond_to?(:name) ? relation.name : name
       end
 
-      def engine
-        relation.engine
+      def type_cast_for_database(*args)
+        relation.type_cast_for_database(*args)
+      end
+
+      def able_to_type_cast?
+        relation.respond_to?(:able_to_type_cast?) && 
relation.able_to_type_cast?
       end
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/nodes/unary.rb new/lib/arel/nodes/unary.rb
--- old/lib/arel/nodes/unary.rb 2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/nodes/unary.rb 2015-12-17 21:03:57.000000000 +0100
@@ -23,7 +23,6 @@
     %w{
       Bin
       Group
-      Having
       Limit
       Not
       Offset
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/nodes.rb new/lib/arel/nodes.rb
--- old/lib/arel/nodes.rb       2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/nodes.rb       2015-12-17 21:03:57.000000000 +0100
@@ -30,6 +30,7 @@
 require 'arel/nodes/infix_operation'
 require 'arel/nodes/over'
 require 'arel/nodes/matches'
+require 'arel/nodes/regexp'
 
 # nary
 require 'arel/nodes/and'
@@ -55,41 +56,4 @@
 
 require 'arel/nodes/sql_literal'
 
-module Arel
-  module Nodes
-    class Casted < Arel::Nodes::Node # :nodoc:
-      attr_reader :val, :attribute
-      def initialize val, attribute
-        @val       = val
-        @attribute = attribute
-        super()
-      end
-
-      def nil?; @val.nil?; end
-
-      def eql? other
-        self.class == other.class &&
-          self.val == other.val &&
-          self.attribute == other.attribute
-      end
-      alias :== :eql?
-    end
-
-    class Quoted < Arel::Nodes::Unary # :nodoc:
-    end
-
-    def self.build_quoted other, attribute = nil
-      case other
-      when Arel::Nodes::Node, Arel::Attributes::Attribute, Arel::Table, 
Arel::Nodes::BindParam, Arel::SelectManager
-        other
-      else
-        case attribute
-        when Arel::Attributes::Attribute
-          Casted.new other, attribute
-        else
-          Quoted.new other
-        end
-      end
-    end
-  end
-end
+require 'arel/nodes/casted'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/predications.rb new/lib/arel/predications.rb
--- old/lib/arel/predications.rb        2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/predications.rb        2015-12-17 21:03:57.000000000 +0100
@@ -25,15 +25,15 @@
     end
 
     def between other
-      if other.begin == -Float::INFINITY
-        if other.end == Float::INFINITY
+      if equals_quoted?(other.begin, -Float::INFINITY)
+        if equals_quoted?(other.end, Float::INFINITY)
           not_in([])
         elsif other.exclude_end?
           lt(other.end)
         else
           lteq(other.end)
         end
-      elsif other.end == Float::INFINITY
+      elsif equals_quoted?(other.end, Float::INFINITY)
         gteq(other.begin)
       elsif other.exclude_end?
         gteq(other.begin).and(lt(other.end))
@@ -71,15 +71,15 @@
     end
 
     def not_between other
-      if other.begin == -Float::INFINITY # The range begins with negative 
infinity
-        if other.end == Float::INFINITY
+      if equals_quoted?(other.begin, -Float::INFINITY)
+        if equals_quoted?(other.end, Float::INFINITY)
           self.in([])
         elsif other.exclude_end?
           gteq(other.end)
         else
           gt(other.end)
         end
-      elsif other.end == Float::INFINITY
+      elsif equals_quoted?(other.end, Float::INFINITY)
         lt(other.begin)
       else
         left = lt(other.begin)
@@ -118,20 +118,28 @@
       grouping_all :not_in, others
     end
 
-    def matches other, escape = nil
-      Nodes::Matches.new self, quoted_node(other), escape
+    def matches other, escape = nil, case_sensitive = false
+      Nodes::Matches.new self, quoted_node(other), escape, case_sensitive
     end
 
-    def matches_any others, escape = nil
-      grouping_any :matches, others, escape
+    def matches_regexp other, case_sensitive = true
+      Nodes::Regexp.new self, quoted_node(other), case_sensitive
     end
 
-    def matches_all others, escape = nil
-      grouping_all :matches, others, escape
+    def matches_any others, escape = nil, case_sensitive = false
+      grouping_any :matches, others, escape, case_sensitive
     end
 
-    def does_not_match other, escape = nil
-      Nodes::DoesNotMatch.new self, quoted_node(other), escape
+    def matches_all others, escape = nil, case_sensitive = false
+      grouping_all :matches, others, escape, case_sensitive
+    end
+
+    def does_not_match other, escape = nil, case_sensitive = false
+      Nodes::DoesNotMatch.new self, quoted_node(other), escape, case_sensitive
+    end
+
+    def does_not_match_regexp other, case_sensitive = true
+      Nodes::NotRegexp.new self, quoted_node(other), case_sensitive
     end
 
     def does_not_match_any others, escape = nil
@@ -211,5 +219,13 @@
     def quoted_array(others)
       others.map { |v| quoted_node(v) }
     end
+
+    def equals_quoted?(maybe_quoted, value)
+      if maybe_quoted.is_a?(Nodes::Quoted)
+        maybe_quoted.val == value
+      else
+        maybe_quoted == value
+      end
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/select_manager.rb 
new/lib/arel/select_manager.rb
--- old/lib/arel/select_manager.rb      2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/select_manager.rb      2015-12-17 21:03:57.000000000 +0100
@@ -6,8 +6,8 @@
 
     STRING_OR_SYMBOL_CLASS = [Symbol, String]
 
-    def initialize engine, table = nil
-      super(engine)
+    def initialize table = nil
+      super()
       @ast   = Nodes::SelectStatement.new
       @ctx    = @ast.cores.last
       from table
@@ -118,8 +118,8 @@
       join(relation, Nodes::OuterJoin)
     end
 
-    def having *exprs
-      @ctx.having = Nodes::Having.new(collapse(exprs, @ctx.having))
+    def having expr
+      @ctx.havings << expr
       self
     end
 
@@ -176,10 +176,10 @@
       @ast.orders
     end
 
-    def where_sql
+    def where_sql engine = Table.engine
       return if @ctx.wheres.empty?
 
-      viz = Visitors::WhereSql.new @engine.connection
+      viz = Visitors::WhereSql.new(engine.connection.visitor, 
engine.connection)
       Nodes::SqlLiteral.new viz.accept(@ctx, Collectors::SQLString.new).value
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/table.rb new/lib/arel/table.rb
--- old/lib/arel/table.rb       2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/table.rb       2015-12-17 21:03:57.000000000 +0100
@@ -6,40 +6,24 @@
     @engine = nil
     class << self; attr_accessor :engine; end
 
-    attr_accessor :name, :engine, :aliases, :table_alias
+    attr_accessor :name, :aliases, :table_alias
 
     # TableAlias and Table both have a #table_name which is the name of the 
underlying table
     alias :table_name :name
 
-    def initialize name, engine = Table.engine
+    def initialize(name, as: nil, type_caster: nil)
       @name    = name.to_s
-      @engine  = engine
       @columns = nil
       @aliases = []
-      @table_alias = nil
-      @primary_key = nil
+      @type_caster = type_caster
 
-      if Hash === engine
-        @engine  = engine[:engine] || Table.engine
-
-        # Sometime AR sends an :as parameter to table, to let the table know
-        # that it is an Alias.  We may want to override new, and return a
-        # TableAlias node?
-        @table_alias = engine[:as] unless engine[:as].to_s == @name
-      end
-    end
-
-    def primary_key
-      if $VERBOSE
-        warn <<-eowarn
-primary_key (#{caller.first}) is deprecated and will be removed in Arel 4.0.0
-        eowarn
-      end
-      @primary_key ||= begin
-        primary_key_name = @engine.connection.primary_key(name)
-        # some tables might be without primary key
-        primary_key_name && self[primary_key_name]
+      # Sometime AR sends an :as parameter to table, to let the table know
+      # that it is an Alias.  We may want to override new, and return a
+      # TableAlias node?
+      if as.to_s == @name
+        as = nil
       end
+      @table_alias = as
     end
 
     def alias name = "#{self.name}_2"
@@ -48,12 +32,12 @@
       end
     end
 
-    def from table
-      SelectManager.new(@engine, table)
+    def from
+      SelectManager.new(self)
     end
 
     def join relation, klass = Nodes::InnerJoin
-      return from(self) unless relation
+      return from unless relation
 
       case relation
       when String, Nodes::SqlLiteral
@@ -61,7 +45,7 @@
         klass = Nodes::StringJoin
       end
 
-      from(self).join(relation, klass)
+      from.join(relation, klass)
     end
 
     def outer_join relation
@@ -69,55 +53,39 @@
     end
 
     def group *columns
-      from(self).group(*columns)
+      from.group(*columns)
     end
 
     def order *expr
-      from(self).order(*expr)
+      from.order(*expr)
     end
 
     def where condition
-      from(self).where condition
+      from.where condition
     end
 
     def project *things
-      from(self).project(*things)
+      from.project(*things)
     end
 
     def take amount
-      from(self).take amount
+      from.take amount
     end
 
     def skip amount
-      from(self).skip amount
+      from.skip amount
     end
 
     def having expr
-      from(self).having expr
+      from.having expr
     end
 
     def [] name
       ::Arel::Attribute.new self, name
     end
 
-    def select_manager
-      SelectManager.new(@engine)
-    end
-
-    def insert_manager
-      InsertManager.new(@engine)
-    end
-
-    def update_manager
-      UpdateManager.new(@engine)
-    end
-
-    def delete_manager
-      DeleteManager.new(@engine)
-    end
-
     def hash
-      # Perf note: aliases, table alias and engine is excluded from the hash
+      # Perf note: aliases and table alias is excluded from the hash
       #  aliases can have a loop back to this table breaking hashes in parent
       #  relations, for the vast majority of cases @name is unique to a query
       @name.hash
@@ -126,12 +94,23 @@
     def eql? other
       self.class == other.class &&
         self.name == other.name &&
-        self.engine == other.engine &&
         self.aliases == other.aliases &&
         self.table_alias == other.table_alias
     end
     alias :== :eql?
 
+    def type_cast_for_database(attribute_name, value)
+      type_caster.type_cast_for_database(attribute_name, value)
+    end
+
+    def able_to_type_cast?
+      !type_caster.nil?
+    end
+
+    protected
+
+    attr_reader :type_caster
+
     private
 
     def attributes_for columns
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/tree_manager.rb new/lib/arel/tree_manager.rb
--- old/lib/arel/tree_manager.rb        2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/tree_manager.rb        2015-12-17 21:03:57.000000000 +0100
@@ -8,8 +8,7 @@
 
     attr_accessor :bind_values
 
-    def initialize engine
-      @engine = engine
+    def initialize
       @ctx    = nil
       @bind_values = []
     end
@@ -20,13 +19,9 @@
       collector.value
     end
 
-    def visitor
-      engine.connection.visitor
-    end
-
-    def to_sql
+    def to_sql engine = Table.engine
       collector = Arel::Collectors::SQLString.new
-      collector = visitor.accept @ast, collector
+      collector = engine.connection.visitor.accept @ast, collector
       collector.value
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/update_manager.rb 
new/lib/arel/update_manager.rb
--- old/lib/arel/update_manager.rb      2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/update_manager.rb      2015-12-17 21:03:57.000000000 +0100
@@ -1,6 +1,6 @@
 module Arel
   class UpdateManager < Arel::TreeManager
-    def initialize engine
+    def initialize
       super
       @ast = Nodes::UpdateStatement.new
       @ctx = @ast
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/visitors/depth_first.rb 
new/lib/arel/visitors/depth_first.rb
--- old/lib/arel/visitors/depth_first.rb        2015-08-04 23:28:25.000000000 
+0200
+++ new/lib/arel/visitors/depth_first.rb        2015-12-17 21:03:57.000000000 
+0100
@@ -146,7 +146,7 @@
         visit o.wheres
         visit o.groups
         visit o.windows
-        visit o.having
+        visit o.havings
       end
 
       def visit_Arel_Nodes_SelectStatement o
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/visitors/informix.rb 
new/lib/arel/visitors/informix.rb
--- old/lib/arel/visitors/informix.rb   2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/visitors/informix.rb   2015-12-17 21:03:57.000000000 +0100
@@ -34,8 +34,13 @@
           collector = inject_join o.groups, collector, ", "
         end
 
-        maybe_visit o.having, collector
+        if o.havings.any?
+          collector << " HAVING "
+          collector = inject_join o.havings, collector, " AND "
+        end
+        collector
       end
+
       def visit_Arel_Nodes_Offset o, collector
         collector << "SKIP "
         visit o.expr, collector
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/visitors/mssql.rb 
new/lib/arel/visitors/mssql.rb
--- old/lib/arel/visitors/mssql.rb      2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/visitors/mssql.rb      2015-12-17 21:03:57.000000000 +0100
@@ -3,6 +3,11 @@
     class MSSQL < Arel::Visitors::ToSql
       RowNumber = Struct.new :children
 
+      def initialize(*)
+        @primary_keys = {}
+        super
+      end
+
       private
 
       # `top` wouldn't really work here. I.e. User.select("distinct 
first_name").limit(10) would generate
@@ -61,6 +66,23 @@
         end
       end
 
+      def visit_Arel_Nodes_DeleteStatement o, collector
+        collector << 'DELETE '
+        if o.limit
+          collector << 'TOP ('
+          visit o.limit.expr, collector
+          collector << ') '
+        end
+        collector << 'FROM '
+        collector = visit o.relation, collector
+        if o.wheres.any?
+          collector << ' WHERE '
+          inject_join o.wheres, collector, AND
+        else
+          collector
+        end
+      end
+
       def determine_order_by orders, x
         if orders.any?
           orders
@@ -81,10 +103,20 @@
       end
 
       # FIXME raise exception of there is no pk?
-      # FIXME!! Table.primary_key will be deprecated. What is the replacement??
       def find_left_table_pk o
-        return o.primary_key if o.instance_of? Arel::Table
-        find_left_table_pk o.left if o.kind_of? Arel::Nodes::Join
+        if o.kind_of?(Arel::Nodes::Join)
+          find_left_table_pk(o.left)
+        elsif o.instance_of?(Arel::Table)
+          find_primary_key(o)
+        end
+      end
+
+      def find_primary_key(o)
+        @primary_keys[o.name] ||= begin
+          primary_key_name = @connection.primary_key(o.name)
+          # some tables might be without primary key
+          primary_key_name && o[primary_key_name]
+        end
       end
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/visitors/oracle12.rb 
new/lib/arel/visitors/oracle12.rb
--- old/lib/arel/visitors/oracle12.rb   1970-01-01 01:00:00.000000000 +0100
+++ new/lib/arel/visitors/oracle12.rb   2015-12-17 21:03:57.000000000 +0100
@@ -0,0 +1,53 @@
+module Arel
+  module Visitors
+    class Oracle12 < Arel::Visitors::ToSql
+      private
+
+      def visit_Arel_Nodes_SelectStatement o, collector
+        # Oracle does not allow LIMIT clause with select for update
+        if o.limit && o.lock
+          o = o.dup
+          o.limit = []
+        end
+
+        super
+      end
+
+      def visit_Arel_Nodes_SelectOptions o, collector
+        collector = maybe_visit o.offset, collector
+        collector = maybe_visit o.limit, collector
+        collector = maybe_visit o.lock, collector
+      end
+
+      def visit_Arel_Nodes_Limit o, collector
+        collector << "FETCH FIRST "
+        collector = visit o.expr, collector
+        collector << " ROWS ONLY"
+      end
+
+      def visit_Arel_Nodes_Offset o, collector
+        collector << "OFFSET "
+        visit o.expr, collector
+        collector << " ROWS"
+      end
+
+      def visit_Arel_Nodes_Except o, collector
+        collector << "( "
+        collector = infix_value o, collector, " MINUS "
+        collector << " )"
+      end
+
+      def visit_Arel_Nodes_UpdateStatement o, collector
+        # Oracle does not allow ORDER BY/LIMIT in UPDATEs.
+        if o.orders.any? && o.limit.nil?
+          # However, there is no harm in silently eating the ORDER BY clause 
if no LIMIT has been provided,
+          # otherwise let the user deal with the error
+          o = o.dup
+          o.orders = []
+        end
+
+        super
+      end
+    end
+  end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/visitors/postgresql.rb 
new/lib/arel/visitors/postgresql.rb
--- old/lib/arel/visitors/postgresql.rb 2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/visitors/postgresql.rb 2015-12-17 21:03:57.000000000 +0100
@@ -4,19 +4,35 @@
       private
 
       def visit_Arel_Nodes_Matches o, collector
-        infix_value o, collector, ' ILIKE '
+        op = o.case_sensitive ? ' LIKE ' : ' ILIKE '
+        collector = infix_value o, collector, op
+        if o.escape
+          collector << ' ESCAPE '
+          visit o.escape, collector
+        else
+          collector
+        end
       end
 
       def visit_Arel_Nodes_DoesNotMatch o, collector
-        infix_value o, collector, ' NOT ILIKE '
+        op = o.case_sensitive ? ' NOT LIKE ' : ' NOT ILIKE '
+        collector = infix_value o, collector, op
+        if o.escape
+          collector << ' ESCAPE '
+          visit o.escape, collector
+        else
+          collector
+        end
       end
 
       def visit_Arel_Nodes_Regexp o, collector
-        infix_value o, collector, ' ~ '
+        op = o.case_sensitive ? ' ~ ' : ' ~* '
+        infix_value o, collector, op
       end
 
       def visit_Arel_Nodes_NotRegexp o, collector
-        infix_value o, collector, ' !~ '
+        op = o.case_sensitive ? ' !~ ' : ' !~* '
+        infix_value o, collector, op
       end
 
       def visit_Arel_Nodes_DistinctOn o, collector
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/visitors/to_sql.rb 
new/lib/arel/visitors/to_sql.rb
--- old/lib/arel/visitors/to_sql.rb     2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/visitors/to_sql.rb     2015-12-17 21:03:57.000000000 +0100
@@ -4,6 +4,12 @@
 
 module Arel
   module Visitors
+    class UnsupportedVisitError < StandardError
+      def initialize(object)
+        super "Unsupported argument type: #{object.class.name}. Construct an 
Arel node instead."
+      end
+    end
+
     class ToSql < Arel::Visitors::Reduce
       ##
       # This is some roflscale crazy stuff.  I'm roflscaling this because
@@ -74,14 +80,14 @@
       end
 
       def visit_Arel_Nodes_DeleteStatement o, collector
-        collector << "DELETE FROM "
+        collector << 'DELETE FROM '
         collector = visit o.relation, collector
         if o.wheres.any?
-          collector << " WHERE "
-          inject_join o.wheres, collector, AND
-        else
-          collector
+          collector << ' WHERE '
+          collector = inject_join o.wheres, collector, AND
         end
+
+        maybe_visit o.limit, collector
       end
 
       # FIXME: we should probably have a 2-pass visitor for this
@@ -211,7 +217,6 @@
         }
 
         unless o.orders.empty?
-          collector << SPACE
           collector << ORDER_BY
           len = o.orders.length - 1
           o.orders.each_with_index { |x, i|
@@ -220,11 +225,15 @@
           }
         end
 
+        visit_Arel_Nodes_SelectOptions(o, collector)
+
+        collector
+      end
+
+      def visit_Arel_Nodes_SelectOptions o, collector
         collector = maybe_visit o.limit, collector
         collector = maybe_visit o.offset, collector
         collector = maybe_visit o.lock, collector
-
-        collector
       end
 
       def visit_Arel_Nodes_SelectCore o, collector
@@ -266,7 +275,10 @@
           end
         end
 
-        collector = maybe_visit o.having, collector
+        unless o.havings.empty?
+          collector << " HAVING "
+          inject_join o.havings, collector, AND
+        end
 
         unless o.windows.empty?
           collector << WINDOW
@@ -405,11 +417,6 @@
         end
       end
 
-      def visit_Arel_Nodes_Having o, collector
-        collector << "HAVING "
-        visit o.expr, collector
-      end
-
       def visit_Arel_Nodes_Offset o, collector
         collector << "OFFSET "
         visit o.expr, collector
@@ -728,11 +735,15 @@
       alias :visit_Fixnum                :literal
 
       def quoted o, a
-        quote(o, column_for(a))
+        if a && a.able_to_type_cast?
+          quote(a.type_cast_for_database(o))
+        else
+          quote(o, column_for(a))
+        end
       end
 
       def unsupported o, collector
-        raise "unsupported: #{o.class.name}"
+        raise UnsupportedVisitError.new(o)
       end
 
       alias :visit_ActiveSupport_Multibyte_Chars :unsupported
@@ -768,6 +779,9 @@
 
       def quote value, column = nil
         return value if Arel::Nodes::SqlLiteral === value
+        if column
+          print_type_cast_deprecation
+        end
         @connection.quote value, column
       end
 
@@ -817,6 +831,20 @@
           collector
         end
       end
+
+      def print_type_cast_deprecation
+        unless defined?($arel_silence_type_casting_deprecation) && 
$arel_silence_type_casting_deprecation
+          warn <<-eowarn
+Arel performing automatic type casting is deprecated, and will be removed in 
Arel 8.0. If you are seeing this, it is because you are manually passing a 
value to an Arel predicate, and the `Arel::Table` object was constructed 
manually. The easiest way to remove this warning is to use an `Arel::Table` 
object returned from calling `arel_table` on an ActiveRecord::Base subclass.
+
+If you're certain the value is already of the right type, change 
`attribute.eq(value)` to `attribute.eq(Arel::Nodes::Quoted.new(value))` (you 
will be able to remove that in Arel 8.0, it is only required to silence this 
deprecation warning).
+
+You can also silence this warning globally by setting 
`$arel_silence_type_casting_deprecation` to `true`. (Do NOT do this if you are 
a library author)
+
+If you are passing user input to a predicate, you must either give an 
appropriate type caster object to the `Arel::Table`, or manually cast the value 
before passing it to Arel.
+          eowarn
+        end
+      end
     end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/visitors/where_sql.rb 
new/lib/arel/visitors/where_sql.rb
--- old/lib/arel/visitors/where_sql.rb  2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/visitors/where_sql.rb  2015-12-17 21:03:57.000000000 +0100
@@ -1,11 +1,20 @@
 module Arel
   module Visitors
     class WhereSql < Arel::Visitors::ToSql
+      def initialize(inner_visitor, *args, &block)
+        @inner_visitor = inner_visitor
+        super(*args, &block)
+      end
+
       private
 
       def visit_Arel_Nodes_SelectCore o, collector
         collector << "WHERE "
-        inject_join o.wheres, collector, ' AND '
+        wheres = o.wheres.map do |where|
+          Nodes::SqlLiteral.new(@inner_visitor.accept(where, 
collector.class.new).value)
+        end
+
+        inject_join wheres, collector, ' AND '
       end
     end
   end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel/visitors.rb new/lib/arel/visitors.rb
--- old/lib/arel/visitors.rb    2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel/visitors.rb    2015-12-17 21:03:57.000000000 +0100
@@ -6,6 +6,7 @@
 require 'arel/visitors/mysql'
 require 'arel/visitors/mssql'
 require 'arel/visitors/oracle'
+require 'arel/visitors/oracle12'
 require 'arel/visitors/where_sql'
 require 'arel/visitors/dot'
 require 'arel/visitors/ibm_db'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/arel.rb new/lib/arel.rb
--- old/lib/arel.rb     2015-08-04 23:28:25.000000000 +0200
+++ new/lib/arel.rb     2015-12-17 21:03:56.000000000 +0100
@@ -21,7 +21,7 @@
 require 'arel/nodes'
 
 module Arel
-  VERSION = '6.0.3'
+  VERSION = '7.0.0'
 
   def self.sql raw_sql
     Arel::Nodes::SqlLiteral.new raw_sql
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2015-08-04 23:28:25.000000000 +0200
+++ new/metadata        2015-12-17 21:03:56.000000000 +0100
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: arel
 version: !ruby/object:Gem::Version
-  version: 6.0.3
+  version: 7.0.0
 platform: ruby
 authors:
 - Aaron Patterson
@@ -11,7 +11,7 @@
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2015-08-04 00:00:00.000000000 Z
+date: 2015-12-17 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: minitest
@@ -41,6 +41,20 @@
     - - "~>"
       - !ruby/object:Gem::Version
         version: '4.0'
+- !ruby/object:Gem::Dependency
+  name: rake
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ">="
+      - !ruby/object:Gem::Version
+        version: '0'
+  type: :development
+  prerelease: false
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ">="
+      - !ruby/object:Gem::Version
+        version: '0'
 description: |-
   Arel Really Exasperates Logicians
 
@@ -85,6 +99,7 @@
 - lib/arel/nodes/ascending.rb
 - lib/arel/nodes/binary.rb
 - lib/arel/nodes/bind_param.rb
+- lib/arel/nodes/casted.rb
 - lib/arel/nodes/count.rb
 - lib/arel/nodes/delete_statement.rb
 - lib/arel/nodes/descending.rb
@@ -104,6 +119,7 @@
 - lib/arel/nodes/node.rb
 - lib/arel/nodes/outer_join.rb
 - lib/arel/nodes/over.rb
+- lib/arel/nodes/regexp.rb
 - lib/arel/nodes/right_outer_join.rb
 - lib/arel/nodes/select_core.rb
 - lib/arel/nodes/select_statement.rb
@@ -134,6 +150,7 @@
 - lib/arel/visitors/mssql.rb
 - lib/arel/visitors/mysql.rb
 - lib/arel/visitors/oracle.rb
+- lib/arel/visitors/oracle12.rb
 - lib/arel/visitors/postgresql.rb
 - lib/arel/visitors/reduce.rb
 - lib/arel/visitors/sqlite.rb
@@ -163,9 +180,8 @@
       version: '0'
 requirements: []
 rubyforge_project: 
-rubygems_version: 2.4.7
+rubygems_version: 2.4.5.1
 signing_key: 
 specification_version: 4
 summary: Arel Really Exasperates Logicians  Arel is a SQL AST manager for Ruby
 test_files: []
-has_rdoc: 


Reply via email to