arel 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "arel"
5
- s.version = "3.0.0.20120112113618"
5
+ s.version = "3.0.1.20120220180444"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Aaron Patterson", "Bryan Halmkamp", "Emilio Tagua", "Nick Kallen"]
9
- s.date = "2012-01-12"
9
+ s.date = "2012-02-21"
10
10
  s.description = "Arel is a SQL AST manager for Ruby. It\n\n1. Simplifies the generation of complex SQL queries\n2. Adapts to various RDBMS systems\n\nIt is intended to be a framework framework; that is, you can build your own ORM\nwith it, focusing on innovative object and collection modeling as opposed to\ndatabase compatibility and query generation."
11
11
  s.email = ["aaron@tenderlovemaking.com", "bryan@brynary.com", "miloops@gmail.com", "nick@example.org"]
12
12
  s.extra_rdoc_files = ["History.txt", "MIT-LICENSE.txt", "Manifest.txt", "README.markdown"]
@@ -23,14 +23,17 @@ Gem::Specification.new do |s|
23
23
  s.specification_version = 3
24
24
 
25
25
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
- s.add_development_dependency(%q<hoe>, ["~> 2.12"])
26
+ s.add_development_dependency(%q<minitest>, ["~> 2.11"])
27
27
  s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
28
+ s.add_development_dependency(%q<hoe>, ["~> 2.13"])
28
29
  else
29
- s.add_dependency(%q<hoe>, ["~> 2.12"])
30
+ s.add_dependency(%q<minitest>, ["~> 2.11"])
30
31
  s.add_dependency(%q<rdoc>, ["~> 3.10"])
32
+ s.add_dependency(%q<hoe>, ["~> 2.13"])
31
33
  end
32
34
  else
33
- s.add_dependency(%q<hoe>, ["~> 2.12"])
35
+ s.add_dependency(%q<minitest>, ["~> 2.11"])
34
36
  s.add_dependency(%q<rdoc>, ["~> 3.10"])
37
+ s.add_dependency(%q<hoe>, ["~> 2.13"])
35
38
  end
36
39
  end
@@ -33,7 +33,7 @@ require 'arel/sql_literal'
33
33
  ####
34
34
 
35
35
  module Arel
36
- VERSION = '3.0.0'
36
+ VERSION = '3.0.1'
37
37
 
38
38
  def self.sql raw_sql
39
39
  Arel::Nodes::SqlLiteral.new raw_sql
@@ -39,7 +39,7 @@ module Arel
39
39
  def each &block
40
40
  return enum_for(:each) unless block_given?
41
41
 
42
- Visitors::DepthFirst.new(block).accept self
42
+ ::Arel::Visitors::DepthFirst.new(block).accept self
43
43
  end
44
44
  end
45
45
  end
@@ -6,5 +6,8 @@ module Arel
6
6
  include Arel::AliasPredication
7
7
  include Arel::OrderPredications
8
8
  end
9
+
10
+ class BindParam < SqlLiteral
11
+ end
9
12
  end
10
13
  end
@@ -109,6 +109,7 @@ module Arel
109
109
  alias :visit_Arel_Nodes_Lock :terminal
110
110
  alias :visit_Arel_Nodes_Node :terminal
111
111
  alias :visit_Arel_Nodes_SqlLiteral :terminal
112
+ alias :visit_Arel_Nodes_BindParam :terminal
112
113
  alias :visit_Arel_SqlLiteral :terminal
113
114
  alias :visit_BigDecimal :terminal
114
115
  alias :visit_Bignum :terminal
@@ -65,6 +65,7 @@ module Arel
65
65
  visit_edge o, "expr"
66
66
  end
67
67
  alias :visit_Arel_Nodes_Group :unary
68
+ alias :visit_Arel_Nodes_BindParam :unary
68
69
  alias :visit_Arel_Nodes_Grouping :unary
69
70
  alias :visit_Arel_Nodes_Having :unary
70
71
  alias :visit_Arel_Nodes_Limit :unary
@@ -25,9 +25,8 @@ module Arel
25
25
  SELECT * FROM (
26
26
  SELECT raw_sql_.*, rownum raw_rnum_
27
27
  FROM (#{sql}) raw_sql_
28
- WHERE rownum <= #{offset.expr.to_i + limit}
29
28
  )
30
- WHERE #{visit offset}
29
+ WHERE raw_rnum_ between #{offset.expr.to_i + 1 } and #{offset.expr.to_i + limit}
31
30
  eosql
32
31
  end
33
32
 
@@ -374,6 +374,7 @@ key on UpdateManager using UpdateManager#key=
374
374
 
375
375
  def literal o; o end
376
376
 
377
+ alias :visit_Arel_Nodes_BindParam :literal
377
378
  alias :visit_Arel_Nodes_SqlLiteral :literal
378
379
  alias :visit_Arel_SqlLiteral :literal # This is deprecated
379
380
  alias :visit_Bignum :literal
@@ -11,6 +11,7 @@ module Arel
11
11
  Nodes.const_get(k)
12
12
  }.grep(Class).each do |klass|
13
13
  next if Nodes::SqlLiteral == klass
14
+ next if Nodes::BindParam == klass
14
15
  next if klass.name =~ /^Arel::Nodes::Test/
15
16
  assert klass.ancestors.include?(Nodes::Node), klass.name
16
17
  end
@@ -102,9 +102,8 @@ module Arel
102
102
  SELECT * FROM (
103
103
  SELECT raw_sql_.*, rownum raw_rnum_
104
104
  FROM (SELECT) raw_sql_
105
- WHERE rownum <= 20
106
105
  )
107
- WHERE raw_rnum_ > 10
106
+ WHERE raw_rnum_ between 11 and 20
108
107
  }
109
108
  end
110
109
 
@@ -9,6 +9,12 @@ module Arel
9
9
  @attr = @table[:id]
10
10
  end
11
11
 
12
+ it 'works with BindParams' do
13
+ node = Nodes::BindParam.new 'omg'
14
+ sql = @visitor.accept node
15
+ sql.must_be_like 'omg'
16
+ end
17
+
12
18
  it 'can define a dispatch method' do
13
19
  visited = false
14
20
  viz = Class.new(Arel::Visitors::Visitor) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arel
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,22 +12,22 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-01-12 00:00:00.000000000 Z
15
+ date: 2012-02-21 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
- name: hoe
19
- requirement: &70284393537020 !ruby/object:Gem::Requirement
18
+ name: minitest
19
+ requirement: &70143007281780 !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
22
  - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: '2.12'
24
+ version: '2.11'
25
25
  type: :development
26
26
  prerelease: false
27
- version_requirements: *70284393537020
27
+ version_requirements: *70143007281780
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rdoc
30
- requirement: &70284393837600 !ruby/object:Gem::Requirement
30
+ requirement: &70143007268400 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ~>
@@ -35,7 +35,18 @@ dependencies:
35
35
  version: '3.10'
36
36
  type: :development
37
37
  prerelease: false
38
- version_requirements: *70284393837600
38
+ version_requirements: *70143007268400
39
+ - !ruby/object:Gem::Dependency
40
+ name: hoe
41
+ requirement: &70143007266480 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: '2.13'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: *70143007266480
39
50
  description: ! 'Arel is a SQL AST manager for Ruby. It
40
51
 
41
52