Example #1
0
 /**
  * @test
  * @see http://forge.typo3.org/issues/22049
  */
 public function canParseAndCompileBetweenOperator()
 {
     $parseString = '((scheduled BETWEEN 1265068628 AND 1265068828 ) OR scheduled <= 1265068728) AND NOT exec_time AND NOT process_id AND page_id=1 AND parameters_hash = \'854e9a2a77\'';
     $result = $this->subject->parseWhereClause($parseString);
     $this->assertInternalType('array', $result);
     $this->assertEmpty($parseString);
     $result = $this->subject->compileWhereClause($result);
     $expected = '((scheduled BETWEEN 1265068628 AND 1265068828) OR scheduled <= 1265068728) AND NOT exec_time AND NOT process_id AND page_id = 1 AND parameters_hash = \'854e9a2a77\'';
     $this->assertEquals($expected, $this->cleanSql($result));
 }
 /**
  * Quotes the field (and table) names within a where clause with the quote character suitable for the DB being used
  *
  * @param string $where_clause A where clause that can be parsed by parseWhereClause
  * @throws \InvalidArgumentException
  * @return string Usable where clause with quoted field/table names
  */
 public function quoteWhereClause($where_clause)
 {
     if ($where_clause === '' || $this->runningNative()) {
         return $where_clause;
     }
     $where_clause = $this->SQLparser->parseWhereClause($where_clause);
     if (is_array($where_clause)) {
         $where_clause = $this->_quoteWhereClause($where_clause);
         $where_clause = $this->SQLparser->compileWhereClause($where_clause);
     } else {
         throw new \InvalidArgumentException('Could not parse where clause', 1310027511);
     }
     return $where_clause;
 }