final class ShowProfile
    implements Statement
    uses Snapshot
Public API: explicitly declared with @visibility public.

SHOW PROFILE: the stages of one profiled statement of the session and their resource use.

Rule: MYSQL-SHOW-PROFILE-001. The rows always have Status and Duration; each section written adds its columns, in the fixed order of the layout of MYSQL-SHOW-ROWS-001 whatever order the sections are written in, and a section written twice adds its columns once. FOR QUERY selects a statement of SHOW PROFILES, by default the last one. LIMIT selects rows as in SELECT; its operands are derived at a position that sees no relation. Terminates: a fixed layout. Source: https://dev.mysql.com/doc/refman/8.4/en/show-profile.html. Status: Implemented.

Reading the columns of the sectionsdoctest
$show = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SHOW PROFILE SWAPS, CPU FOR QUERY 2');
    [array_map(static fn (\SqlSemantics\Platform\MySql\Model\Statement\Shape\Field $field): ?string => $field->name?->value, iterator_to_array($show->fields())), $show->toString()] // => [['Status', 'Duration', 'CPU_user', 'CPU_system', 'Swaps'], 'SHOW PROFILE SWAPS, CPU FOR QUERY 2']

Properties§

public list<ProfileSection> $sections
public Numeral|null $query = null
public Limit|null $limit = null

Methods§

public function __construct(
    list<ProfileSection> $sections = [],
    public Numeral|null $query = null,
    public Limit|null $limit = null,
)

Parameters

$sectionslist<ProfileSection>The sections in the order written
$queryNumeral|nullThe number of the statement after FOR QUERY
$limitLimit|nullThe LIMIT clause
Calls 2
public function deriveStatement(Derivation $derivation): void

Derives the rows of the sections written and the LIMIT operands.

Parameters

$derivationDerivation
Calls 9
public function render(Output $out): void

Writes the statement.

Parameters

$outOutput
Calls 4

Test cases 1§

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

Dedicated tests 1

Relations§

Instantiated in 2