diff options
author | Rafael Mendonça França <rafael.franca@plataformatec.com.br> | 2014-02-05 18:40:52 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafael.franca@plataformatec.com.br> | 2014-02-10 19:44:00 -0200 |
commit | a7d06943dd54b2d16d63b2b9a67bb97820c7c8d3 (patch) | |
tree | 333441e0f6cfe242922baa3f3bc03de5593fa52e | |
parent | f4ab6a39be5c4743ed1dc5605c65688a67dfa42b (diff) | |
download | rails-a7d06943dd54b2d16d63b2b9a67bb97820c7c8d3.tar.gz rails-a7d06943dd54b2d16d63b2b9a67bb97820c7c8d3.tar.bz2 rails-a7d06943dd54b2d16d63b2b9a67bb97820c7c8d3.zip |
Remove deprecated Arel::SqlLiteral
-rw-r--r-- | lib/arel.rb | 5 | ||||
-rw-r--r-- | lib/arel/insert_manager.rb | 2 | ||||
-rw-r--r-- | lib/arel/select_manager.rb | 2 | ||||
-rw-r--r-- | lib/arel/sql_literal.rb | 4 | ||||
-rw-r--r-- | lib/arel/visitors/depth_first.rb | 1 | ||||
-rw-r--r-- | lib/arel/visitors/dot.rb | 1 | ||||
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 1 | ||||
-rw-r--r-- | test/test_select_manager.rb | 20 | ||||
-rw-r--r-- | test/test_table.rb | 6 |
9 files changed, 15 insertions, 27 deletions
diff --git a/lib/arel.rb b/lib/arel.rb index 38cb47de5a..a2a358892f 100644 --- a/lib/arel.rb +++ b/lib/arel.rb @@ -24,11 +24,6 @@ require 'arel/update_manager' require 'arel/delete_manager' require 'arel/nodes' - -#### these are deprecated -require 'arel/sql_literal' -#### - module Arel VERSION = '5.0.0' diff --git a/lib/arel/insert_manager.rb b/lib/arel/insert_manager.rb index d6a11b7be0..b5d2aeb3a4 100644 --- a/lib/arel/insert_manager.rb +++ b/lib/arel/insert_manager.rb @@ -17,7 +17,7 @@ module Arel return if fields.empty? if String === fields - @ast.values = SqlLiteral.new(fields) + @ast.values = Nodes::SqlLiteral.new(fields) else @ast.relation ||= fields.first.first.relation diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb index f251d0d09e..e3d8792aca 100644 --- a/lib/arel/select_manager.rb +++ b/lib/arel/select_manager.rb @@ -130,7 +130,7 @@ module Arel # FIXME: converting these to SQLLiterals is probably not good, but # rails tests require it. @ctx.projections.concat projections.map { |x| - STRING_OR_SYMBOL_CLASS.include?(x.class) ? SqlLiteral.new(x.to_s) : x + STRING_OR_SYMBOL_CLASS.include?(x.class) ? Nodes::SqlLiteral.new(x.to_s) : x } self end diff --git a/lib/arel/sql_literal.rb b/lib/arel/sql_literal.rb deleted file mode 100644 index 5cb4973117..0000000000 --- a/lib/arel/sql_literal.rb +++ /dev/null @@ -1,4 +0,0 @@ -module Arel - class SqlLiteral < Nodes::SqlLiteral - end -end diff --git a/lib/arel/visitors/depth_first.rb b/lib/arel/visitors/depth_first.rb index 67cdecfa36..18bd81fb9c 100644 --- a/lib/arel/visitors/depth_first.rb +++ b/lib/arel/visitors/depth_first.rb @@ -112,7 +112,6 @@ module Arel alias :visit_Arel_Nodes_SqlLiteral :terminal alias :visit_Arel_Nodes_BindParam :terminal alias :visit_Arel_Nodes_Window :terminal - alias :visit_Arel_SqlLiteral :terminal alias :visit_BigDecimal :terminal alias :visit_Bignum :terminal alias :visit_Class :terminal diff --git a/lib/arel/visitors/dot.rb b/lib/arel/visitors/dot.rb index 82b8c771e4..cb4c2d494c 100644 --- a/lib/arel/visitors/dot.rb +++ b/lib/arel/visitors/dot.rb @@ -193,7 +193,6 @@ module Arel alias :visit_NilClass :visit_String alias :visit_TrueClass :visit_String alias :visit_FalseClass :visit_String - alias :visit_Arel_SqlLiteral :visit_String alias :visit_Arel_Nodes_BindParam :visit_String alias :visit_Fixnum :visit_String alias :visit_BigDecimal :visit_String diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 554f98da14..bd0cd8f03c 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -550,7 +550,6 @@ module Arel alias :visit_Arel_Nodes_BindParam :literal alias :visit_Arel_Nodes_SqlLiteral :literal - alias :visit_Arel_SqlLiteral :literal # This is deprecated alias :visit_Bignum :literal alias :visit_Fixnum :literal diff --git a/test/test_select_manager.rb b/test/test_select_manager.rb index 6d0407c65c..c1575a7929 100644 --- a/test/test_select_manager.rb +++ b/test/test_select_manager.rb @@ -33,7 +33,7 @@ module Arel it 'accepts symbols' do table = Table.new :users manager = Arel::SelectManager.new Table.engine - manager.project SqlLiteral.new '*' + manager.project Nodes::SqlLiteral.new '*' manager.from table manager.order :foo manager.to_sql.must_be_like %{ SELECT * FROM "users" ORDER BY foo } @@ -224,7 +224,7 @@ module Arel it 'should create an exists clause' do table = Table.new(:users) manager = Arel::SelectManager.new Table.engine, table - manager.project SqlLiteral.new '*' + manager.project Nodes::SqlLiteral.new '*' m2 = Arel::SelectManager.new(manager.engine) m2.project manager.exists m2.to_sql.must_be_like %{ SELECT EXISTS (#{manager.to_sql}) } @@ -233,7 +233,7 @@ module Arel it 'can be aliased' do table = Table.new(:users) manager = Arel::SelectManager.new Table.engine, table - manager.project SqlLiteral.new '*' + manager.project Nodes::SqlLiteral.new '*' m2 = Arel::SelectManager.new(manager.engine) m2.project manager.exists.as('foo') m2.to_sql.must_be_like %{ SELECT EXISTS (#{manager.to_sql}) AS foo } @@ -413,7 +413,7 @@ module Arel it 'generates order clauses' do table = Table.new :users manager = Arel::SelectManager.new Table.engine - manager.project SqlLiteral.new '*' + manager.project Nodes::SqlLiteral.new '*' manager.from table manager.order table[:id] manager.to_sql.must_be_like %{ @@ -425,7 +425,7 @@ module Arel it 'takes *args' do table = Table.new :users manager = Arel::SelectManager.new Table.engine - manager.project SqlLiteral.new '*' + manager.project Nodes::SqlLiteral.new '*' manager.from table manager.order table[:id], table[:name] manager.to_sql.must_be_like %{ @@ -442,7 +442,7 @@ module Arel it 'has order attributes' do table = Table.new :users manager = Arel::SelectManager.new Table.engine - manager.project SqlLiteral.new '*' + manager.project Nodes::SqlLiteral.new '*' manager.from table manager.order table[:id].desc manager.to_sql.must_be_like %{ @@ -453,7 +453,7 @@ module Arel it 'has order attributes for expressions' do table = Table.new :users manager = Arel::SelectManager.new Table.engine - manager.project SqlLiteral.new '*' + manager.project Nodes::SqlLiteral.new '*' manager.from table manager.order table[:id].count.desc manager.to_sql.must_be_like %{ @@ -873,7 +873,7 @@ module Arel manager = Arel::SelectManager.new Table.engine manager.from table manager.take 1 - stmt = manager.compile_update(SqlLiteral.new('foo = bar'), Arel::Attributes::Attribute.new(table, 'id')) + stmt = manager.compile_update(Nodes::SqlLiteral.new('foo = bar'), Arel::Attributes::Attribute.new(table, 'id')) stmt.key = table['id'] stmt.to_sql.must_be_like %{ @@ -887,7 +887,7 @@ module Arel manager = Arel::SelectManager.new Table.engine manager.from table manager.order :foo - stmt = manager.compile_update(SqlLiteral.new('foo = bar'), Arel::Attributes::Attribute.new(table, 'id')) + stmt = manager.compile_update(Nodes::SqlLiteral.new('foo = bar'), Arel::Attributes::Attribute.new(table, 'id')) stmt.key = table['id'] stmt.to_sql.must_be_like %{ @@ -900,7 +900,7 @@ module Arel table = Table.new :users manager = Arel::SelectManager.new Table.engine manager.from table - stmt = manager.compile_update(SqlLiteral.new('foo = bar'), Arel::Attributes::Attribute.new(table, 'id')) + stmt = manager.compile_update(Nodes::SqlLiteral.new('foo = bar'), Arel::Attributes::Attribute.new(table, 'id')) stmt.to_sql.must_be_like %{ UPDATE "users" SET foo = bar } end diff --git a/test/test_table.rb b/test/test_table.rb index 5db8cdd6c0..2c1683b4ce 100644 --- a/test/test_table.rb +++ b/test/test_table.rb @@ -130,19 +130,19 @@ module Arel describe 'take' do it "should add a limit" do manager = @relation.take 1 - manager.project SqlLiteral.new '*' + manager.project Nodes::SqlLiteral.new '*' manager.to_sql.must_be_like %{ SELECT * FROM "users" LIMIT 1 } end end describe 'project' do it 'can project' do - manager = @relation.project SqlLiteral.new '*' + manager = @relation.project Nodes::SqlLiteral.new '*' manager.to_sql.must_be_like %{ SELECT * FROM "users" } end it 'takes multiple parameters' do - manager = @relation.project SqlLiteral.new('*'), SqlLiteral.new('*') + manager = @relation.project Nodes::SqlLiteral.new('*'), Nodes::SqlLiteral.new('*') manager.to_sql.must_be_like %{ SELECT *, * FROM "users" } end end |