Task #55360

Epic #55070: Workpackages

Epic #55065: WP: Overall System Performance (Backend and Frontend)

Epic #55656: Optimize overall Extbase performance

Story #55168: Optimize Extbase generic persistence

Extbase: use preparedStatement in generic persistence

Added by Felix Oertel almost 6 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Extbase
Target version:
Start date:
2014-03-19
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
nightmare
Sprint Focus:

Description

at the moment we build the query over and over again. we should use prepared statements, as offered in the TYPO3 api from 4.5


Subtasks

Task #57067: Follow-Up re-use preparedStatement objectRejectedFelix Oertel

Task #57254: Fix usage of own prepared statement object in $query->statementClosed


Related issues

Precedes TYPO3 Core - Task #55167: Extbase: avoid parseQuery() / buildQuery() to be called multiple times Closed 2014-03-20 2014-03-20

Associated revisions

Revision ab2dc4e5 (diff)
Added by Felix Oertel over 5 years ago

[TASK] Use prepared statements in generic persistence

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.

Resolves: #55360
Releases: 6.2
Change-Id: I91a3fd69470df178a8a5465511e50766b50d7f52
Reviewed-on: https://review.typo3.org/27426
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
Reviewed-by: Marc Bastian Heinrichs
Reviewed-by: Ernesto Baschny
Tested-by: Ernesto Baschny

Revision cf42649b (diff)
Added by Felix Oertel over 5 years ago

[TASK] Add functional tests for generic persistence

To backup the changes in Extbase's generic persistence,
we add some functional tests.

Resolves: #55661
Related: #55360
Related: #55167
Releases: 6.2
Change-Id: I0b845618b1cec9788ca36ac59e25ea6779f01cb6
Reviewed-on: https://review.typo3.org/28262
Reviewed-by: Marc Bastian Heinrichs
Tested-by: Marc Bastian Heinrichs
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter

Revision 57caf5a4 (diff)
Added by Ernesto Baschny over 5 years ago

[TASK] Follow-up to "Add functional tests for generic persistence"

Test directory changed from "Relation" to "Persistence".

Resolves: #55661
Related: #55360
Related: #55167
Releases: 6.2

Change-Id: I422dbfb6bdad4215bdc70dea775917cf3159605f
Reviewed-on: https://review.typo3.org/28297
Reviewed-by: Ernesto Baschny
Tested-by: Ernesto Baschny

Revision 69b05b7f (diff)
Added by Marc Bastian Heinrichs over 5 years ago

[TASK] Follow-up: Use prepared statements in generic persistence

Fixes using $query->statement() without parameters.

Resolves: #56915
Resolves: #55360
Releases: 6.2
Change-Id: Ia149313f5f9f719d7dba0a21a3eb39ea4f5052e8
Reviewed-on: https://review.typo3.org/28442
Reviewed-by: Markus Klein
Reviewed-by: Dennis J
Tested-by: Dennis J
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters

History

#1 Updated by Marc Bastian Heinrichs almost 6 years ago

Hey Felix, there was this issue concerning prepared queries #28092.

And important is that the prepared statements in Core DB class are only used for DBAL ATM!
There is no use of the prepared statements offered by mysqli. Will be fixed with #27372.

#2 Updated by Gerrit Code Review almost 6 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#3 Updated by Gerrit Code Review almost 6 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#4 Updated by Gerrit Code Review almost 6 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#5 Updated by Gerrit Code Review almost 6 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#6 Updated by Gerrit Code Review almost 6 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#7 Updated by Gerrit Code Review almost 6 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#8 Updated by Gerrit Code Review almost 6 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#9 Updated by Ernesto Baschny over 5 years ago

  • Subject changed from use preparedStatement in generic persistence to Extbase: use preparedStatement in generic persistence
  • Category set to Extbase
  • TYPO3 Version set to 6.2

#10 Updated by Gerrit Code Review over 5 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#11 Updated by Gerrit Code Review over 5 years ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#12 Updated by Gerrit Code Review over 5 years ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#13 Updated by Gerrit Code Review over 5 years ago

Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#14 Updated by Gerrit Code Review over 5 years ago

Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#15 Updated by Gerrit Code Review over 5 years ago

Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#16 Updated by Gerrit Code Review over 5 years ago

Patch set 14 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#17 Updated by Gerrit Code Review over 5 years ago

Patch set 15 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#18 Updated by Gerrit Code Review over 5 years ago

Patch set 16 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#19 Updated by Gerrit Code Review over 5 years ago

Patch set 17 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#20 Updated by Gerrit Code Review over 5 years ago

Patch set 18 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27426

#21 Updated by Anonymous over 5 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#22 Updated by Gerrit Code Review over 5 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28442

#23 Updated by Gerrit Code Review over 5 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28442

#24 Updated by Marc Bastian Heinrichs over 5 years ago

  • Status changed from Under Review to Resolved

#25 Updated by Riccardo De Contardi about 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF