Sha256: 069227572db6c440b8400079e0f8f056a1cb0f1879ae8232a59c73716001922d
Contents?: true
Size: 713 Bytes
Versions: 1
Compression:
Stored size: 713 Bytes
Contents
# frozen_string_literal: true module TableSaw module Queries class ExecuteInsertStatement attr_reader :statement, :row def initialize(statement, row) @statement = statement @row = row end def call "EXECUTE #{statement.name}(#{values});" end private def values TableSaw.schema_cache.columns(statement.table_name).zip(row) .map { |column, value| quote_value(column, value) } .join(', ') end def quote_value(column, value) type = TableSaw.connection.lookup_cast_type_from_column(column) TableSaw.connection.quote(type.serialize(type.deserialize(value))) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
table_saw-3.2.0 | lib/table_saw/queries/execute_insert_statement.rb |