Module: Rebel::SQLQ
- Defined in:
- lib/rebel/sql.rb
Instance Attribute Summary collapse
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
Instance Method Summary collapse
- #count(*n) ⇒ Object
- #create_table(table_name, desc) ⇒ Object
- #delete_from(table_name, where: nil, inner: nil, left: nil, right: nil) ⇒ Object
- #drop_table(table_name) ⇒ Object
- #exec(query) ⇒ Object
- #insert_into(table_name, *rows) ⇒ Object
- #join(table, on: nil) ⇒ Object
- #outer_join(table, on: nil) ⇒ Object
- #select(*fields, distinct: nil, from: nil, where: nil, inner: nil, left: nil, right: nil, group: nil, order: nil, limit: nil, offset: nil) ⇒ Object
- #truncate(table_name) ⇒ Object
- #update(table_name, set: nil, where: nil, inner: nil, left: nil, right: nil) ⇒ Object
Instance Attribute Details
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
4 5 6 |
# File 'lib/rebel/sql.rb', line 4 def conn @conn end |
Instance Method Details
#count(*n) ⇒ Object
48 49 50 |
# File 'lib/rebel/sql.rb', line 48 def count(*n) Rebel::SQL.count(*n) end |
#create_table(table_name, desc) ⇒ Object
10 11 12 |
# File 'lib/rebel/sql.rb', line 10 def create_table(table_name, desc) exec(Rebel::SQL.create_table(table_name, desc)) end |
#delete_from(table_name, where: nil, inner: nil, left: nil, right: nil) ⇒ Object
40 41 42 |
# File 'lib/rebel/sql.rb', line 40 def delete_from(table_name, where: nil, inner: nil, left: nil, right: nil) exec(Rebel::SQL.delete_from(table_name, where: where, inner: inner, left: left, right: right)) end |
#drop_table(table_name) ⇒ Object
14 15 16 |
# File 'lib/rebel/sql.rb', line 14 def drop_table(table_name) exec(Rebel::SQL.drop_table(table_name)) end |
#exec(query) ⇒ Object
6 7 8 |
# File 'lib/rebel/sql.rb', line 6 def exec(query) conn.exec(query) end |
#insert_into(table_name, *rows) ⇒ Object
32 33 34 |
# File 'lib/rebel/sql.rb', line 32 def insert_into(table_name, *rows) exec(Rebel::SQL.insert_into(table_name, *rows)) end |
#join(table, on: nil) ⇒ Object
52 53 54 |
# File 'lib/rebel/sql.rb', line 52 def join(table, on: nil) Rebel::SQL.join(table, on: on) end |
#outer_join(table, on: nil) ⇒ Object
56 57 58 |
# File 'lib/rebel/sql.rb', line 56 def outer_join(table, on: nil) Rebel::SQL.outer_join(table, on: on) end |
#select(*fields, distinct: nil, from: nil, where: nil, inner: nil, left: nil, right: nil, group: nil, order: nil, limit: nil, offset: nil) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rebel/sql.rb', line 18 def select(*fields, distinct: nil, from: nil, where: nil, inner: nil, left: nil, right: nil, group: nil, order: nil, limit: nil, offset: nil) exec(Rebel::SQL.select(*fields, distinct: distinct, from: from, where: where, inner: inner, left: left, right: right, group: group, order: order, limit: limit, offset: offset)) end |
#truncate(table_name) ⇒ Object
44 45 46 |
# File 'lib/rebel/sql.rb', line 44 def truncate(table_name) exec(Rebel::SQL.truncate(table_name)) end |
#update(table_name, set: nil, where: nil, inner: nil, left: nil, right: nil) ⇒ Object
36 37 38 |
# File 'lib/rebel/sql.rb', line 36 def update(table_name, set: nil, where: nil, inner: nil, left: nil, right: nil) exec(Rebel::SQL.update(table_name, set: set, where: where, inner: inner, left: left, right: right)) end |