Class: SQLStatement::SelectCreate

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

Overview

Creates a statement of the form

CREATE [TEMPORARY] TABLE targettable SELECT ... FROM ... WHERE ...

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 create.



395
396
397
# File 'lib/sql/statement.rb', line 395

def targettable
  @targettable
end

#temporaryObject

Indicates whether a temporary table (which automatically deletes itself when the connection to the database closes) should be created. This may not be supported by all databases.



400
401
402
# File 'lib/sql/statement.rb', line 400

def temporary
  @temporary
end

Instance Method Details

#to_sObject



402
403
404
# File 'lib/sql/statement.rb', line 402

def to_s
   "CREATE #{ @temporary ? 'TEMPORARY ':''}TABLE #{@targettable.to_sqlpart} #{super}"
end