Class: Exwiw::QueryAst::Select

Inherits:
Object
  • Object
show all
Defined in:
lib/exwiw/query_ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSelect

Returns a new instance of Select.



50
51
52
53
54
55
56
# File 'lib/exwiw/query_ast.rb', line 50

def initialize
  @from_table_name = nil
  @columns = []
  @where_clauses = []
  @join_clauses = []
  @select_all = false
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



48
49
50
# File 'lib/exwiw/query_ast.rb', line 48

def columns
  @columns
end

#from_table_nameObject (readonly)

Returns the value of attribute from_table_name.



48
49
50
# File 'lib/exwiw/query_ast.rb', line 48

def from_table_name
  @from_table_name
end

#join_clausesObject (readonly)

Returns the value of attribute join_clauses.



48
49
50
# File 'lib/exwiw/query_ast.rb', line 48

def join_clauses
  @join_clauses
end

#select_allObject (readonly)

Returns the value of attribute select_all.



48
49
50
# File 'lib/exwiw/query_ast.rb', line 48

def select_all
  @select_all
end

#where_clausesObject (readonly)

Returns the value of attribute where_clauses.



48
49
50
# File 'lib/exwiw/query_ast.rb', line 48

def where_clauses
  @where_clauses
end

Instance Method Details

#from(table) ⇒ Object



58
59
60
# File 'lib/exwiw/query_ast.rb', line 58

def from(table)
  @from_table_name = table
end

#join(join_clause) ⇒ Object



74
75
76
# File 'lib/exwiw/query_ast.rb', line 74

def join(join_clause)
  @join_clauses << join_clause
end

#select(columns) ⇒ Object



62
63
64
# File 'lib/exwiw/query_ast.rb', line 62

def select(columns)
  @columns = map_column_value(columns)
end

#select_all!Object



66
67
68
# File 'lib/exwiw/query_ast.rb', line 66

def select_all!
  @select_all = true
end

#where(where_clause) ⇒ Object



70
71
72
# File 'lib/exwiw/query_ast.rb', line 70

def where(where_clause)
  @where_clauses << where_clause
end