Sha256: b934472999da4d2c0a2f68996bdb3eb707149a31bc651a222338704908804c6c

Contents?: true

Size: 623 Bytes

Versions: 4

Compression:

Stored size: 623 Bytes

Contents

# encoding: utf-8

module Veritas
  module SQL
    module Generator

      # Generates an SQL statement for an identifier
      module Identifier

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

        # Quote the identifier
        #
        # @param [#to_s] identifier
        #
        # @return [#to_s]
        #
        # @api private
        def visit_identifier(identifier)
          escaped = identifier.to_s.gsub(QUOTE, ESCAPED_QUOTE)
          escaped.insert(0, QUOTE) << QUOTE
        end

      end # module Identifier
    end # module Generator
  end # module SQL
end # module Veritas

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
veritas-sql-generator-0.0.7 lib/veritas/sql/generator/identifier.rb
veritas-sql-generator-0.0.6 lib/veritas/sql/generator/identifier.rb
veritas-sql-generator-0.0.5 lib/veritas/sql/generator/identifier.rb
veritas-sql-generator-0.0.4 lib/veritas/sql/generator/identifier.rb