Class: Ronin::SQL::StatementList
- Inherits:
-
Object
- Object
- Ronin::SQL::StatementList
- Includes:
- Emittable, Fields, Functions, Statements
- Defined in:
- lib/ronin/sql/statement_list.rb
Overview
Represents a list of SQL Statement.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#statements ⇒ Object
readonly
The list of statements.
Instance Method Summary collapse
-
#<<(statement) ⇒ self
Appends a statement.
-
#initialize {|(statements)| ... } ⇒ StatementList
constructor
Initializes a new SQL statement list.
-
#statement(keyword, argument = nil) {|(statement)| ... } ⇒ Statement
Appends an arbitrary statement.
Methods included from Emittable
#emitter, #inspect, #to_s, #to_sql
Methods included from Statements
#delete, #drop_table, #insert, #select, #update
Methods included from Functions
#abs, #acos, #ascii, #asin, #atan, #atan2, #avg, #bin, #bit_and, #bit_count, #bit_length, #bit_or, #ceil, #ceiling, #char, #char_length, #character_length, #concat, #concat_ws, #conv, #cos, #cot, #count, #degrees, #elt, #exp, #export_set, #field, #find_in_set, #floor, #format, #glob, #greatest, #hex, #insert, #instr, #interval, #lcase, #least, #left, #length, #like, #load_file, #locate, #log, #log10, #lower, #lpad, #ltrim, #make_set, #max, #mid, #min, #mod, #oct, #octet_length, #ord, #pi, #position, #pow, #power, #quote, #radians, #rand, #random, #repeat, #replace, #reverse, #right, #round, #rpad, #rtrim, #sign, #sin, #soundex, #space, #sqrt, #std, #stddev, #strcmp, #substring, #substring_index, #sum, #tan, #trim, #truncate, #ucase, #unhex, #upper
Methods included from Fields
#method_missing, #respond_to_missing?, #to_ary
Constructor Details
#initialize {|(statements)| ... } ⇒ StatementList
Initializes a new SQL statement list.
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/ronin/sql/statement_list.rb', line 60 def initialize(&block) @statements = [] if block case block.arity when 0 then instance_eval(&block) else block.call(self) end end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Ronin::SQL::Fields
Instance Attribute Details
#statements ⇒ Object (readonly)
The list of statements
47 48 49 |
# File 'lib/ronin/sql/statement_list.rb', line 47 def statements @statements end |
Instance Method Details
#<<(statement) ⇒ self
Appends a statement.
79 80 81 82 |
# File 'lib/ronin/sql/statement_list.rb', line 79 def <<(statement) @statements << statement return self end |
#statement(keyword, argument = nil) {|(statement)| ... } ⇒ Statement
Appends an arbitrary statement.
103 104 105 106 107 108 |
# File 'lib/ronin/sql/statement_list.rb', line 103 def statement(keyword,argument=nil,&block) new_statement = super self << new_statement return new_statement end |