Esempio n. 1
0
 public function buildsql()
 {
     if ($this->sqltype == 'getcount') {
         $sql = " select count(*)";
     } else {
         $sql = " select {$this->colm}";
     }
     $sql .= " from {$this->tablename}";
     if (!empty($this->where)) {
         $wheres = \Sham::getstr($this->where, 0, ' and ');
         $sql .= " where {$wheres}";
     }
     if (!empty($this->group)) {
         $sql .= " group by {$this->group}";
     }
     if (!empty($this->order)) {
         $sql .= " order by {$this->order}";
     }
     if (!empty($this->limit)) {
         $sql .= " limit {$this->limit}";
     }
     $this->sql = $sql;
     return $this;
 }