示例#1
0
 /**
  * Creates select query, executes it and returns the result as assoc array.
  * @return string
  */
 public function get()
 {
     $q = "SELECT " . $this->fields . " FROM `" . $this->table . "` " . $this->join;
     if ($this->condition) {
         $q .= " WHERE {$this->condition}";
     }
     if ($this->group) {
         $q .= " GROUP BY {$this->group}";
         if ($this->having) {
             $q .= " HAVING {$this->having}";
         }
     }
     if ($this->order) {
         $q .= " ORDER BY {$this->order}";
     }
     if ($this->limit) {
         $q .= " LIMIT {$this->limit}";
     }
     if ($this->offset) {
         $q .= " OFFSET {$this->offset}";
     }
     if ($this->procedure) {
         $q .= " PROCEDURE {$this->procedure}";
     }
     if ($this->into) {
         $q .= " INTO {$this->into}";
     }
     if ($this->for_update) {
         $q .= " FOR UPDATE";
     }
     if ($this->lock_in_share_mode) {
         $q .= " LOCK IN SHARE MODE";
     }
     return $this->connection->queryAssoc($q, $this->params);
 }