Method: Rhom::RhomDbAdapter.update_into_table

Defined in:
lib/rhom/rhom_db_adapter.rb

.update_into_table(table = nil, values = nil, condition = nil) ⇒ Object

updates values (hash) in a given table which satisfy condition (hash) example usage is the following: update_into_table(‘object_values’,“value”=>“Electronics”,“attrib”=>“industry”) this executes the following sql: update table object_values set value=‘Electronics’ where object=‘some-object’ and attrib=‘industry’;



238
239
240
241
242
243
244
245
# File 'lib/rhom/rhom_db_adapter.rb', line 238

def update_into_table(table=nil,values=nil,condition=nil)
  query = nil
  vals = values.nil? ? nil : vals_str(values)
  if table and condition and vals
    query = "update #{table} set #{vals} where #{where_str(condition)}"
  end
  execute_sql query
end