diff --git a/Classes/Persistence/Storage/Typo3DbBackend.php b/Classes/Persistence/Storage/Typo3DbBackend.php index ef5c61b..20d4a94 100644 --- a/Classes/Persistence/Storage/Typo3DbBackend.php +++ b/Classes/Persistence/Storage/Typo3DbBackend.php @@ -764,11 +764,11 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis } elseif (is_array($parameter) || ($parameter instanceof ArrayAccess) || ($parameter instanceof Traversable)) { $items = array(); foreach ($parameter as $item) { - $items[] = $this->databaseHandle->fullQuoteStr($item, 'foo'); + $items[] = $this->quoteValue($item); } $parameter = '(' . implode(',', $items) . ')'; } else { - $parameter = $this->databaseHandle->fullQuoteStr($parameter, 'foo'); // FIXME This may not work with DBAL; check this + $parameter = $this->quoteValue($parameter); } $sqlString = substr($sqlString, 0, $markPosition) . $parameter . substr($sqlString, $markPosition + 1); } @@ -1058,6 +1058,25 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis // TODO check if we can hand this over to the Dispatcher to clear the page only once, this will save around 10% time while inserting and updating $this->cacheService->clearPageCache($pageIdsToClear); } + + /** + * Correct quoting of values depending on its type + * + * @param mixed $value + * @return mixed + */ + protected function quoteValue($value) { + if (is_int($value) || ctype_digit($value)) { + $value = (int)$value; + } elseif(is_float($value) || (string)(float)$value == (string)$value) { + $value = (float)$value; + } else { + // FIXME This may not work with DBAL; check this + $value = $this->databaseHandle->fullQuoteStr($value, 'foo'); + } + + return $value; + } } ?> \ No newline at end of file