/**
  * Add a sql string to the where array base on the $operatorType, $value, $tableAliasName, and $columnName
  * parameters.  How the sql string is built depends on if the value is a string or not.
  * @see RedBeanModelDataProvider::makeWhere
  * @see buildJoinAndWhereForNonRelatedAttribute
  * @see buildJoinAndWhereForRelatedAttribute
  */
 protected static function addWherePartByClauseInformation($operatorType, $value, &$where, $whereKey, $tableAliasName, $columnName)
 {
     assert('is_string($operatorType)');
     assert('is_array($where)');
     assert('is_int($whereKey)');
     assert('is_string($tableAliasName)');
     assert('is_string($columnName)');
     $quote = DatabaseCompatibilityUtil::getQuote();
     if (is_string($value) || is_array($value) && count($value) > 0 || $value !== null || $value === null && SQLOperatorUtil::doesOperatorTypeAllowNullValues($operatorType)) {
         $where[$whereKey] = "({$quote}{$tableAliasName}{$quote}.{$quote}{$columnName}{$quote} " . DatabaseCompatibilityUtil::getOperatorAndValueWherePart($operatorType, $value) . ")";
     }
 }
Example #2
0
 public function testDoesOperatorTypeAllowNullValues()
 {
     $this->assertTrue(SQLOperatorUtil::doesOperatorTypeAllowNullValues('isNull'));
     $this->assertTrue(SQLOperatorUtil::doesOperatorTypeAllowNullValues('isEmpty'));
     $this->assertTrue(SQLOperatorUtil::doesOperatorTypeAllowNullValues('isNotNull'));
     $this->assertTrue(SQLOperatorUtil::doesOperatorTypeAllowNullValues('isNotEmpty'));
     $this->assertFalse(SQLOperatorUtil::doesOperatorTypeAllowNullValues('startsWith'));
 }
 /**
  * Add a sql string to the where array. How the sql string is built depends on if the value is a string or not.
  * @param $operatorType
  * @param $value
  * @param $where
  * @param $whereKey
  * @param $tableAliasName
  * @param $columnName
  */
 protected function addWherePartByClauseInformation($operatorType, $value, &$where, $whereKey, $tableAliasName, $columnName)
 {
     assert('is_string($operatorType)');
     assert('is_array($where)');
     assert('is_int($whereKey)');
     assert('is_string($tableAliasName)');
     assert('is_string($columnName)');
     if (is_string($value) || is_array($value) && count($value) > 0 || $value !== null || $value === null && SQLOperatorUtil::doesOperatorTypeAllowNullValues($operatorType)) {
         $where[$whereKey] = "(" . self::resolveWhereColumnContentForModifier($tableAliasName, $columnName) . " " . DatabaseCompatibilityUtil::getOperatorAndValueWherePart($operatorType, $value) . ")";
     }
 }