interfaceModification
interface Modification
extends Statement, Query
@visibility public.A data-modifying statement: INSERT, UPDATE, DELETE or MERGE.
Each is a statement and also a query whose rows are those of its RETURNING list, without columns when it has none, so that it can be the body of a common table expression, the query of a prepared statement or of COPY, or a statement nested in another one. Deriving it as a query (Derivation::query()) derives every part against the given outer environment and records no root output; deriving it as a statement records its RETURNING rows as the output of the root. Source: https://www.postgresql.org/docs/17/queries-with.html#QUERIES-WITH-MODIFYING.
$semantics = new \SqlSemantics\Platform\PostgreSql\Semantics();
[$semantics->analyze('DELETE FROM t')->statement->returnsRows(), $semantics->analyze('DELETE FROM t RETURNING *')->statement->returnsRows()] // => [false, true]Methods§
public function returnsRows(): boolTells whether the statement returns rows: whether it has a RETURNING list.
Returns
boolpublic function commonTables(): ?CommonTablesAnswers the WITH clause written before the statement, or null.
Returns
Test cases 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
ModificationTestcalls
Other tests reaching this symbol 6
DeleteTest::testReturnsRowsTellsWhetherRETURNINGIsWrittencallsInsertDefaultsTest::testReturnsRowsTellsWhetherRETURNINGIsWrittencallsInsertRowsTest::testReturnsRowsTellsWhetherRETURNINGIsWrittencallsInsertSelectTest::testReturnsRowsTellsWhetherRETURNINGIsWrittencallsMergeTest::testReturnsRowsTellsWhetherRETURNINGIsWrittencallsUpdateTest::testReturnsRowsTellsWhetherRETURNINGIsWrittencalls
Relations§
Implemented by 6
- Delete packages/sql-semantics-postgres/src/Statement/Manipulation/Delete.php:33
- InsertDefaults packages/sql-semantics-postgres/src/Statement/Manipulation/InsertDefaults.php:33
- InsertRows packages/sql-semantics-postgres/src/Statement/Manipulation/InsertRows.php:37
- InsertSelect packages/sql-semantics-postgres/src/Statement/Manipulation/InsertSelect.php:41
- Merge packages/sql-semantics-postgres/src/Statement/Manipulation/Merge.php:37
- Update packages/sql-semantics-postgres/src/Statement/Manipulation/Update.php:39
Method calls 2
Type checks 10
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Manipulation\CopyFacts::query() packages/sql-semantics-postgres/src/Rules/Manipulation/CopyFacts.php:103
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Manipulation\CopyFacts::query() packages/sql-semantics-postgres/src/Rules/Manipulation/CopyFacts.php:106
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Manipulation\CursorFacts::declare() packages/sql-semantics-postgres/src/Rules/Manipulation/CursorFacts.php:44
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Placement::objects() packages/sql-semantics-postgres/src/Rules/Manipulation/Placement.php:57
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Placement::modifying() packages/sql-semantics-postgres/src/Rules/Manipulation/Placement.php:96
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\ModifyingCommonTables::check() packages/sql-semantics-postgres/src/Rules/Query/Facts/ModifyingCommonTables.php:45
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableShapes::input() packages/sql-semantics-postgres/src/Rules/Resolution/TableShapes.php:73
- instanceof SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Copy\CopyQuery::__construct() packages/sql-semantics-postgres/src/Statement/Manipulation/Copy/CopyQuery.php:58
- instanceof SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Prepared\Prepare::__construct() packages/sql-semantics-postgres/src/Statement/Manipulation/Prepared/Prepare.php:52
- instanceof SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Prepared\Prepare::deriveStatement() packages/sql-semantics-postgres/src/Statement/Manipulation/Prepared/Prepare.php:68