classInsertClauseParser
final class InsertClauseParser
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.
Extracts PostgreSQL INSERT columns, values and query sources.
Methods§
public function extractInsertColumns(string $sql): list<string>Extract column list from INSERT statement.
Parameters
$sql | string |
Returns
list<string>Called from 1
Calls 4
- static-call PostgreSqlLexicalMasker::maskComments() line 23
- function-call
preg_matchline 24 - method-call IdentifierDecoder::parseColumnList() line 25
- new IdentifierDecoder line 25
public function findInsertSourceClause(string $sql): array{keyword: string, offset: int}|nullParameters
$sql | string |
Returns
array{keyword: string, offset: int}|nullTest cases 1
Called from 3
- method-call ZtdQuery\Platform\Postgres\Sql\Dml\Insert\InsertClauseParser::extractInsertValues() packages/ztd-query-postgres/src/Sql/Dml/Insert/InsertClauseParser.php:147
- method-call ZtdQuery\Platform\Postgres\Sql\Dml\Insert\InsertClauseParser::hasInsertSelect() packages/ztd-query-postgres/src/Sql/Dml/Insert/InsertClauseParser.php:185
- method-call ZtdQuery\Platform\Postgres\Sql\Dml\Insert\InsertClauseParser::extractInsertSelectSql() packages/ztd-query-postgres/src/Sql/Dml/Insert/InsertClauseParser.php:196
public function extractParenthesizedList(
string $str,
int $start,
): array{items: list<string>, end: int}|nullParameters
$str | string | |
$start | int |
Returns
array{items: list<string>, end: int}|nullTest cases 1
Called from 1
Calls 5
- function-call
strlenline 97 - static-call QuotedSpan::quotedLength() line 103
- function-call
substrline 103 - function-call
trimline 121 - method-call InsertClauseParser::appendListCharacter() line 132
public function extractInsertValues(string $sql): list<list<string>>Extract VALUES rows from INSERT statement.
Parameters
$sql | string |
Returns
list<list<string>>Test cases 1
Called from 1
Calls 5
- static-call PostgreSqlLexicalMasker::maskComments() line 145
- method-call InsertClauseParser::findInsertSourceClause() line 147
- function-call
substrline 155 - function-call
strlenline 155 - method-call InsertClauseParser::extractParenthesizedList() line 168
public function hasInsertSelect(string $sql): boolCheck if INSERT has a SELECT subquery (INSERT ... SELECT).
Parameters
$sql | string |
Returns
boolTest cases 1
Called from 1
Calls 2
- static-call PostgreSqlLexicalMasker::maskComments() line 184
- method-call InsertClauseParser::findInsertSourceClause() line 185
public function extractInsertSelectSql(string $sql): ?stringExtract the SELECT part from INSERT ... SELECT.
Parameters
$sql | string |
Returns
?stringTest cases 1
Called from 1
Calls 3
- static-call PostgreSqlLexicalMasker::maskComments() line 195
- method-call InsertClauseParser::findInsertSourceClause() line 196
- function-call
substrline 198
public function appendListCharacter(
string $char,
int $depth,
int &$bracketDepth,
list<string> &$items,
string &$current,
): voidAppends a value character, treating array brackets as comma nesting.
Parameters
$char | string | |
$depth | int | |
$bracketDepth | int | |
$items | list<string> | |
$current | string |
Test cases 1
Called from 1
Calls 1
- function-call
trimline 223
Test cases 26§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 7
InsertClauseParserTest::testAppendListCharacterTreatsArrayCommasAsNestedcallsInsertClauseParserTest::testExtractInsertColumnsPreservesQuotedColumnNamescallsInsertClauseParserTest::testExtractInsertSelectSqlcallsInsertClauseParserTest::testExtractInsertValuescallsInsertClauseParserTest::testExtractParenthesizedListcallsInsertClauseParserTest::testFindInsertSourceClausecallsInsertClauseParserTest::testHasInsertSelectcalls
Other tests reaching this symbol 19
PgSqlSessionFactoryTestcallsTableContextTestcallsPgSqlQueryGuardTestcallsPgSqlRewriterTestcallsStatementRewriterTestcallsDeleteTransformerTestcallsSelectProjectionTestcallsUpsertProjectionTestcallsValueProjectionTestcallsInsertSelectRendererTestcallsInsertTransformerTestcallsPgSqlTransformerTestcallsUpdateTransformerTestcallsRowMutationResolverTestcallsTableMutationResolverTestcallsPgSqlMutationResolverTestcallsPgSqlParserTestcallsConflictClauseTestcallsTableDefinitionClausesTestcalls
Relations§
Instantiated in 4
- new ZtdQuery\Platform\Postgres\Sql\PgSqlParser::extractInsertColumns() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:74
- new ZtdQuery\Platform\Postgres\Sql\PgSqlParser::extractInsertValues() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:87
- new ZtdQuery\Platform\Postgres\Sql\PgSqlParser::hasInsertSelect() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:144
- new ZtdQuery\Platform\Postgres\Sql\PgSqlParser::extractInsertSelectSql() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:155
Method calls 4
- method-call ZtdQuery\Platform\Postgres\Sql\PgSqlParser::extractInsertColumns() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:74
- method-call ZtdQuery\Platform\Postgres\Sql\PgSqlParser::extractInsertValues() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:87
- method-call ZtdQuery\Platform\Postgres\Sql\PgSqlParser::hasInsertSelect() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:144
- method-call ZtdQuery\Platform\Postgres\Sql\PgSqlParser::extractInsertSelectSql() packages/ztd-query-postgres/src/Sql/PgSqlParser.php:155