2017-02-13 13:58:58 -05:00
|
|
|
# frozen_string_literal: true
|
2018-02-24 01:45:50 -05:00
|
|
|
|
2018-02-24 02:41:47 -05:00
|
|
|
module Arel # :nodoc: all
|
2010-08-13 18:30:22 -04:00
|
|
|
module Nodes
|
2010-11-29 17:30:06 -05:00
|
|
|
class InsertStatement < Arel::Nodes::Node
|
2014-04-10 10:08:37 -04:00
|
|
|
attr_accessor :relation, :columns, :values, :select
|
2010-08-13 18:30:22 -04:00
|
|
|
|
|
|
|
def initialize
|
2013-05-17 18:43:54 -04:00
|
|
|
super()
|
2010-08-13 18:30:22 -04:00
|
|
|
@relation = nil
|
|
|
|
@columns = []
|
2010-09-09 18:20:25 -04:00
|
|
|
@values = nil
|
2014-04-10 10:08:37 -04:00
|
|
|
@select = nil
|
2010-08-13 18:30:22 -04:00
|
|
|
end
|
2010-08-16 23:59:18 -04:00
|
|
|
|
2018-02-24 01:45:50 -05:00
|
|
|
def initialize_copy(other)
|
2010-08-16 23:59:18 -04:00
|
|
|
super
|
2010-08-30 18:35:13 -04:00
|
|
|
@columns = @columns.clone
|
2010-09-09 18:20:25 -04:00
|
|
|
@values = @values.clone if @values
|
2014-04-10 10:08:37 -04:00
|
|
|
@select = @select.clone if @select
|
2010-08-16 23:59:18 -04:00
|
|
|
end
|
2012-08-18 22:33:25 -04:00
|
|
|
|
|
|
|
def hash
|
2014-04-10 10:08:37 -04:00
|
|
|
[@relation, @columns, @values, @select].hash
|
2012-08-18 22:33:25 -04:00
|
|
|
end
|
|
|
|
|
2018-02-24 01:45:50 -05:00
|
|
|
def eql?(other)
|
2012-08-18 22:33:25 -04:00
|
|
|
self.class == other.class &&
|
|
|
|
self.relation == other.relation &&
|
|
|
|
self.columns == other.columns &&
|
2014-04-10 10:08:37 -04:00
|
|
|
self.select == other.select &&
|
2012-08-18 22:33:25 -04:00
|
|
|
self.values == other.values
|
|
|
|
end
|
|
|
|
alias :== :eql?
|
2010-08-13 18:30:22 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|