aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/crud.rb34
-rw-r--r--lib/arel/select_manager.rb38
-rw-r--r--lib/arel/visitors/to_sql.rb12
3 files changed, 2 insertions, 82 deletions
diff --git a/lib/arel/crud.rb b/lib/arel/crud.rb
index e8e78a381c..ef14439a1f 100644
--- a/lib/arel/crud.rb
+++ b/lib/arel/crud.rb
@@ -10,6 +10,7 @@ module Arel
else
relation = values.first.first.relation
end
+ um.key= relation.primary_key
um.table relation
um.set values
um.take @ast.limit.expr if @ast.limit
@@ -18,19 +19,6 @@ module Arel
um
end
- # FIXME: this method should go away
- def update values
- if $VERBOSE
- warn <<-eowarn
-update (#{caller.first}) is deprecated and will be removed in Arel 4.0.0. Please
-switch to `compile_update`
- eowarn
- end
-
- um = compile_update values
- @engine.connection.update um.to_sql, 'AREL'
- end
-
def compile_insert values
im = create_insert
im.insert values
@@ -41,17 +29,6 @@ switch to `compile_update`
InsertManager.new @engine
end
- # FIXME: this method should go away
- def insert values
- if $VERBOSE
- warn <<-eowarn
-insert (#{caller.first}) is deprecated and will be removed in Arel 4.0.0. Please
-switch to `compile_insert`
- eowarn
- end
- @engine.connection.insert compile_insert(values).to_sql
- end
-
def compile_delete
dm = DeleteManager.new @engine
dm.wheres = @ctx.wheres
@@ -59,14 +36,5 @@ switch to `compile_insert`
dm
end
- def delete
- if $VERBOSE
- warn <<-eowarn
-delete (#{caller.first}) is deprecated and will be removed in Arel 4.0.0. Please
-switch to `compile_delete`
- eowarn
- end
- @engine.connection.delete compile_delete.to_sql, 'AREL'
- end
end
end
diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb
index ee9d34a514..60df12c700 100644
--- a/lib/arel/select_manager.rb
+++ b/lib/arel/select_manager.rb
@@ -47,14 +47,6 @@ module Arel
create_table_alias grouping(@ast), Nodes::SqlLiteral.new(other)
end
- def where_clauses
- if $VERBOSE
- warn "(#{caller.first}) where_clauses is deprecated and will be removed in arel 4.0.0 with no replacement"
- end
- to_sql = Visitors::ToSql.new @engine.connection
- @ctx.wheres.map { |c| to_sql.accept c }
- end
-
def lock locking = Arel.sql('FOR UPDATE')
case locking
when true
@@ -169,11 +161,6 @@ module Arel
@ast.orders
end
- def wheres
- warn "#{caller[0]}: SelectManager#wheres is deprecated and will be removed in Arel 4.0.0 with no replacement"
- Compatibility::Wheres.new @engine.connection, @ctx.wheres
- end
-
def where_sql
return if @ctx.wheres.empty?
@@ -272,31 +259,6 @@ module Arel
@engine.connection.send(:select, to_sql, 'AREL').map { |x| Row.new(x) }
end
- # FIXME: this method should go away
- def insert values
- if $VERBOSE
- warn <<-eowarn
-insert (#{caller.first}) is deprecated and will be removed in Arel 4.0.0. Please
-switch to `compile_insert`
- eowarn
- end
-
- im = compile_insert(values)
- table = @ctx.froms
-
- primary_key = table.primary_key
- primary_key_name = primary_key.name if primary_key
-
- # FIXME: in AR tests values sometimes were Array and not Hash therefore is_a?(Hash) check is added
- primary_key_value = primary_key && values.is_a?(Hash) && values[primary_key]
- im.into table
- # Oracle adapter needs primary key name to generate RETURNING ... INTO ... clause
- # for tables which assign primary key value using trigger.
- # RETURNING ... INTO ... clause will be added only if primary_key_value is nil
- # therefore it is necessary to pass primary key value as well
- @engine.connection.insert im.to_sql, 'AREL', primary_key_name, primary_key_value
- end
-
private
def collapse exprs, existing = nil
exprs = exprs.unshift(existing.expr) if existing
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb
index b61d5f7acd..1d8cd35806 100644
--- a/lib/arel/visitors/to_sql.rb
+++ b/lib/arel/visitors/to_sql.rb
@@ -85,17 +85,7 @@ module Arel
if o.orders.empty? && o.limit.nil?
wheres = o.wheres
else
- key = o.key
- unless key
- warn(<<-eowarn) if $VERBOSE
-(#{caller.first}) Using UpdateManager without setting UpdateManager#key is
-deprecated and support will be removed in Arel 4.0.0. Please set the primary
-key on UpdateManager using UpdateManager#key= '#{key.inspect}'
- eowarn
- key = o.relation.primary_key
- end
-
- wheres = [Nodes::In.new(key, [build_subselect(key, o)])]
+ wheres = [Nodes::In.new(o.key, [build_subselect(o.key, o)])]
end
[