Class: OrientDB::SQL::Update

Inherits:
Object
  • Object
show all
Includes:
ClassClusterParametersMixin, ConditionsParametersMixin, FieldsValuesParametersMixin, UtilsMixin
Defined in:
lib/orientdb/sql/update.rb

Instance Method Summary collapse

Methods included from ConditionsParametersMixin

#and, #and_not, #or, #or_not, #where, #where!

Methods included from FieldsValuesParametersMixin

#fields, #fields!, #values, #values!

Methods included from ClassClusterParametersMixin

#cluster, #oclass

Methods included from UtilsMixin

#field_name, #quote, #quote_regexp, #quote_string, #select_single_string

Constructor Details

#initializeUpdate

Returns a new instance of Update.



9
10
11
12
13
14
15
16
# File 'lib/orientdb/sql/update.rb', line 9

def initialize
  @oclass     = nil
  @cluster    = nil
  @action     = "SET"
  @fields     = []
  @values     = []
  @conditions = []
end

Instance Method Details

#action(new_action) ⇒ Object Also known as: action!



18
19
20
21
# File 'lib/orientdb/sql/update.rb', line 18

def action(new_action)
  @action = new_action.to_s.upcase
  self
end

#to_sObject



25
26
27
# File 'lib/orientdb/sql/update.rb', line 25

def to_s
  (target_sql(:update) + fields_sql + conditions_sql).strip
end

#to_sql_commandObject



29
30
31
# File 'lib/orientdb/sql/update.rb', line 29

def to_sql_command
  OrientDB::SQLCommand.new to_s
end