Module: Ronin::SQL::Clauses
Overview
Methods for creating common SQL Clauses.
Instance Method Summary collapse
-
#clause(keyword, argument = nil) {|(clause)| ... } ⇒ self
Appends an arbitrary clause.
-
#clauses ⇒ Array<Clause>
The defined clauses of the statement.
-
#default_values ⇒ self
Appends a
DEFAULT VALUES
clause. -
#from(table = nil, &block) ⇒ self
Appends a
FROM
clause. -
#full_join(table = nil, &block) ⇒ self
Appends a
FULL JOIN
clause. -
#group_by(*columns, &block) ⇒ self
Appends a
GROUP BY
clause. -
#having(&block) ⇒ self
Appends a
HAVING
clause. -
#indexed_by(name, &block) ⇒ self
Appends a
INDEXED BY
clause. -
#inner_join(table = nil, &block) ⇒ self
Appends a
INNER JOIN
clause. -
#into(table) ⇒ self
Appends a
INTO
clause. -
#join(table = nil, &block) ⇒ self
Appends a
JOIN
clause. -
#left_join(table = nil, &block) ⇒ self
Appends a
LEFT JOIN
clause. -
#limit(value, &block) ⇒ self
Appends a
LIMIT
clause. -
#not_indexed ⇒ self
Appends a
NOT INDEXED
clause. -
#offset(value, &block) ⇒ self
Appends a
OFFSET
clause. -
#on(&block) ⇒ self
Appends a
ON
clause. -
#right_join(table = nil, &block) ⇒ self
Appends a
RIGHT JOIN
clause. -
#set(values = {}) ⇒ self
Appends a
SET
clause. -
#top(value, &block) ⇒ self
Appends a
TOP
clause. -
#union(&block) ⇒ self
Appends a
UNION
clause. -
#union_all(&block) ⇒ self
Appends a
UNION ALL
clause. -
#values(*values) ⇒ self
Appends a
VALUES
clause. -
#where(&block) ⇒ self
Appends a
WHERE
clause.
Instance Method Details
#clause(keyword, argument = nil) {|(clause)| ... } ⇒ self
Appends an arbitrary clause.
59 60 61 62 |
# File 'lib/ronin/sql/clauses.rb', line 59 def clause(keyword,argument=nil,&block) clauses << Clause.new(keyword,argument,&block) return self end |
#clauses ⇒ Array<Clause>
The defined clauses of the statement.
37 38 39 |
# File 'lib/ronin/sql/clauses.rb', line 37 def clauses @clauses ||= [] end |
#default_values ⇒ self
Appends a DEFAULT VALUES
clause.
272 273 274 |
# File 'lib/ronin/sql/clauses.rb', line 272 def default_values clause([:DEFAULT, :VALUES]) end |
#from(table = nil, &block) ⇒ self
Appends a FROM
clause.
72 73 74 |
# File 'lib/ronin/sql/clauses.rb', line 72 def from(table=nil,&block) clause(:FROM,table,&block) end |
#full_join(table = nil, &block) ⇒ self
Appends a FULL JOIN
clause.
153 154 155 |
# File 'lib/ronin/sql/clauses.rb', line 153 def full_join(table=nil,&block) clause([:FULL, :JOIN],table,&block) end |
#group_by(*columns, &block) ⇒ self
Appends a GROUP BY
clause.
194 195 196 |
# File 'lib/ronin/sql/clauses.rb', line 194 def group_by(*columns,&block) clause([:GROUP, :BY],columns,&block) end |
#having(&block) ⇒ self
Appends a HAVING
clause.
203 204 205 |
# File 'lib/ronin/sql/clauses.rb', line 203 def having(&block) clause(:HAVING,&block) end |
#indexed_by(name, &block) ⇒ self
Appends a INDEXED BY
clause.
296 297 298 |
# File 'lib/ronin/sql/clauses.rb', line 296 def indexed_by(name,&block) clause([:INDEXED, :BY],name,&block) end |
#inner_join(table = nil, &block) ⇒ self
Appends a INNER JOIN
clause.
117 118 119 |
# File 'lib/ronin/sql/clauses.rb', line 117 def inner_join(table=nil,&block) clause([:INNER, :JOIN],table,&block) end |
#into(table) ⇒ self
Appends a INTO
clause.
84 85 86 |
# File 'lib/ronin/sql/clauses.rb', line 84 def into(table=nil,&block) clause(:INTO,table,&block) end |
#join(table = nil, &block) ⇒ self
Appends a JOIN
clause.
105 106 107 |
# File 'lib/ronin/sql/clauses.rb', line 105 def join(table=nil,&block) clause(:JOIN,table,&block) end |
#left_join(table = nil, &block) ⇒ self
Appends a LEFT JOIN
clause.
129 130 131 |
# File 'lib/ronin/sql/clauses.rb', line 129 def left_join(table=nil,&block) clause([:LEFT, :JOIN],table,&block) end |
#limit(value, &block) ⇒ self
Appends a LIMIT
clause.
215 216 217 |
# File 'lib/ronin/sql/clauses.rb', line 215 def limit(value,&block) clause(:LIMIT,value,&block) end |
#not_indexed ⇒ self
Appends a NOT INDEXED
clause.
305 306 307 |
# File 'lib/ronin/sql/clauses.rb', line 305 def not_indexed clause([:NOT, :INDEXED]) end |
#offset(value, &block) ⇒ self
Appends a OFFSET
clause.
227 228 229 |
# File 'lib/ronin/sql/clauses.rb', line 227 def offset(value,&block) clause(:OFFSET,value,&block) end |
#on(&block) ⇒ self
Appends a ON
clause.
162 163 164 |
# File 'lib/ronin/sql/clauses.rb', line 162 def on(&block) clause(:ON,&block) end |
#right_join(table = nil, &block) ⇒ self
Appends a RIGHT JOIN
clause.
141 142 143 |
# File 'lib/ronin/sql/clauses.rb', line 141 def right_join(table=nil,&block) clause([:RIGHT, :JOIN],table,&block) end |
#set(values = {}) ⇒ self
Appends a SET
clause.
284 285 286 |
# File 'lib/ronin/sql/clauses.rb', line 284 def set(values={}) clause(:SET,values) end |
#top(value, &block) ⇒ self
Appends a TOP
clause.
239 240 241 |
# File 'lib/ronin/sql/clauses.rb', line 239 def top(value,&block) clause(:TOP,value,&block) end |
#union(&block) ⇒ self
Appends a UNION
clause.
171 172 173 |
# File 'lib/ronin/sql/clauses.rb', line 171 def union(&block) clause(:UNION,&block) end |
#union_all(&block) ⇒ self
Appends a UNION ALL
clause.
182 183 184 |
# File 'lib/ronin/sql/clauses.rb', line 182 def union_all(&block) clause([:UNION, :ALL],&block) end |
#values(*values) ⇒ self
Appends a VALUES
clause.
263 264 265 |
# File 'lib/ronin/sql/clauses.rb', line 263 def values(*values) clause(:VALUES,values) end |
#where(&block) ⇒ self
Appends a WHERE
clause.
93 94 95 |
# File 'lib/ronin/sql/clauses.rb', line 93 def where(&block) clause(:WHERE,&block) end |