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.



78
79
80
81
82
83
84
# File 'lib/exwiw/query_ast.rb', line 78

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.



76
77
78
# File 'lib/exwiw/query_ast.rb', line 76

def columns
  @columns
end

#from_table_nameObject (readonly)

Returns the value of attribute from_table_name.



76
77
78
# File 'lib/exwiw/query_ast.rb', line 76

def from_table_name
  @from_table_name
end

#join_clausesObject (readonly)

Returns the value of attribute join_clauses.



76
77
78
# File 'lib/exwiw/query_ast.rb', line 76

def join_clauses
  @join_clauses
end

#select_allObject (readonly)

Returns the value of attribute select_all.



76
77
78
# File 'lib/exwiw/query_ast.rb', line 76

def select_all
  @select_all
end

#where_clausesObject (readonly)

Returns the value of attribute where_clauses.



76
77
78
# File 'lib/exwiw/query_ast.rb', line 76

def where_clauses
  @where_clauses
end

Instance Method Details

#from(table) ⇒ Object



86
87
88
# File 'lib/exwiw/query_ast.rb', line 86

def from(table)
  @from_table_name = table
end

#join(join_clause) ⇒ Object



102
103
104
# File 'lib/exwiw/query_ast.rb', line 102

def join(join_clause)
  @join_clauses << join_clause
end

#select(columns) ⇒ Object



90
91
92
# File 'lib/exwiw/query_ast.rb', line 90

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

#select_all!Object



94
95
96
# File 'lib/exwiw/query_ast.rb', line 94

def select_all!
  @select_all = true
end

#where(where_clause) ⇒ Object



98
99
100
# File 'lib/exwiw/query_ast.rb', line 98

def where(where_clause)
  @where_clauses << where_clause
end