classTransactionRule
final class TransactionRule
Lowers the transaction commands.
Rule: PG-TRANSACTION-LOWER-001. Scope: TransactionStmt, TransactionStmtLegacy, opt_transaction, opt_transaction_chain, transaction_mode_list_or_empty, transaction_mode_list, transaction_mode_item, iso_level. Constructors: Begin, Commit, Rollback, SavepointCommand, PreparedTransaction. WORK and TRANSACTION after a command, SAVEPOINT after RELEASE and ROLLBACK TO, and the comma between modes are noise (UtilityNoise). Termination: the mode list is flattened iteratively. Source: https://www.postgresql.org/docs/17/sql-begin.html, https://www.postgresql.org/docs/17/sql-commit.html, https://www.postgresql.org/docs/17/sql-rollback.html, https://www.postgresql.org/docs/17/sql-savepoint.html, https://www.postgresql.org/docs/17/sql-prepare-transaction.html, https://www.postgresql.org/docs/17/sql-set-transaction.html. Status: Implemented.
Methods§
Lowers TransactionStmt or TransactionStmtLegacy.
Parameters
$statement | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 20
- new Begin line 77
- class-const BeginSpelling::Begin() line 77
- method-call TransactionRule::optionalModes() line 77
- class-const BeginSpelling::StartTransaction() line 78
- new Commit line 79
- class-const CommitSpelling::End() line 79
- method-call TransactionRule::chaining() line 79
- class-const CommitSpelling::Commit() line 80
- new Rollback line 81
- class-const RollbackSpelling::Abort() line 81
- class-const RollbackSpelling::Rollback() line 82
- new SavepointCommand line 83
- class-const SavepointAction::Define() line 83
- class-const SavepointAction::Release() line 84
- method-call TransactionRule::rollbackTo() line 86
- new PreparedTransaction line 88
- class-const PreparedAction::Prepare() line 88
- class-const PreparedAction::Commit() line 89
- class-const PreparedAction::Rollback() line 90
- static-call ImplementationGap::production() line 91
public function rollbackTo(Node $name, Node $word): SavepointCommandLowers ROLLBACK TO a savepoint; the optional noise word after ROLLBACK is accepted.
Returns
Throws
ImplementationGap When the production has no ruleCalled from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\TransactionRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/TransactionRule.php:86
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\TransactionRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/TransactionRule.php:87
Calls 3
- method-call TransactionRule::word() line 102
- new SavepointCommand line 104
- class-const SavepointAction::RollbackTo() line 104
public function word(Node $word): boolAccepts opt_transaction, whose WORK or TRANSACTION is noise, and tells whether a word is written.
Parameters
$word | Node |
Returns
boolThrows
ImplementationGap When the production has no ruleCalled from 3
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\TransactionRule::rollbackTo() packages/sql-semantics-postgres/src/Lowering/Utility/TransactionRule.php:102
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\TransactionRule::chaining() packages/sql-semantics-postgres/src/Lowering/Utility/TransactionRule.php:130
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\TransactionRule::optionalModes() packages/sql-semantics-postgres/src/Lowering/Utility/TransactionRule.php:151
Calls 1
- static-call ImplementationGap::production() line 119
Lowers opt_transaction_chain; no clause is null. The optional noise word before it is accepted.
Returns
Throws
ImplementationGap When the production has no ruleCalled from 4
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\TransactionRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/TransactionRule.php:79
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\TransactionRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/TransactionRule.php:80
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\TransactionRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/TransactionRule.php:81
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\TransactionRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/TransactionRule.php:82
Calls 4
- method-call TransactionRule::word() line 130
- class-const Chaining::Chain() line 134
- class-const Chaining::NoChain() line 135
- static-call ImplementationGap::production() line 137
public function optionalModes(Node $list, ?Node $word = null): list<TransactionMode>Lowers transaction_mode_list_or_empty; no mode is an empty list. The optional noise word before it is accepted.
Returns
list<TransactionMode>Throws
ImplementationGap When the production has no ruleCalled from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\TransactionRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/TransactionRule.php:77
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\TransactionRule::statement() packages/sql-semantics-postgres/src/Lowering/Utility/TransactionRule.php:78
Calls 3
- method-call TransactionRule::word() line 151
- method-call TransactionRule::modes() line 156
- static-call ImplementationGap::production() line 158
public function modes(Node $list): list<TransactionMode>Lowers transaction_mode_list: the modes in the order written.
Parameters
$list | Node |
Returns
list<TransactionMode>Throws
ImplementationGap When the production has no ruleCalled from 3
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\SettingRule::set() packages/sql-semantics-postgres/src/Lowering/Utility/SettingRule.php:142
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\SettingRule::set() packages/sql-semantics-postgres/src/Lowering/Utility/SettingRule.php:143
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\TransactionRule::optionalModes() packages/sql-semantics-postgres/src/Lowering/Utility/TransactionRule.php:156
Calls 2
- method-call Lowering::items() line 173
- method-call TransactionRule::mode() line 174
public function mode(Node $item): TransactionModeLowers transaction_mode_item with its iso_level.
Parameters
$item | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 2
- class-const TransactionRule::MODES() line 192
- static-call ImplementationGap::production() line 192
Private surface 2§
Implementation details, listed for orientation only.
private const MODES = ['transaction_mode_item: READ ONLY' => \SqlSemantics\Platform\PostgreSql\Statem…private Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
TransactionRuleTestcalls
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Utility\SettingRule::set() packages/sql-semantics-postgres/src/Lowering/Utility/SettingRule.php:139
- new SqlSemantics\Platform\PostgreSql\Lowering\Utility\UtilityCommands::statement() packages/sql-semantics-postgres/src/Lowering/Utility/UtilityCommands.php:54
Method calls 3
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\SettingRule::set() packages/sql-semantics-postgres/src/Lowering/Utility/SettingRule.php:142
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\SettingRule::set() packages/sql-semantics-postgres/src/Lowering/Utility/SettingRule.php:143
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Utility\UtilityCommands::statement() packages/sql-semantics-postgres/src/Lowering/Utility/UtilityCommands.php:54