Module: OrientDB::SQL::FieldsValuesParametersMixin

Included in:
Insert, Update
Defined in:
lib/orientdb/sql/common.rb

Instance Method Summary collapse

Instance Method Details

#fields(*args) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/orientdb/sql/common.rb', line 84

def fields(*args)
  args.each do |arg|
    case arg
      when String, Symbol, Integer
        @fields << field_name(arg)
      when Hash
        arg.each { |k, v| @fields << field_name(k); @values << quote(v) }
      when Array
        arg.each { |x| @fields << field_name(x) }
    end
  end
  self
end

#fields!(*args) ⇒ Object



98
99
100
101
102
# File 'lib/orientdb/sql/common.rb', line 98

def fields!(*args)
  @fields = []
  @values = []
  fields *args
end

#values(*args) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/orientdb/sql/common.rb', line 104

def values(*args)
  args.each do |arg|
    case arg
      when String, Symbol, Integer
        arg = quote(arg)
        @values << arg
      when Hash
        arg.each { |k, v| @fields << field_name(k); @values << quote(v) }
      when Array
        arg.each { |x| @values << quote(x) }
    end
  end
  self
end

#values!(*args) ⇒ Object



119
120
121
122
123
# File 'lib/orientdb/sql/common.rb', line 119

def values!(*args)
  @fields = []
  @values = []
  values *args
end