final class XmlSerialize
    implements Scalar, OutputNaming
    uses Snapshot
Public API: explicitly declared with @visibility public.

XMLSERIALIZE ({DOCUMENT | CONTENT} value AS type [[NO] INDENT]): an XML value as a character string.

Mirrors PostgreSQL's XmlSerialize node; the type is a simple type name without an array part. Rule: PG-XMLSERIALIZE-001. Facts: the type named, NULL exactly when the value is. Diagnostics: a type that is not a character string type (PG-XML-CHECKS-001). The result column is named xmlserialize. Source: https://www.postgresql.org/docs/17/functions-xml.html#FUNCTIONS-XML-SERIALIZE. Status: Implemented.

Reading a serializationdoctest
$serialize = new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Xml\XmlSerialize(
        \SqlSemantics\Platform\PostgreSql\Statement\Option\XmlOption::Content,
        new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral(),
        new \SqlSemantics\Platform\PostgreSql\Statement\Type\TypeName(new \SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\NamedDesignation(new \SqlSemantics\Platform\PostgreSql\Statement\Name\DottedName([new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('text')]))),
        \SqlSemantics\Platform\PostgreSql\Statement\Invocation\Xml\XmlIndent::Indent,
    );
    [$serialize->option->value, $serialize->indent->value] // => ['CONTENT', 'INDENT']

Properties§

public XmlOption $option
public Scalar $value
public TypeName $type
public XmlIndent|null $indent = null

Methods§

public function __construct(
    public XmlOption $option,
    public Scalar $value,
    public TypeName $type,
    public XmlIndent|null $indent = null,
)

Parameters

$optionXmlOptionWhether a document or content is serialized
$valueScalarThe XML value
$typeTypeNameThe character string type of the result
$indentXmlIndent|nullThe indentation written
public function outputName(): Name

Names an unaliased result column.

Returns

Test cases 1
Calls 1
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the value and the type's modifiers, the type and the NULL fact.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

Calls 7
public function render(Output $out): void

Writes XMLSERIALIZE with the option, the value, the type and the indentation.

Parameters

$outOutput
Test cases 1
Calls 3

Test cases 4§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 4

Relations§

Instantiated in 1