DbSql::Select PHP Method

Select() public method

构造查询语句
public Select ( string $table, string $select = null, string $where = null, string $order = null, string $limit = null, array | null $option = null ) : string
$table string
$select string
$where string
$order string
$limit string
$option array | null
return string 返回构造的语句
    public function Select($table, $select = null, $where = null, $order = null, $limit = null, $option = null)
    {
        if (!is_array($option)) {
            $option = array();
        }
        $sql = $this->get()->select($table)->option($option)->where($where)->orderBy($order)->limit($limit);
        if (isset($option['select2count'])) {
            foreach ($select as $key => $value) {
                if (count($value) > 2) {
                    $sql->count(array_slice($value, 1));
                } else {
                    $sql->count($value);
                }
            }
        } else {
            if (!is_array($select)) {
                $select = array($select);
            }
            call_user_func_array(array($sql, 'column'), $select);
        }
        if (!empty($option)) {
            if (isset($option['pagebar'])) {
                if ($option['pagebar']->Count === null) {
                    $s2 = $this->Count($table, array(array('*', 'num')), $where);
                    $option['pagebar']->Count = GetValueInArrayByCurrent($this->db->Query($s2), 'num');
                }
                $option['pagebar']->Count = (int) $option['pagebar']->Count;
                $option['pagebar']->make();
            }
        }
        $sql = $sql->sql;
        return $sql;
    }