Class: SQLStatement::SelectInsert
Overview
Creates a statement of the form
INSERT INTO targettable (fields) SELECT values FROM ... WHERE ...
(The generated sql statement may contain aliases in the SELECT clause. This should be harmless.)
Instance Attribute Summary collapse
-
#targettable ⇒ Object
The name of the table to insert into.
Attributes inherited from Select
#conditions, #distinct, #fields, #groupby, #orderby, #tables
Instance Method Summary collapse
-
#initialize(targettable) ⇒ SelectInsert
constructor
A new instance of SelectInsert.
- #to_s ⇒ Object
Methods inherited from Select
#<<, #add_fields, #add_tables, #allfields, newlists, #placeheld, #to_sqlpart
Constructor Details
#initialize(targettable) ⇒ SelectInsert
Returns a new instance of SelectInsert.
456 457 458 459 |
# File 'lib/sql/statement.rb', line 456 def initialize(targettable) super() @targettable=targettable end |
Instance Attribute Details
#targettable ⇒ Object
The name of the table to insert into.
454 455 456 |
# File 'lib/sql/statement.rb', line 454 def targettable @targettable end |
Instance Method Details
#to_s ⇒ Object
461 462 463 |
# File 'lib/sql/statement.rb', line 461 def to_s "INSERT INTO #{@targettable.to_sqlpart} #{names_s} #{super}" end |