Home
DevCentral
Search
Configure Global Search
Log In
Transactions
D3836
Change Details
Change Details
Old
New
Diff
Allow to support prepare/bind/execute query workflow. This made easier to write better DI-resistant code. This change introduces a Query abstract class, implemented by PDOQuery, where the following method can prepare the query: - `query` to run the query and get PDODatabaseResult - `withValue` and `bind` to set a parameter value or bind it to a variable - `bindInOutParameter` to set a parameter for stored procedure calls The PDOQuery instance is constructed by PDOEngine classes, calling the `prepare()` method with SQL query as argument. While PDO directly calls all methods on statement class, this engine / query / result division supports better separation of concerns Ref T2169
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
Allow to
Enhances
supp
ort
ort for the
prepare/bind/execute query workflow
.
,
This made
making it
easier to writ
e better DI-
e Dependency Injection (DI)
resistant code. This change introduces a
`
Query
`
abstract class, implemented by
`
PDOQuery
, where the following method can prepare the query:
`,
with the following methods:
- `query
` to run
: executes
the query and
get
returns a `
PDODatabaseResult
`
- `withValue` and `bind`
to
:
set
s
a parameter value or bind it to a variable - `bindInOutParameter`
to
:
set
s
a parameter for stored procedure calls The
`
PDOQuery
`
instance is c
onstruc
rea
ted by
the `
PDOEngine
`
cla
sses
ss
,
which
call
ing
s
the `prepare()` method with
an
SQL query a
s it
s argument. While PDO directly calls all methods on
the
statement class,
this
this
engine
/
/
query
/
/
result
divis
separat
ion
supports better
improves the overall
separation of concerns
.
Ref T2169
Continue