예제 #1
0
 private function getFieldFilterExpressions()
 {
     $expressions = array();
     foreach ($this->fieldFilters as $fieldName => $fieldValue) {
         switch ($fieldName) {
             case 'title':
             case 'description':
             case 'author':
                 $expressions[] = $this->db->like('qpl_questions.' . $fieldName, 'text', "%%{$fieldValue}%%");
                 break;
             case 'type':
                 $expressions[] = "qpl_qst_type.type_tag = {$this->db->quote($fieldValue, 'text')}";
                 break;
             case 'question_id':
                 if ($fieldValue != "" && !is_array($fieldValue)) {
                     $fieldValue = array($fieldValue);
                 }
                 $expressions[] = $this->db->in("qpl_questions.question_id", $fieldValue, false, "integer");
                 break;
             case 'parent_title':
                 $expressions[] = $this->db->like('object_data.title', 'text', "%%{$fieldValue}%%");
                 break;
         }
     }
     return $expressions;
 }
 private function getFieldFilterExpressions()
 {
     $expressions = array();
     foreach ($this->fieldFilters as $fieldName => $fieldValue) {
         switch ($fieldName) {
             case 'title':
             case 'description':
             case 'author':
                 $expressions[] = $this->db->like('qpl_questions.' . $fieldName, 'text', "%%{$fieldValue}%%");
                 break;
             case 'type':
                 $expressions[] = "qpl_qst_type.type_tag = {$this->db->quote($fieldValue, 'text')}";
                 break;
         }
     }
     return $expressions;
 }
예제 #3
0
 /**
  * Provisional LIKE support for oracle CLOB's
  * Uses SUBSTR to reduce the length.
  * TODO: we can use <code>self::CLOB_BUFFER_SIZE = 4000</code> since
  * since the maximum buffer is 4000 byte and not 4000 chars
  * @param object $a_col
  * @param object $a_type
  * @param object $a_value [optional]
  * @param object $case_insensitive [optional]
  * @return 
  */
 public function like($a_col, $a_type, $a_value = "?", $case_insensitive = true)
 {
     if ($a_type == 'text') {
         return parent::like($a_col, $a_type, $a_value, $case_insensitive);
     }
     if (!in_array($a_type, array("text", "clob", "blob"))) {
         $this->raisePearError("Like: Invalid column type '" . $a_type . "'.", $this->error_class->FATAL);
     }
     if ($a_value == "?") {
         if ($case_insensitive) {
             return "UPPER(SUBSTR(" . $a_col . ",0," . self::CLOB_BUFFER_SIZE . ")) LIKE(UPPER(?))";
         } else {
             return "SUBSTR(" . $a_col . ",0," . self::CLOB_BUFFER_SIZE . ") LIKE(?)";
         }
     } else {
         if ($case_insensitive) {
             return " UPPER(SUBSTR(" . $a_col . ",0," . self::CLOB_BUFFER_SIZE . ")) LIKE(UPPER(" . $this->quote($a_value, 'text') . "))";
         } else {
             return " SUBSTR(" . $a_col . ",0," . self::CLOB_BUFFER_SIZE . ") LIKE(" . $this->quote($a_value, 'text') . ")";
         }
     }
 }