classSetTransaction
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.
$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']new \SqlSemantics\Platform\PostgreSql\Statement\Utility\Transaction\SetTransaction(\SqlSemantics\Platform\PostgreSql\Statement\Utility\Transaction\TransactionScope::Transaction, []) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstructionProperties§
public non-empty-list<TransactionMode> $modespublic TransactionScope $scopepublic bool $local = falseMethods§
public function __construct(
public TransactionScope $scope,
list<TransactionMode> $modes,
public bool $local = false,
)Parameters
$scope | TransactionScope | Which transactions the characteristics apply to |
$modes | list<TransactionMode> | The characteristics in the order written; at least one |
$local | bool | Whether SET LOCAL is written |
Calls 2
- static-call Check::listOf() line 45
- class-const TransactionMode::class() line 45
public function deriveStatement(Derivation $derivation): voidDerives nothing: a transaction is the state of a session.
Parameters
$derivation | Derivation |
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 60
- function-call
explodeline 64
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
SetTransactionTestcalls