Class: Bmg::Sql::Relation
- Inherits:
-
Object
- Object
- Bmg::Sql::Relation
show all
- Includes:
- Relation
- Defined in:
- lib/bmg/sql/relation.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Relation
#_count, #count, #debug, empty, #empty?, new, #one, #one_or_nil, #to_csv, #to_json, #to_xlsx, #visit, #with_type, #with_type_attrlist, #with_typecheck, #without_typecheck, #y_by_x, #ys_by_x
Methods included from Algebra
#allbut, #autosummarize, #autowrap, #constants, #extend, #group, #image, #join, #left_join, #matching, #materialize, #minus, #not_matching, #page, #project, #rename, #restrict, #spied, #summarize, #transform, #ungroup, #union, #unspied, #unwrap
#cross_product, #exclude, #image, #images, #join, #left_join, #matching, #not_matching, #prefix, #rxmatch, #suffix, #ungroup, #unwrap, #where
Constructor Details
#initialize(type, builder, expr) ⇒ Relation
Returns a new instance of Relation.
6
7
8
9
10
|
# File 'lib/bmg/sql/relation.rb', line 6
def initialize(type, builder, expr)
@type = type
@builder = builder
@expr = expr
end
|
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
12
13
14
|
# File 'lib/bmg/sql/relation.rb', line 12
def type
@type
end
|
Instance Method Details
#bind(binding) ⇒ Object
20
21
22
23
24
|
# File 'lib/bmg/sql/relation.rb', line 20
def bind(binding)
expr = before_use(self.expr)
expr = Processor::Bind.new(binding, builder).call(expr)
_instance(type, builder, expr)
end
|
#delete(*args, &bl) ⇒ Object
30
31
32
|
# File 'lib/bmg/sql/relation.rb', line 30
def delete(*args, &bl)
raise NotImplementedError
end
|
#each(&bl) ⇒ Object
26
27
28
|
# File 'lib/bmg/sql/relation.rb', line 26
def each(&bl)
raise NotImplementedError
end
|
#insert(*args, &bl) ⇒ Object
34
35
36
|
# File 'lib/bmg/sql/relation.rb', line 34
def insert(*args, &bl)
raise NotImplementedError
end
|
#to_ast ⇒ Object
238
239
240
|
# File 'lib/bmg/sql/relation.rb', line 238
def to_ast
[:sql, to_sql]
end
|
#to_s ⇒ Object
Also known as:
inspect
242
243
244
|
# File 'lib/bmg/sql/relation.rb', line 242
def to_s
"(sql #{to_sql})"
end
|
#to_sql ⇒ Object
234
235
236
|
# File 'lib/bmg/sql/relation.rb', line 234
def to_sql
expr.to_sql("", Dialect.default)
end
|
#update(*args, &bl) ⇒ Object
38
39
40
|
# File 'lib/bmg/sql/relation.rb', line 38
def update(*args, &bl)
raise NotImplementedError
end
|