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

A pragma: a query or a change of a setting or of internal data of the database library.

Rule: SQLITE-PRAGMA-001. The grammar fixes the pragma name, an optional schema, and an optional value that is a signed number, a name (written as an identifier or as a string), or one of the keywords ON, DELETE and DEFAULT; these are distinct operand kinds. SQLite hands the value to the pragma as text. PRAGMA x = v and PRAGMA x(v) "yield identical results"; the value is written with =. What a pragma does, whether it returns rows and which columns they have, is fixed per pragma name by the manual and is not derived: the operation records no output, no relation use and no diagnostic, and an unknown pragma name is not an error in SQLite either. Source: https://sqlite.org/pragma.html. Status: Implemented.

Reading a pragma with a schema and a valuedoctest
$pragma = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('PRAGMA main.cache_size(4000)');
    [$pragma->statement->name->schema?->value, $pragma->statement->name->name->value, $pragma->statement->value->number->digits, $pragma->toString()] // => ['main', 'cache_size', '4000', 'PRAGMA main.cache_size = 4000']

Properties§

public SignedNumber|Name|PragmaKeyword|null $value = null

Methods§

public function __construct(
    public QualifiedName $name,
    public SignedNumber|Name|PragmaKeyword|null $value = null,
)

Parameters

$nameQualifiedNameThe pragma name with its optional schema
$valueSignedNumber|Name|PragmaKeyword|nullThe value: a signed number, a name, a keyword, or null when none is written
Calls 1
public function deriveStatement(Derivation $derivation): void

Derives the numeric literal of the value; what a pragma reads and returns depends on its name, which the grammar does not fix.

Parameters

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

Writes the pragma, with the value after an equal sign.

Parameters

$outOutput
Calls 7

Test cases 8§

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 5

Relations§

Instantiated in 3