Beispiel #1
0
 public function make($asArray = FALSE)
 {
     $this->build();
     $this->_connection->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_NUM);
     $data = $this->_connection->prepare("SELECT {$this->_select} FROM {$this->_table} {$this->_requestQuery} {$this->_limited}");
     $resFilterLength = $this->_connection->prepare("SELECT count(*) FROM {$this->_table} {$this->_requestQuery}");
     $resTotalLength = $this->_connection->prepare("SELECT COUNT(*) FROM {$this->_table} {$this->_query}");
     $resFilterLength->execute($this->bound);
     $this->output['recordsFiltered'] = $resFilterLength->fetchColumn();
     $resTotalLength->execute();
     $this->output['recordsTotal'] = $resTotalLength->fetchColumn();
     $data->execute($this->bound);
     $this->output['data'] = $data->fetchAll();
     if ($asArray) {
         return $this->output;
     } else {
         if (parent::remoteAllowed() and $callback = $this->request('callback')) {
             return $callback . '(' . json_encode($this->output) . ');';
         } else {
             return json_encode($this->output);
         }
     }
 }