Ejemplo n.º 1
0
 function _getWhatPart()
 {
     if (is_array($this->order_info['property'])) {
         foreach ($this->order_info['property'] as $orderInfoProperty) {
             $property[] = $orderInfoProperty;
         }
     } else {
         $property = $this->order_info['property'];
     }
     if (is_array($property)) {
         foreach ($property as $propertyItem) {
             if ($propertyItem->isSystem()) {
                 return "`{$this->table_prefix}`.sid";
             }
         }
     } elseif ($property->isSystem()) {
         if ($this->orderRelevance) {
             $value = SJB_DB::quote($this->orderRelevance['value']['value']);
             return "`{$this->table_prefix}`.sid,  MATCH(`{$this->orderRelevance['value']['field']}`) AGAINST ('{$value}') as relevance";
         } else {
             return "`{$this->table_prefix}`.sid";
         }
     } elseif ($property->getType() != 'tree') {
         $id = $property->getID();
         $sql_type = $property->getSQLType();
         if ($sql_type == 'DECIMAL') {
             // DECIMAL type is available in MYSQL 5.0.8 or higher
             return "{$this->table_prefix}.*, {$id}.value + 0.0 AS {$id}";
         }
         return "{$this->table_prefix}.*, CAST({$id}.value AS {$sql_type}) AS {$id}";
     }
     $tree_browser = new SJB_TreeBrowser($property->getID());
     return "{$this->table_prefix}.*, " . $tree_browser->getWhatPart();
 }