classRoutineDefinition
final class RoutineDefinition
implements RoutineOption
uses Snapshot
Public API: explicitly declared with
@visibility public.AS 'definition' or AS 'object_file', 'link_symbol': the routine's definition as unanalysed text of its language.
The source is the text with the language it is written in, which the server passes to that language without parsing it as SQL (PG-ROUTINE-SOURCE-001); for a C function it names the shared library and the symbol follows it. Source: https://www.postgresql.org/docs/17/sql-createfunction.html.
$option = new \SqlSemantics\Platform\PostgreSql\Statement\Routine\Option\RoutineDefinition(new \SqlSemantics\Platform\PostgreSql\Statement\Routine\Option\RoutineSource(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('sql'), new \SqlSemantics\Platform\PostgreSql\Statement\Literal\StringConstant('SELECT 1')));
[$option->source->language?->value, $option->source->text->value, $option->symbol] // => ['sql', 'SELECT 1', null]Properties§
public RoutineSource $sourcepublic StringConstant|null $symbol = nullMethods§
public function __construct(
public RoutineSource $source,
public StringConstant|null $symbol = null,
)Parameters
$source | RoutineSource | The definition in its language, or the object file of a C function |
$symbol | StringConstant|null | The link symbol of a C function, if written |
public function alterable(): boolTells that ALTER does not accept the option.
Returns
boolTest cases 1
public function setting(): stringpublic function deriveClause(Derivation $derivation, Environment $environment): voidDerives nothing: unanalysed text holds no expression.
Parameters
$derivation | Derivation | |
$environment | Environment |
Test cases 1
public function render(Output $out): voidWrites AS and the strings.
Parameters
$out | Output |
Test cases 1
Calls 2
- method-call Output::keyword() line 67
- method-call Output::symbol() line 69
Test cases 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
Other tests reaching this symbol 3
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\OptionRule::definition() packages/sql-semantics-postgres/src/Lowering/Routine/OptionRule.php:168
- new SqlSemantics\Platform\PostgreSql\Lowering\Routine\OptionRule::definition() packages/sql-semantics-postgres/src/Lowering/Routine/OptionRule.php:169
Type checks 3
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Routine\RoutineChecks::body() packages/sql-semantics-postgres/src/Rules/Routine/RoutineChecks.php:82
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Routine\RoutineChecks::body() packages/sql-semantics-postgres/src/Rules/Routine/RoutineChecks.php:84
- instanceof SqlSemantics\Platform\PostgreSql\Statement\Routine\CreateFunction::__construct() packages/sql-semantics-postgres/src/Statement/Routine/CreateFunction.php:72