Module: ViewData::PG::Controls::Row::Put::CompositePrimaryKey

Defined in:
lib/view_data/pg/controls/row/put.rb

Class Method Summary collapse

Class Method Details

.callObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/view_data/pg/controls/row/put.rb', line 23

def self.call
  id_1, id_2 = PrimaryKey::Composite.example
  column_value = Controls::Data.column_value
  table_name = Table::CompositePrimaryKey.name

  session = Session.build

  session.execute(<<~SQL, [id_1, id_2, column_value])
    INSERT INTO #{table_name} (id_1, id_2, some_column) VALUES ($1, $2, $3)
  SQL

  session.close

  return id_1, id_2
end