HomeDevCentral

Improve PDO support with prepare and bind

Description

Improve PDO support with prepare and bind

Enhances support for the prepare/bind/execute query workflow,
making it easier to write Dependency Injection (DI) resistant code.

This change introduces a Query abstract class, implemented by PDOQuery,
with the following methods:

  • query: executes the query and returns a PDODatabaseResult
  • withValue and bind: sets a parameter value or bind it to a variable
  • bindInOutParameter: sets a parameter for stored procedure calls

The PDOQuery instance is created by the PDOEngine class,
which calls the prepare() method with an SQL query as its argument.

While PDO directly calls all methods on the statement class, this
engine/query/result separation improves the overall separation of concerns.

Ref T2169

Test Plan:
Orbeon Forms Reader for Obsidian Workspaces has plan for PDO support in D3835.

Differential Revision: https://devcentral.nasqueron.org/D3836

Details

Provenance
derecksonAuthored on Fri, Oct 31, 22:32
derecksonPushed on Sun, Nov 2, 00:54
Differential Revision
D3836: Improve PDO support with prepare and bind
Parents
rKERUALD23e05c3e2976: Generate code coverage report
Branches
Unknown
Tags
Unknown
References
tag: database/0.6.1
Tasks
T2169: Support prepared statement for PDO drivers