classPgSqlCopySupport
final class PgSqlCopySupport
implements CopySupport
Copy support for PostgreSQL queries.
Methods§
public function tableName(string $relation): stringResolves the unqualified table name selected by the COPY arguments.
Parameters
$relation | string |
Returns
stringTest cases 1
Calls 3
- method-call TargetColumns::relationParts() line 24
- new TargetColumns line 24
- function-call
countline 26
public function target(
string $relation,
?string $fields,
TableDefinition $definition,
): CopyTargetResolves COPY relation and column arguments against the reflected schema.
Parameters
$relation | string | |
$fields | ?string | |
$definition | TableDefinition |
Returns
Throws
ValueErrorTest cases 2
Calls 5
- method-call TargetColumns::columns() line 35
- new TargetColumns line 35
- new
ValueErrorline 37 - new CopyTarget line 40
- method-call TargetColumns::relationParts() line 40
public function selectSql(CopyTarget $target): stringBuilds the SELECT statement that supplies COPY output rows.
Parameters
$target | CopyTarget |
Returns
stringTest cases 2
Calls 4
- function-call
sprintfline 48 - method-call TargetSql::columnListSql() line 50
- new TargetSql line 50
- method-call TargetSql::relationSql() line 51
public function insertSql(CopyTarget $target, int $rowCount, bool $overrideSystemValue): stringBuilds the INSERT statement for one decoded COPY input row.
Parameters
$target | CopyTarget | |
$rowCount | int | |
$overrideSystemValue | bool |
Returns
stringThrows
ValueErrorCalls 6
- new
ValueErrorline 62 - function-call
implodeline 72 - function-call
sprintfline 75 - method-call TargetSql::relationSql() line 77
- new TargetSql line 77
- method-call TargetSql::columnListSql() line 78
public function isCopyStatement(string $sql): boolRecognizes PostgreSQL COPY statements.
Parameters
$sql | string |
Returns
boolTest cases 1
Calls 2
- static-call SqlTokenStream::tokenize() line 89
- static-call PgSqlLexerProfile::create() line 89
public function encodeRow(list<mixed> $values, string $separator, string $nullAs): stringParameters
$values | list<mixed> | |
$separator | string | |
$nullAs | string |
Returns
stringThrows
ValueErrorTest cases 2
Calls 14
- method-call TextFields::validateSeparator() line 98
- new TextFields line 98
- function-call
is_stringline 106 - function-call
is_intline 106 - function-call
is_floatline 106 - function-call
is_boolline 108 - function-call
is_resourceline 110 - function-call
stream_get_contentsline 111 - new
ValueErrorline 113 - function-call
bin2hexline 115 - function-call
sprintfline 117 - function-call
get_debug_typeline 117 - method-call TextFields::escape() line 119
- function-call
implodeline 122
public function decodeRow(string $row, string $separator, string $nullAs): list<string|null>Parameters
$row | string | |
$separator | string | |
$nullAs | string |
Returns
list<string|null>Throws
ValueErrorTest cases 4
PgSqlCopySupportTest::testDecodeRowAcceptsEverySupportedLineEndingcallsPgSqlCopySupportTest::testDecodeRowHonorsNullBeforeEscapesAndSupportsByteEscapescallsPgSqlCopySupportTest::testDecodeRowPreservesEmptyFieldscallsPgSqlCopySupportTest::testDecodeRowSupportsEveryControlUnknownAndVariableLengthByteEscapecalls
Calls 7
- method-call TextFields::validateSeparator() line 131
- new TextFields line 131
- function-call
str_ends_withline 132 - function-call
substrline 133 - function-call
str_containsline 137 - new
ValueErrorline 138 - method-call TextFields::decodeFields() line 144
Test cases 12§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 11
PgSqlCopySupportTest::testDecodeRowAcceptsEverySupportedLineEndingcallsPgSqlCopySupportTest::testDecodeRowHonorsNullBeforeEscapesAndSupportsByteEscapescallsPgSqlCopySupportTest::testDecodeRowPreservesEmptyFieldscallsPgSqlCopySupportTest::testDecodeRowSupportsEveryControlUnknownAndVariableLengthByteEscapecallsPgSqlCopySupportTest::testEncodeRowEscapesEveryPostgreSqlControlAndDelimitercallsPgSqlCopySupportTest::testEncodeRowUsesPostgreSqlTextEscapesAndNativeScalarOutputcallsPgSqlCopySupportTest::testInsertSqlNumbersEveryRowAndPreservesIdentityOverridecallsPgSqlCopySupportTest::testIsCopyStatementReadsTheFirstSignificantKeywordcallsPgSqlCopySupportTest::testSelectSqlColumnsExcludeGeneratedColumnsAndParseExplicitFieldscallsPgSqlCopySupportTest::testTableNameResolvesTheFinalQualifiedComponentcallsPgSqlCopySupportTest::testTargetRelationRequotesEmbeddedIdentifierQuotescalls