Module: Alf::Sql::SelectList

Includes:
Expr
Defined in:
lib/alf/sql/nodes/select_list.rb

Constant Summary

Constants included from Expr

Expr::AND, Expr::AS, Expr::COMMA, Expr::DOT, Expr::EQUAL, Expr::EXISTS, Expr::FALSE, Expr::GREATER, Expr::GREATER_OR_EQUAL, Expr::IN, Expr::LEFT_PARENTHESE, Expr::LESS, Expr::LESS_OR_EQUAL, Expr::NOT, Expr::NOT_EQUAL, Expr::OR, Expr::QUOTE, Expr::RIGHT_PARENTHESE, Expr::SPACE, Expr::TRUE

Instance Method Summary collapse

Methods included from Expr

#each_child, #join?, #limit_or_offset?, #ordering, #set_operator?, #with_insert, #with_push, #with_update

Instance Method Details

#desaliaserObject



6
7
8
9
10
11
# File 'lib/alf/sql/nodes/select_list.rb', line 6

def desaliaser
  ->(a){
    item = sexpr_body.find{|item| item.as_name.to_s == a.to_s }
    item && item.left
  }
end

#is_table_dee?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/alf/sql/nodes/select_list.rb', line 13

def is_table_dee?
  Builder::IS_TABLE_DEE == self
end

#knows?(as_name) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/alf/sql/nodes/select_list.rb', line 17

def knows?(as_name)
  find_child{|child| child.as_name == as_name }
end

#to_attr_listObject



21
22
23
# File 'lib/alf/sql/nodes/select_list.rb', line 21

def to_attr_list
  AttrList.coerce(sexpr_body.map{|a| a.as_name })
end

#to_sql(buffer = "") ⇒ Object



25
26
27
28
29
30
31
# File 'lib/alf/sql/nodes/select_list.rb', line 25

def to_sql(buffer = "")
  sexpr_body.each_with_index do |item,index|
    buffer << ", " unless index == 0
    item.to_sql(buffer)
  end
  buffer
end