Module: Predicate::Expr

Included in:
Bmg::Sql::Literal, Exists
Defined in:
lib/bmg/sql/ext/predicate/expr.rb

Instance Method Summary collapse

Instance Method Details

#to_sql_literal(buffer, value) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/bmg/sql/ext/predicate/expr.rb', line 4

def to_sql_literal(buffer, value)
  case value
  when TrueClass
    buffer << Sql::Expr::TRUE
  when FalseClass
    buffer << Sql::Expr::FALSE
  when Integer, Float
    buffer << value.to_s
  else
    buffer << Sql::Expr::QUOTE << value.to_s << Sql::Expr::QUOTE
  end
end