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

BEGIN or START TRANSACTION: a request to start a transaction block.

Rule: PG-TRANSACTION-001. Mirrors PostgreSQL's TransactionStmt of kind TRANS_STMT_BEGIN or TRANS_STMT_START with its mode options in the order written. WORK or TRANSACTION after BEGIN, and the commas between modes, have no effect and are not kept. Facts: none; whether a block is already open is the state of the session. Source: https://www.postgresql.org/docs/17/sql-begin.html, https://www.postgresql.org/docs/17/sql-start-transaction.html. Status: Implemented.

Reading the modes of a BEGINdoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('BEGIN WORK ISOLATION LEVEL SERIALIZABLE, READ ONLY');
    [count($operation->statement->modes), $operation->toString()] // => [2, 'BEGIN ISOLATION LEVEL SERIALIZABLE READ ONLY']

Properties§

public list<TransactionMode> $modes
public BeginSpelling $spelling = BeginSpelling::Begin

Methods§

public function __construct(
    public BeginSpelling $spelling = BeginSpelling::Begin,
    list<TransactionMode> $modes = [],
)

Parameters

$spellingBeginSpellingThe spelling of the command
$modeslist<TransactionMode>The characteristics in the order written
Calls 3
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 4§

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

Dedicated tests 1
Other tests reaching this symbol 3

Relations§

Instantiated in 2