Download the PHP package chrlb/pdao without Composer
On this page you can find all versions of the php package chrlb/pdao. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Vendor chrlb
Package pdao
Short Description Simple PDO wrapper 'DATA ACCESS OBJECT' for organizing and reusing named prepared statements
License MIT
Package pdao
Short Description Simple PDO wrapper 'DATA ACCESS OBJECT' for organizing and reusing named prepared statements
License MIT
Please rate this library. Is it a good library?
Informations about the package pdao
PHP DATA ACCESS OBJECT
Simple PDO wrapper for organizing and reusing named prepared statements in MySQL.
Status
Early-stage / student project — not production-ready yet. MySQL only for now. Feedback and PRs welcome.
Requirements
- PHP 8.0+
ext-pdoandext-pdo_mysqlenabled
Installation
run on terminal
Quick Start
API Reference
| Method | Description |
|---|---|
prepareStatement(string $title, string $sql, string $description = "NOT SET"): void |
Prepares and caches a statement under a unique title. |
replacePstmt(string $oldTitle, string $title, string $sql, string $description = "NOT SET"): void |
Removes an existing statement and registers a new one in its place. |
executeQuery(string $title, array $params = []): array |
Executes a cached SELECT statement, returns matched rows. |
executeUpdate(string $title, array $params = []): int |
Executes a cached INSERT/UPDATE/DELETE statement, returns affected row count. |
isPstmtExists(string $title): bool |
Checks whether a statement with the given title is registered. |
getPstmtDescription(string $title): string |
Returns the description attached to a registered statement. |
getAllPstmt(): array |
Returns all currently registered statements. |
pstmtParamsCount(string $title): int |
Returns the number of parameters a registered statement expects. |
Error Handling
Instead of returning false/null on failure, PHPDAO throws exceptions so callers can
handle errors explicitly:
OutOfBoundsException— a statement title doesn't exist (or already exists, for duplicates).InvalidArgumentException— invalid SQL at prepare-time, or a parameter count mismatch.RuntimeException— a statement failed during execution (e.g. a database-level error).
Extensibility
subclasses can override or build on top of PHPDAO's behavior:
License
MIT
All versions of pdao with dependencies
PHP Build Version
Package Version
No informations.
The package chrlb/pdao contains the following files
Loading the files please wait ...