diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-77432-ExtbasePreparedStatementQueryOption.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-77432-ExtbasePreparedStatementQueryOption.rst new file mode 100644 index 0000000000000000000000000000000000000000..2f95cb86c15bbfc040de03e6cfb58ca4d4dcf6b9 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-77432-ExtbasePreparedStatementQueryOption.rst @@ -0,0 +1,39 @@ +============================================================== +Deprecation: #77432 - Extbase: Prepared Statement Query Option +============================================================== + +Description +=========== + +The option to use prepared statements within the Extbase persistence has been removed. The method +``getUsePreparedStatement()`` has been removed from the ``QuerySettingsInterface``, as the database +abstraction layer will take care of prepared statements automatically. + +The implementation of the following properties within ``Typo3QuerySettings`` has been marked as +deprecated: + +* ``getUsePreparedStatement()`` +* ``usePreparedStatement()`` + +The protected property ``usePreparedStatement`` has been marked as deprecated as well. + + +Impact +====== + +Calling one of the methods above within the ``QuerySettings`` object within the extbase persistence +will trigger a deprecation notice warning. + + +Affected Installations +====================== + +Any TYPO3 instance with an extbase extension using custom query settings using the +``usePreparedStatement()`` option. + + +Migration +========= + +Remove any calls to the methods within the extensions' code, as the TYPO3 abstraction layer will +handle them automatically. \ No newline at end of file diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/QuerySettingsInterface.php b/typo3/sysext/extbase/Classes/Persistence/Generic/QuerySettingsInterface.php index 72f0dd89a5293bc6f14ef159fc5948f10326cd32..e6349fd72aeae16474b2429883beb2ef7ce48843 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/QuerySettingsInterface.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/QuerySettingsInterface.php @@ -167,9 +167,4 @@ interface QuerySettingsInterface * @return bool */ public function getUseQueryCache(); - - /** - * @return bool - */ - public function getUsePreparedStatement(); } diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php index dd439ef127c0a426cd3f44c5fa7a2b11b2e3635f..e48d753c7cfcc0c17eec410efbfc362659b459b3 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php @@ -370,7 +370,8 @@ class Typo3DbBackend implements BackendInterface, SingletonInterface if ($statement instanceof Qom\Statement) { $rows = $this->getObjectDataByRawQuery($statement); } else { - $rows = $this->getRowsByStatementParts($query); + list($statementParts) = $this->getStatementParts($query); + $rows = $this->getRowsFromDatabase($statementParts); } $rows = $this->doLanguageAndWorkspaceOverlay($query->getSource(), $rows, $query->getQuerySettings()); @@ -407,25 +408,6 @@ class Typo3DbBackend implements BackendInterface, SingletonInterface ); } - /** - * Determines whether to use prepared statement or not and returns the rows from the corresponding method - * - * @param QueryInterface $query - * @return array - */ - protected function getRowsByStatementParts(QueryInterface $query) - { - if ($query->getQuerySettings()->getUsePreparedStatement()) { - list($statementParts, $parameters) = $this->getStatementParts($query, false); - $rows = $this->getRowsFromPreparedDatabase($statementParts, $parameters); - } else { - list($statementParts) = $this->getStatementParts($query); - $rows = $this->getRowsFromDatabase($statementParts); - } - - return $rows; - } - /** * Fetches the rows directly from the database, not using prepared statement * @@ -448,32 +430,6 @@ class Typo3DbBackend implements BackendInterface, SingletonInterface return $rows; } - /** - * Fetches the rows from the database, using prepared statement - * - * @param array $statementParts - * @param array $parameters - * @return array the result - */ - protected function getRowsFromPreparedDatabase(array $statementParts, array $parameters) - { - $queryCommandParameters = $this->createQueryCommandParametersFromStatementParts($statementParts); - $preparedStatement = $this->databaseHandle->prepare_SELECTquery( - $queryCommandParameters['selectFields'], - $queryCommandParameters['fromTable'], - $queryCommandParameters['whereClause'], - '', - $queryCommandParameters['orderBy'], - $queryCommandParameters['limit'] - ); - - $preparedStatement->execute($parameters); - $rows = $preparedStatement->fetchAll(); - - $preparedStatement->free(); - return $rows; - } - /** * Returns the object data using a custom statement * diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Typo3QuerySettings.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Typo3QuerySettings.php index e74f034e06a2e1b07b022524b7251f94db5c4e1b..69497f9f7c6a44da9bc3deb8d0e24dfd3dc323ca 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Typo3QuerySettings.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Typo3QuerySettings.php @@ -94,6 +94,7 @@ class Typo3QuerySettings implements QuerySettingsInterface * Flag whether the query should use a prepared statement * * @var bool + * @deprecated since TYPO3 v8, will be removed in TYPO3 9, this option is handled automatically now in the database abstraction */ protected $usePreparedStatement = false; @@ -340,18 +341,22 @@ class Typo3QuerySettings implements QuerySettingsInterface /** * @param bool $usePreparedStatement * @return QuerySettingsInterface + * @deprecated since TYPO3 v8, will be removed in TYPO3 9, this option is handled automatically now in the database abstraction */ public function usePreparedStatement($usePreparedStatement) { + GeneralUtility::logDeprecatedFunction(); $this->usePreparedStatement = $usePreparedStatement; return $this; } /** * @return bool + * @deprecated since TYPO3 v8, will be removed in TYPO3 9, this option is handled automatically now in the database abstraction */ public function getUsePreparedStatement() { + GeneralUtility::logDeprecatedFunction(); return (bool)$this->usePreparedStatement; }