Selects rows from the table

@param mixed $cols [optional]
@param mixed $where [optional]
@param mixed $order [optional]
@param mixed $limit [optional]
@return \go\DB\Result
963236
public function select($cols = null, $where = true, $order = null, $limit = null)
    {
        if ($this->map) {
            $cols = $this->map->cols($cols);
            $where = $this->map->where($where);
            $order = $this->map->order($order);
        }
        if ($cols === null) {
            $cols = true;
        }
        if ($this->fake) {
            $result = $this->fake->select($cols, $where, $order, $limit);
            if ($this->map) {
                return new ArrFetcher($this->map->assoc($result));
            }
            return $result;
        }
        $pattern = 'SELECT ?cols FROM ?t WHERE ?w';
        $data = array($cols, $this->name, $where);
        if ($order !== null) {
            $pattern .= ' ORDER BY ?o';
            $data[] = $order;
        }
        if ($limit !== null) {
            if (is_array($limit)) {
                $offset = isset($limit[1]) ? $limit[1] : 0;
                $limit = $limit[0];
            } else {
                $offset = 0;
            }
            $pattern .= ' LIMIT ?i,?i';
            $data[] = $offset;
            $data[] = $limit;
        }
        $fetcher = $this->db->query($pattern, $data);
        if ($this->map) {
            $data = $fetcher->assoc();
            $data = $this->map->assoc($data);
            $fetcher = new ArrFetcher($data);
        }
        return $fetcher;
    }
976284
public function delete($where = null, $params = [], $limit = null, $order = null) {

		if(null === $this -> getAdapter()) {
			return trigger_error(sprintf('No database adapter was set in "%s"', __METHOD__), E_USER_ERROR);
		}

		if(null !== $where && false === is_string($where)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($where)), E_USER_ERROR);
		}

		if(false === is_array($params)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type array, "%s" given', __METHOD__, gettype($params)), E_USER_ERROR);
		}

		if(null !== $limit && false === is_string($limit)) {
			return trigger_error(sprintf('Argument 3 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($limit)), E_USER_ERROR);
		}

		if(null !== $order && false === is_string($order)) {
			return trigger_error(sprintf('Argument 5 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($order)), E_USER_ERROR);
		}

		//Select
		$query[] = sprintf('DELETE FROM %s', $this -> getAdapter() -> escape($this -> getTable()));

		//Where
		if(null !== $where) {
			$query[] = sprintf('WHERE %s', $this -> getAdapter() -> escape($where));
		}

		//Order
		if(null !== $order) {
			$query[] = sprintf('ORDER BY %s', $this -> getAdapter() -> escape($order));			
		}

		//Limit
		if(null !== $limit) {
			$query[] = sprintf('LIMIT %s', $this -> getAdapter() -> escape($limit));
		}

		return $this -> getAdapter() -> query(implode(' ', $query), $params) -> execute();
	}
793096
public function select($columns = "*")
    {
        $this->start = $columns;
        $this->queryType = self::QUERY_SELECT;
        return $this;
    }
418982
public static function findColumns (array $columns, int $limit=0, string $order="DESC")
	{
		$order 	   	= static::validateOrder($order);
        $dbObject  	= Database::getInstance();
		$columns 	= joinArray($dbObject->escapeValues($columns), ', ');
		return static::limitFindBySql("SELECT {$columns} FROM ".static::$tableName." ORDER BY id {$order}", $limit);
	}
697089
def _select_limit_statement(table, cols='*', offset=0, limit=MAX_ROWS_PER_QUERY):
        """"""
        return 'SELECT {0} FROM {1} LIMIT {2}, {3}'.format(join_cols(cols), wrap(table), offset, limit)
4126
public function getRow($table, $cols, $options = array(), $start = 0)
    {
        // Set Limit
        $options['L'] = $start . ",1";

        // Get Result
        $result = $this->get($table, $cols, $options);
        if (count($result['data']) >= 1) {
            return $result['data'][0];
        } else {
            return array();
        }
    }
280014
public static function orderBy($col = 'id', $type='asc')
    {
        try {
            self::init();
            $query = 'SELECT * FROM ' . self::$modelTable . ' ORDER BY '.$col. ' '.$type;
            return new QueryBuilder(self::$connect, $query);

        } catch (\Exception $exception) {
            var_dump($exception->getMessage());
        }
    }
810039
def fetchone(table, cols="*", where=(), group="", order=(), limit=(), **kwargs):
    """"""
    return select(table, cols, where, group, order, limit, **kwargs).fetchone()
680340
public function selectAll($limit = 0)
	{
		$stmt = $this->pdo->prepare(<<<EOT
SELECT 
	t1.*,
	t2.ProjectId AS "Project.ProjectId",
	t2.Name AS "Project.Name",
	t2.Description AS "Project.Description",
	t2.Created AS "Project.Created"   
FROM `$this->tableName` AS t1 
LEFT JOIN Projects AS t2 ON t1.ProjectId = t2.ProjectId 
ORDER BY t1.Started DESC ;
EOT
		);
		$res = $stmt->execute();

		if ($res === false) {
			return array();
		}

		$rows = $stmt->fetchAll();

		$ret = array();
		foreach ($rows as $row) {
			array_push($ret, $this->prepareEntity($row));
		}

		return $ret;
	}
944239
def select(table, cols="*", where=(), group="", order=(), limit=(), **kwargs):
    """"""
    where = dict(where, **kwargs).items()
    sql, args = makeSQL("SELECT", table, cols, where, group, order, limit)
    return execute(sql, args)
439460
public static function findColumn (string $column, int $limit=0, string $order="DESC")
	{
		$order 		= static::validateOrder($order);
        $dbObject 	= Database::getInstance();
        $column 	= $dbObject->escapeValue($column);
		return static::limitFindBySql("SELECT {$column} FROM ".static::$tableName." ORDER BY id {$order}", $limit);
	}
1063409
public final function select(...$fileds) {
        if (empty($fileds) || !isset($fileds[0])) {
            if (isset($this->fields) && $this->fields) {
                $fileds = $this->defaultQueryFields;
            } else {
                $fileds = '*';
            }
        }
        $sql      = new Query($fileds);
        $sql->orm = new Orm($this, $this->primaryKeys[0]);
        $sql->setDialect($this->dialect)->from($this->qualifiedName);

        return $sql;
    }
408590
public function sql(string $fields = null, string $where = null, string $orderBy = null, string $limit = null): string
    {
        $this->statement->select($fields, $where, $orderBy, $limit);

        // 语句真正被创建
        $this->statement->create();

        // 返回相应的SQL语句
        return $this->statement->getSql();
    }
32241
public function find($table, $fields = null, $where = null, $order = null, $limit = null, $offset = null, $array = array(), $fetchMode = \PDO::FETCH_ASSOC)
     {
         $sql = ' SELECT '.(($fields) ?? '*').' FROM '.(($table)).(($where) ? ' WHERE '.$where : ' ')
            .(($limit) ? ' LIMIT '.$limit : ' ')
            .(($offset && $limit) ? ' OFFSET '.$offset : ' ')
            .(($order) ? ' ORDER BY '.$order : ' ');

         $stmt = $this->conn->prepare($sql);

         foreach ($array as $key => $values) {
             return  $stmt->bindValue("$key", $values);
         }
         $stmt->execute();

         do {
             return $stmt->fetchAll($fetchMode);
         } while (
            $stmt->nextRowset());
         $stmt->close();
     }
225417
def select_record(self, table, where=None, values=None, orderby=None, limit=None, columns=None):
        ''' '''
        query = self.schema.query_builder.build_select(table, where, orderby, limit, columns)
        return table.to_table(self.execute(query, values), columns=columns)
748584
def fetch(table, cols="*", where=(), group="", order=(), limit=(), **kwargs):
    """"""
    return select(table, cols, where, group, order, limit, **kwargs).fetchall()
1036033
public static function get_records_select($select, $params = null, $sort = '', $fields = '*', $limitfrom = 0, $limitnum = 0) {
        global $DB;

        $records = $DB->get_records_select(static::TABLE, $select, $params, $sort, $fields, $limitfrom, $limitnum);

        // We return class instances.
        $instances = array();
        foreach ($records as $key => $record) {
            $instances[$key] = new static(0, $record);
        }

        return $instances;

    }