Beispiel #1
0
 /**
  * Converts given searchString to SQL statements.
  */
 function parseSearchString()
 {
     if (count($this->selectStatement->searchString) == 0) {
         return;
     }
     $string = $this->selectStatement->searchString[0];
     $fields = $this->selectStatement->searchFields;
     $s = explode(" UND ", $string);
     for ($i = 0; $i < count($s); $i++) {
         foreach ($fields as $j => $name) {
             #for($j = 0;$j<count($fields);$j++){
             $this->addSelectStatement("whereFields", $fields[$j]);
             $this->addSelectStatement("whereOperators", "LIKE");
             $this->addSelectStatement("whereValues", "%" . $s[$i] . "%");
             $this->addSelectStatement("whereLogOp", $j == 0 ? "AND" : "OR");
             $this->addSelectStatement("whereBracketGroup", "BG" . $i);
             //Fix by mysqli and utf8 broken umlauts
             $v = DBStorage::findNonUft8($s[$i]);
             if ($v != $s[$i]) {
                 $this->addSelectStatement("whereFields", $fields[$j]);
                 $this->addSelectStatement("whereOperators", "LIKE");
                 $this->addSelectStatement("whereValues", "%" . $v . "%");
                 $this->addSelectStatement("whereLogOp", "OR");
                 $this->addSelectStatement("whereBracketGroup", "BG" . $i);
             }
         }
     }
     if (!isset($this->selectStatement->searchCustom)) {
         return;
     }
     foreach ($this->selectStatement->searchCustom as $v) {
         $this->addSelectStatement("whereFields", $v[0]);
         $this->addSelectStatement("whereOperators", $v[1]);
         $this->addSelectStatement("whereValues", $v[2]);
         $this->addSelectStatement("whereLogOp", $v[3]);
     }
 }