From 257dfba5f4eca75a0ecf3f5717b11253c3f58858 Mon Sep 17 00:00:00 2001 From: Andreas Fernandez Date: Wed, 26 Feb 2014 16:51:37 +0100 Subject: [PATCH] [BUGFIX] Respect table mapping on caching The method analyzeFields() of DBAL's DatabaseConnection caches the table structure. The cache always uses the real table name, ignoring any mapping, which results in a RuntimeException: "Could not update BLOB >>>> no WHERE clause found!" The method now checks for a possible mapping and sets the alias as table name. Resolves: #56349 Releases: 6.2 Change-Id: I9599cebc8604103c3749bc142cd44b813f018a72 Reviewed-on: https://review.typo3.org/27874 Reviewed-by: Markus Klein Tested-by: Markus Klein Reviewed-by: Xavier Perseguers Tested-by: Xavier Perseguers --- typo3/sysext/dbal/Classes/Database/DatabaseConnection.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/typo3/sysext/dbal/Classes/Database/DatabaseConnection.php b/typo3/sysext/dbal/Classes/Database/DatabaseConnection.php index b1aedc3e389d..aa8e0ba3b07e 100644 --- a/typo3/sysext/dbal/Classes/Database/DatabaseConnection.php +++ b/typo3/sysext/dbal/Classes/Database/DatabaseConnection.php @@ -365,6 +365,10 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection { */ protected function analyzeFields($parsedExtSQL) { foreach ($parsedExtSQL as $table => $tdef) { + // check if table is mapped + if (isset($this->mapping[$table])) { + $table = $this->mapping[$table]['mapTableName']; + } if (is_array($tdef['fields'])) { foreach ($tdef['fields'] as $field => $fdefString) { $fdef = $this->SQLparser->parseFieldDef($fdefString); @@ -2397,10 +2401,6 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection { public function sql_field_metatype($table, $field) { // If $table and/or $field are mapped, use the original names instead foreach ($this->mapping as $tableName => $tableMapInfo) { - if (isset($tableMapInfo['mapTableName']) && $tableMapInfo['mapTableName'] === $table) { - // Table name is mapped => use original name - $table = $tableName; - } if (isset($tableMapInfo['mapFieldNames'])) { foreach ($tableMapInfo['mapFieldNames'] as $fieldName => $fieldMapInfo) { if ($fieldMapInfo === $field) { -- 2.20.1