interface CastRenderer

Renders platform-specific CAST expressions.

Each platform provides an implementation that maps ColumnDeclaration to the appropriate CAST syntax for that SQL dialect.

Methods§

public function renderCast(string $expression, ColumnDeclaration $type): string

Render a CAST expression for a given expression string.

Parameters

$expressionstringThe SQL expression to cast (e.g. "'Alice'", "1", "NULL").
$typeColumnDeclarationThe target column type.

Returns

string A SQL CAST expression (e.g. "CAST('Alice' AS CHAR)").
public function renderNullCast(ColumnDeclaration $type): string

Render a CAST expression for NULL with the given type.

Used for empty CTE definitions to preserve column type information.

Parameters

$typeColumnDeclarationThe target column type.

Returns

string A SQL CAST(NULL AS ...) expression.

Test cases 3§

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

Dedicated tests 1
Other tests reaching this symbol 2

Relations§

Implemented by 1