final class SetTransaction
    implements Statement
    uses Snapshot
Public API: explicitly declared with @visibility public.

SET TRANSACTION modes or SET SESSION CHARACTERISTICS AS TRANSACTION modes: a request to set transaction characteristics.

Rule: PG-TRANSACTION-006. Mirrors PostgreSQL's VariableSetStmt of kind VAR_SET_MULTI named TRANSACTION or SESSION CHARACTERISTICS, with the modes in the order written. The commas between modes have no effect and are not kept. Facts: none. Source: https://www.postgresql.org/docs/17/sql-set-transaction.html. Status: Implemented.

Reading the modes of SET TRANSACTIONdoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SET TRANSACTION READ ONLY, DEFERRABLE');
    [$operation->statement->modes[1], $operation->toString()] // => [\SqlSemantics\Platform\PostgreSql\Statement\Utility\Transaction\TransactionMode::Deferrable, 'SET TRANSACTION READ ONLY DEFERRABLE']
Refusing a SET TRANSACTION without modesdoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Utility\Transaction\SetTransaction(\SqlSemantics\Platform\PostgreSql\Statement\Utility\Transaction\TransactionScope::Transaction, []) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public non-empty-list<TransactionMode> $modes
public bool $local = false

Methods§

public function __construct(
    public TransactionScope $scope,
    list<TransactionMode> $modes,
    public bool $local = false,
)

Parameters

$scopeTransactionScopeWhich transactions the characteristics apply to
$modeslist<TransactionMode>The characteristics in the order written; at least one
$localboolWhether SET LOCAL is written
Calls 2
public function deriveStatement(Derivation $derivation): void

Derives nothing: a transaction is the state of a session.

Parameters

$derivationDerivation
public function render(Output $out): void

Writes the request.

Parameters

$outOutput
Calls 2

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 2