classExternalBody
final class ExternalBody
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.The body of a stored routine written in an external language: AS and the code as a string (MySQL 8.1 and later).
The code is opaque text to the server's SQL layer; nothing is derived from it. Source: https://dev.mysql.com/doc/refman/9.1/en/create-procedure.html.
$create = (new \SqlSemantics\Platform\MySql\Semantics('mysql-9.1.0'))->analyze('CREATE FUNCTION f() RETURNS INT LANGUAGE JAVASCRIPT AS $$ return 1 $$');
$create->statement->body->code->text // => ' return 1 'Properties§
public DollarQuotedText|Text $codeMethods§
public function __construct(public DollarQuotedText|Text $code)Parameters
$code | DollarQuotedText|Text | The code, written as a dollar-quoted or a quoted string |
Calls 1
- static-call Check::input() line 34
public function render(Output $out): voidWrites AS and the code.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::keyword() line 42
Test cases 10§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 3
Other tests reaching this symbol 7
DefinitionRuleTest::testRoutineLowersAStoredRoutineBodycallsStatementRuleTest::testBodyLowersAnExternalBodycallsStatementRuleTest::testDollarQuotedSplitsTheTagAndTheTextcallsProgramFactsTest::testBodyKeepsExternalCodecallsProgramFactsTest::testRoutineDerivesNothingFromExternalCodecallsCreateFunctionTest::testDeriveStatementLeavesAnExternalBodyOpaquecallsDollarQuotedTextTest::testRenderKeepsTheTextBetweenTheDelimiterscalls
Relations§
Instantiated in 1
Type checks 2
Type declarations 5
- type SqlSemantics\Platform\MySql\Lowering\Routine\Program\StatementRule packages/sql-semantics-mysql/src/Lowering/Routine/Program/StatementRule.php:130
- type SqlSemantics\Platform\MySql\Rules\Routine\ProgramFacts packages/sql-semantics-mysql/src/Rules/Routine/ProgramFacts.php:57
- type SqlSemantics\Platform\MySql\Rules\Routine\ProgramFacts packages/sql-semantics-mysql/src/Rules/Routine/ProgramFacts.php:65
- type SqlSemantics\Platform\MySql\Statement\Routine\CreateFunction packages/sql-semantics-mysql/src/Statement/Routine/CreateFunction.php:47
- type SqlSemantics\Platform\MySql\Statement\Routine\CreateProcedure packages/sql-semantics-mysql/src/Statement/Routine/CreateProcedure.php:45