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;
}