Class: Sqlbuilder::Utils::Postgres

Inherits:
Default
  • Object
show all
Defined in:
lib/sqlbuilder/utils/postgres.rb

Instance Method Summary collapse

Instance Method Details

#escape_value(value) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/sqlbuilder/utils/postgres.rb', line 20

def escape_value(value)
  if value.is_a? String
    PG::Connection.escape_string(value)
  else
    value
  end
end

#format_column(column) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/sqlbuilder/utils/postgres.rb', line 12

def format_column(column)
  if column == "*"
    "*"
  else
    "\"#{column}\""
  end
end

#format_value(value) ⇒ Object



8
9
10
# File 'lib/sqlbuilder/utils/postgres.rb', line 8

def format_value(value)
  PG::Connection.quote_connstr(value)
end