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

ROLLBACK [WORK] [AND [NO] CHAIN] [[NO] RELEASE]: a request to end the transaction and undo its changes.

Mirrors SQLCOM_ROLLBACK with LEX::tx_chain and LEX::tx_release. Rule: MYSQL-ROLLBACK-001. Each completion choice is true when written as AND CHAIN or RELEASE, false when written with NO, and null when absent: an absent choice takes the completion_type of the session, so an explicit NO is a request of its own. AND CHAIN together with RELEASE is a syntax error of the server and cannot be constructed. WORK is optional and not written. The statement names no relation and has no facts. Source: https://dev.mysql.com/doc/refman/8.4/en/commit.html. Status: Implemented.

Ending a transaction with explicit completion choicesdoctest
$end = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('rollback and chain no release');
    [$end->toString(), $end->statement->chain, $end->statement->release] // => ['ROLLBACK AND CHAIN NO RELEASE', true, false]

Properties§

public bool|null $chain = null
public bool|null $release = null

Methods§

public function __construct(public bool|null $chain = null, public bool|null $release = null)

Parameters

$chainbool|nullWhether AND CHAIN (true) or AND NO CHAIN (false) is written; null when absent
$releasebool|nullWhether RELEASE (true) or NO RELEASE (false) is written; null when absent

Throws

InvalidConstruction When both AND CHAIN and RELEASE are requested
Calls 1
public function deriveStatement(Derivation $derivation): void

Has nothing to derive: the request names no relation and no value.

Parameters

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

Writes the request.

Parameters

$outOutput
Calls 1

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 1
Type checks 1
Type declarations 1