While Typo3DbBackend claims to be the glue between Extbase
and TYPO3, it hardly uses the TYPO3 DB API.
This patch enhances getObjectData- and getObjectCountByQuery
- the main methods used when dealing with domain models
through a repository - to use the TYPO3 DB API. In conjunction
this enables Extbase to use the preparedStatement introduced
in TYPO3 4.5.
Because prepared queries might not be desirable in all circum-
stances, they are disabled by default. They can be enable on
a per-query-basis via
$query->getQuerySettings()->setUsePreparedStatement(TRUE);
Prepared statements will *only* be used for SELECT queries.
* consistent use of the TYPO3 DB API
use exec_SELECTgetRows and exec_SELECTcountRows() even for
non-prepared queries. This should help a lot along the way
to support DBAL.
* preparedStatement in custom statements
When using custom statements, it's now possible to use a pre-
pared statement in $query->statement(), instead of a query-
string. The prepared statement has to be initialized already
though, because Extbase cannot take care of splitting your
custom query string. The parameters are given as array in the
second argument as usual.
* deprecated using parameters in non-prepared custom statement
If a custom query string is used with $query->statement(),
giving the parameters in the second argument is deprecated.
* get count working
Counting - especially with limit and offset - has been broken
for quite some time now. By refactoring the limit and offset
parameters and adapting exec_SELECTcountRows() this should
now work again.
The next step is to separate the query parsing from the backend
and introduce an intelligent query cache. This will work as a
drop-in-replacement. The @todo-annotations are intended to stay
there for the next patch.