Project

General

Profile

Actions

Bug #78779

closed

A Query on columns of type DATE results in an empty resultset

Added by Stefan Froemken over 7 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Extbase
Start date:
2016-11-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Hello Core-Team,

I'm working with extbase and created a matching like that:

$constraint = array();
$constraint[] = $query->greaterThanOrEqual('day', $monthBegin->format('Y-m-d'));
$constraint[] = $query->lessThan('day', $monthEnd->format('Y-m-d'));        
return $query->matching($query->logicalAnd($constraint))->execute();

But after initializing the QueryResult-Object the resultset is always empty.

The problem seems to be in the new Typo3DbQueryParser:

case QueryInterface::OPERATOR_GREATER_THAN_OR_EQUAL_TO:
  $value = $this->queryBuilder->createNamedParameter($this->dataMapper->getPlainValue($value), \PDO::PARAM_INT);
  $expr = $exprBuilder->comparison($fieldName, $exprBuilder::GTE, $value);

As I work with greaterThanOrEqual the core expects that my date value is of type INT.

The resulting query looks like that:

WHERE ((`tx_events2_domain_model_day`.`day` >= 2016-11-01)
AND (`tx_events2_domain_model_day`.`day` < 2016-12-01))

When I add the quotes my query works like expected.

Stefan


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #63482: Query constraint on a DateTime field with a DateTime argument should trigger date formatNew2014-12-01

Actions
Actions

Also available in: Atom PDF