예제 #1
0
 /**
  * @param FieldFilter $filter
  * @return void
  */
 public function VisitFieldFilter($filter)
 {
     if ($filter->GetIgnoreFieldDataType()) {
         if ($filter->GetFilterType() == 'LIKE') {
             $this->resultCondition = $this->engCommandImp->GetCaseSensitiveLikeExpression($this->field, $filter->GetValue());
         } elseif ($filter->GetFilterType() == 'ILIKE') {
             $this->resultCondition = $this->engCommandImp->GetCaseInsensitiveLikeExpression($this->field, $filter->GetValue());
         } else {
             $this->resultCondition = $this->engCommandImp->GetCastedToCharFieldExpression($this->field) . ' ' . $filter->GetFilterType() . ' ' . $this->engCommandImp->GetValueAsSQLString($filter->GetValue());
         }
     } else {
         $value = $filter->GetValue();
         if ($value === '' && $this->field->FieldType == ftNumber) {
             if ($filter->GetFilterType() == '=') {
                 $this->resultCondition = $this->engCommandImp->GetIsNullCoditition($this->engCommandImp->GetFieldFullName($this->field));
             } elseif ($filter->GetFilterType() == '<>') {
                 $this->resultCondition = sprintf('NOT (%s)', $this->engCommandImp->GetIsNullCoditition($this->engCommandImp->GetFieldFullName($this->field)));
             }
         } elseif (isset($value)) {
             if ($filter->GetFilterType() == 'LIKE') {
                 $this->resultCondition = $this->engCommandImp->GetCaseSensitiveLikeExpression($this->field, $filter->GetValue());
             } elseif ($filter->GetFilterType() == 'ILIKE') {
                 $this->resultCondition = $this->engCommandImp->GetCaseInsensitiveLikeExpression($this->field, $filter->GetValue());
             } else {
                 $this->resultCondition = $this->engCommandImp->GetFieldFullName($this->field) . ' ' . $filter->GetFilterType() . ' ' . $this->engCommandImp->GetFieldValueAsSQL($this->field, $filter->GetValue());
             }
         } else {
             if ($filter->GetFilterType() == '=') {
                 $this->resultCondition = $this->engCommandImp->GetIsNullCoditition($this->engCommandImp->GetFieldFullName($this->field));
             } elseif ($filter->GetFilterType() == '<>') {
                 $this->resultCondition = sprintf('NOT (%s)', $this->engCommandImp->GetIsNullCoditition($this->engCommandImp->GetFieldFullName($this->field)));
             }
         }
     }
 }
예제 #2
0
 public function VisitIsBlankFieldFilter($filter)
 {
     $this->resultCondition = sprintf('((%s) OR (%s = \'\'))', $this->engCommandImp->GetIsNullExpression($this->field), $this->engCommandImp->GetCastedToCharFieldExpression($this->field));
 }