| Class | Update |
| In: |
lib/update.rb
|
| Parent: | SqlStatement |
Returns an Update instance with the set values appended to the SQL statement.
update = Update[:table1].set[:column1=>'book', :column2=>10] update.to_sql #=> "update table1 set column1 = 'book, column2 = 10"
# File lib/update.rb, line 30
30: def [](hash)
31: @to_sql += " set "
32: set_args = []
33: hash.each_pair do |col, val|
34: set_args << "#{col.to_sql}=#{val.to_sql}"
35: end
36: @to_sql += set_args.sort.join(', ')
37: self
38: end