/**
  * Adds conditions, matches and where clauses to the query
  * @param IKalturaIndexQuery $query
  */
 public function applyCondition(IKalturaDbQuery $query)
 {
     switch ($this->getComparison()) {
         case KalturaSearchConditionComparison::EQUAL:
             $comparison = ' = ';
             break;
         case KalturaSearchConditionComparison::GREATER_THAN:
             $comparison = ' > ';
             break;
         case KalturaSearchConditionComparison::GREATER_THAN_OR_EQUAL:
             $comparison = ' >= ';
             break;
         case KalturaSearchConditionComparison::LESS_THAN:
             $comparison = " < ";
             break;
         case KalturaSearchConditionComparison::LESS_THAN_OR_EQUAL:
             $comparison = " <= ";
             break;
         case KalturaSearchConditionComparison::NOT_EQUAL:
             $comparison = " <> ";
             break;
         default:
             KalturaLog::ERR("Missing comparison type");
             return;
     }
     $field = $this->getField();
     $value = $this->getValue();
     $fieldValue = $this->getFieldValue($field);
     if (is_null($fieldValue)) {
         KalturaLog::err('Unknown field [' . $field . ']');
         return;
     }
     $newCondition = $fieldValue . $comparison . KalturaCriteria::escapeString($value);
     $query->addCondition($newCondition);
 }
 /**
  * Adds conditions, matches and where clauses to the query
  * @param IKalturaIndexQuery $query
  */
 public function applyCondition(IKalturaDbQuery $query)
 {
     switch ($this->getComparison()) {
         case KalturaSearchConditionComparison::EQUAL:
             $comparison = ' = ';
             break;
         case KalturaSearchConditionComparison::GREATER_THAN:
             $comparison = ' > ';
             break;
         case KalturaSearchConditionComparison::GREATER_THAN_OR_EQUAL:
             $comparison = ' >= ';
             break;
         case KalturaSearchConditionComparison::LESS_THAN:
             $comparison = " < ";
             break;
         case KalturaSearchConditionComparison::LESS_THAN_OR_EQUAL:
             $comparison = " <= ";
             break;
         case KalturaSearchConditionComparison::NOT_EQUAL:
             $comparison = " <> ";
             break;
         default:
             KalturaLog::ERR("Missing comparison type");
             return;
     }
     $field = $this->getField();
     $value = $this->getValue();
     $fieldValue = null;
     switch ($field) {
         case Criteria::CURRENT_DATE:
             $d = getdate();
             $fieldValue = mktime(0, 0, 0, $d['mon'], $d['mday'], $d['year']);
             break;
         case Criteria::CURRENT_TIME:
         case Criteria::CURRENT_TIMESTAMP:
             $fieldValue = time();
             break;
         default:
             KalturaLog::err('Unknown field [' . $field . ']');
             return;
     }
     $newCondition = $fieldValue . $comparison . SphinxUtils::escapeString($value);
     $query->addCondition($newCondition);
 }
예제 #3
0
 public function applyCondition(IKalturaDbQuery $query)
 {
     $query->addCondition(entryIndex::DYNAMIC_ATTRIBUTES . '.' . QuizPlugin::getDynamicAttributeName() . ' = ' . ($this->isQuiz ? '1' : '0'));
 }