Module: DbAgile::Contract::Data::TransactionDriven

Included in:
Utils::Full
Defined in:
lib/dbagile/contract/data/transaction_driven.rb

Overview

Transaction driven methods of the contract

Instance Method Summary collapse

Instance Method Details

#delete(transaction, table_name, proj = {}) ⇒ Object

Delete all tuples whose projection equal proj inside a given table

Parameters:

  • transaction (Transaction)

    the current transaction

  • table_name (Symbol)

    the name of a table

  • proj (Hash) (defaults to: {})

    a projection tuple



54
55
56
# File 'lib/dbagile/contract/data/transaction_driven.rb', line 54

def delete(transaction, table_name, proj = {})
  Kernel.raise NotImplementedError
end

#direct_sql(transaction, sql) ⇒ ...

Send SQL directly to the database SQL server.

Returned result is left opened to adapters.

Parameters:

  • transaction (Transaction)

    the current transaction

  • sql (String)

    a SQL query

Returns:

  • (...)

    adapter defined



67
68
69
# File 'lib/dbagile/contract/data/transaction_driven.rb', line 67

def direct_sql(transaction, sql)
  Kernel.raise NotImplementedError
end

#insert(transaction, table_name, record) ⇒ Hash

Inserts a tuple inside a given table

Parameters:

  • transaction (Transaction)

    the current transaction

  • table_name (Symbol)

    the name of a table

  • record (Hash)

    a record as a hash (column_name -> value)

Returns:

  • (Hash)

    inserted record as a hash



21
22
23
# File 'lib/dbagile/contract/data/transaction_driven.rb', line 21

def insert(transaction, table_name, record)
  Kernel.raise NotImplementedError
end

#update(transaction, table_name, update, proj = {}) ⇒ Hash

Updates all tuples whose projection equal proj with values given by update inside a given table

Parameters:

  • transaction (Transaction)

    the current transaction

  • table_name (Symbol)

    the name of a table

  • proj (Hash) (defaults to: {})

    a projection tuple

Returns:

  • (Hash)

    update the new values for tuples



39
40
41
# File 'lib/dbagile/contract/data/transaction_driven.rb', line 39

def update(transaction, table_name, update, proj = {})
  Kernel.raise NotImplementedError
end