mini\Database\PDODatabase class

Documentation

PDO-based database implementation

Wraps any PDO instance with a clean, ergonomic API that makes database operations pleasant while supporting any PDO-compatible database. Fetches PDO from container lazily to ensure proper scoping.

Inheritance

Implements: mini\Database\DatabaseInterface

Properties (3)

private ?PDO $pdo
private bool $inTransaction
private WeakMap $queryMap

Methods (32)

Create a PDODatabase instance

Get PDO instance (from constructor or container)

Execute a SELECT query and return a composable Query

Wrap a PartialQuery in a Query and register the mapping

Get the underlying PartialQuery for a Query instance

Get a raw query executor closure for PartialQuery

Execute query and return first row only as object

Execute query and return first column of first row

Execute query and return first column values as array

Execute a statement (INSERT, UPDATE, DELETE)

Get the last inserted row ID

Check if a table exists in the database

Execute a closure within a database transaction

Get the underlying PDO instance for advanced operations

Get the SQL dialect for this database connection

Quotes a value for safe use in SQL query strings

Quotes an identifier (table name, column name) for safe use in SQL

Delete rows matching a query

Update rows matching a query

Insert a new row into a table

Insert a row, or update if conflict on unique columns

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Get database schema as a TableInterface

Documentation missing

Documentation missing

Documentation missing

Create a VirtualDatabase with shadowed tables

Source

src/Database/PDODatabase.php:25-849