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

A request to add a database file to the connection under a schema name.

Rule: SQLITE-ATTACH-001. The file, the schema name and the optional key are expressions evaluated where no relation is visible; a column name in them is a missing column, and an operand that is a single identifier is the text of its name (NameOperand). The optional DATABASE keyword is not written. The attached schema is connection state: the statement provides no declaration and changes no context. Source: https://sqlite.org/lang_attach.html. Status: Implemented.

Writing an attach request without the optional keyworddoctest
(new \SqlSemantics\Platform\Sqlite\Semantics())->analyze("ATTACH DATABASE 'file.db' AS aux")->toString() // => "ATTACH 'file.db' AS aux"

Properties§

public Scalar $file
public Scalar $schema
public Scalar|null $key = null

Methods§

public function __construct(
    public Scalar $file,
    public Scalar $schema,
    public Scalar|null $key = null,
)

Parameters

$fileScalarThe expression that names the database file
$schemaScalarThe expression that names the schema
$keyScalar|nullThe expression of the encryption key, which only builds with encryption support use
public function deriveStatement(Derivation $derivation): void

Derives each operand where no relation is visible.

Parameters

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

Writes the request.

Parameters

$outOutput
Calls 1

Test cases 6§

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

Dedicated tests 2
Other tests reaching this symbol 4

Relations§

Instantiated in 1