Module: Veritas::SQL::Generator::Identifier

Included in:
Attribute, Relation
Defined in:
lib/veritas/sql/generator/identifier.rb

Overview

Generates an SQL statement for an identifier

Constant Summary collapse

QUOTE =
'"'.freeze
ESCAPED_QUOTE =
'""'.freeze

Instance Method Summary collapse

Instance Method Details

#visit_identifier(identifier) ⇒ #to_s

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Quote the identifier

Parameters:

  • identifier (#to_s)

Returns:

  • (#to_s)


20
21
22
23
# File 'lib/veritas/sql/generator/identifier.rb', line 20

def visit_identifier(identifier)
  escaped = identifier.to_s.gsub(QUOTE, ESCAPED_QUOTE)
  escaped.insert(0, QUOTE) << QUOTE
end