Class: SQLStatement::SelectCreate
Overview
Creates a statement of the form
CREATE [TEMPORARY] TABLE targettable SELECT ... FROM ... WHERE ...
Instance Attribute Summary collapse
-
#targettable ⇒ Object
The name of the table to create.
-
#temporary ⇒ Object
Indicates whether a temporary table (which automatically deletes itself when the connection to the database closes) should be created.
Attributes inherited from Select
#conditions, #distinct, #fields, #groupby, #orderby, #tables
Instance Method Summary collapse
-
#initialize(targettable, temporary = false) ⇒ SelectCreate
constructor
A new instance of SelectCreate.
- #to_s ⇒ Object
Methods inherited from Select
#<<, #add_fields, #add_tables, #allfields, newlists, #placeheld, #to_sqlpart
Constructor Details
#initialize(targettable, temporary = false) ⇒ SelectCreate
Returns a new instance of SelectCreate.
438 439 440 441 442 |
# File 'lib/sql/statement.rb', line 438 def initialize(targettable,temporary=false) super() @targettable=targettable @temporary=temporary end |
Instance Attribute Details
#targettable ⇒ Object
The name of the table to create.
431 432 433 |
# File 'lib/sql/statement.rb', line 431 def targettable @targettable end |
#temporary ⇒ Object
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.
436 437 438 |
# File 'lib/sql/statement.rb', line 436 def temporary @temporary end |
Instance Method Details
#to_s ⇒ Object
444 445 446 |
# File 'lib/sql/statement.rb', line 444 def to_s "CREATE #{ @temporary ? 'TEMPORARY':''} TABLE #{@targettable.to_sqlpart} #{super}" end |