NaifyDb\Adapter\Sqlite クラス

extends NaifyDb\Adapter\Adapter
implements NaifyDb\Connection\ConnectionConfigInterface

SQLite 接続設定ビルダー

ファイルパスまたは :memory: を保持し、SQLite 用 DSN を返す。 開発用の軽量 DB やテスト用途で NaifyDb に渡す設定オブジェクトとして使う。

使用例

$config = Sqlite::configure()
    ->database('_storage/app.sqlite');

NaifyDb::configure()->loadConfig('sqlite', $config)->apply();
$db = NaifyDb::db('sqlite');

プロパティ

名前型説明
private $database string SQLite ファイルパスまたは ':memory:'

メソッド

メソッド説明
public database(string $path): static SQLite の DB パスを設定する
`:memory:` を渡すとメモリ DB を使う。
public override toDsn(): string SQLite 用 DSN を生成する
public override getUsername(): ?string SQLite ではユーザー名を使わない
public override getPassword(): ?string SQLite ではパスワードを使わない
public override getMetadata(): MetadataInterface SQLite 用 metadata オブジェクトを返す
public override describeTable(PDO $pdo, string $tableName): array SQLite のカラム情報を直接取得する

継承プロパティ

名前型説明継承元
protected $extra array ドライバー固有の追加設定置き場 Adapter

継承メソッド

メソッド説明継承元
public static configure(): static インスタンスを生成する Adapter
public set(): static 任意のプロパティを設定する Adapter
public getOptions(): array PDO オプションを取得する Adapter
public quoteIdentifier(): string 識別子(テーブル名・カラム名)を明示的にクオートする Adapter
public profiler(): static クエリプロファイラを設定する Adapter
public getProfiler(): ?QueryProfilerInterface プロファイラのインスタンスを取得する Adapter
public toArray(): array 設定を配列へエクスポートする Adapter
protected parseTypeAndSize(): array 型文字列からデータ型とサイズを分離する Adapter