Class: SQLStatement::SelectInsert

Inherits:
Select show all
Defined in:
lib/sql/statement.rb

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

Attributes inherited from Select

#distinct, #straight_join

Instance Method Summary collapse

Methods inherited from Select

#+, #<<, #allfields, #condition, #field, #groupby, #initialize, #leftjoin, newlists, #orderby, #placeheld, #table, #to_sqlpart

Constructor Details

This class inherits a constructor from SQLStatement::Select

Instance Attribute Details

#targettableObject

The name of the table to insert into.



412
413
414
# File 'lib/sql/statement.rb', line 412

def targettable
  @targettable
end

Instance Method Details

#to_sObject



414
415
416
# File 'lib/sql/statement.rb', line 414

def to_s
   "INSERT INTO #{@targettable.to_sqlpart} (#{names_s}) #{super}" 
end