Class: SQLStatement::Update
Overview
Creates a statement of the form
UPDATE tables SET field=value, field2=value2 WHERE ...
This descends from SelectStatement. Even though the strings are very different, they have lots of other stuff in common.
Instance Attribute Summary
Attributes inherited from Select
#conditions, #distinct, #fields, #groupby, #orderby, #tables
Instance Method Summary collapse
Methods inherited from Select
#<<, #add_fields, #add_tables, #allfields, #initialize, newlists, #to_sqlpart
Constructor Details
This class inherits a constructor from SQLStatement::Select
Instance Method Details
#placeheld ⇒ Object
491 492 493 |
# File 'lib/sql/statement.rb', line 491 def placeheld (allfields.values+conditions).collect{|x| x.placeheld}.flatten end |
#to_s ⇒ Object
485 486 487 488 489 |
# File 'lib/sql/statement.rb', line 485 def to_s statement="UPDATE #{tables_s} SET #{updatepart_s}" v=conditions_s; statement << " WHERE "<< v if v statement end |