You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PhpDb manually compiles each Select query for every single query, creating unnecessary overhead when a query itself will not change based on adapter/platform.
The intention of this proposal is to allow a caching mechanism which would determine if a Statement uses a Parameter Container and if so, store the compiled query in a cache that is user-determined. This still allows the database driver to correctly quote/execute data without needing to cache-bust regularly.
Background
No response
Considerations
No response
Proposal(s)
Sample pseudo code:-
$select->from('foo')->where([
'c1' => null,
'c2' => [1, 2, 3],
new \Laminas\Db\Sql\Predicate\IsNotNull('c3'),
]);
// Cached string is 'SELECT "foo".* FROM "foo" WHERE "c1" IS NULL AND "c2" IN (?, ?, ?) AND "c3" IS NOT NULL'$statement = $sql->prepareStatementForSqlObject($select, $storage); // where $storage is a PSR-6 compliant storage wrapper$results = $statement->execute(); // Statement will use pre-prepared SQL string based on driver/adapter/platform
Activity
tyrsson commentedon Jan 26, 2026
PhpDb should be able to consume any PSR compliant cache that is registered in a container.