Prado\Data\Common\TDbCommandBuilder::applyLimitOffset PHP 메소드

applyLimitOffset() 공개 메소드

Alters the sql to apply $limit and $offset. Default implementation is applicable for PostgreSQL, MySQL and SQLite.
public applyLimitOffset ( $sql, $limit, $offset ) : string
리턴 string SQL with limit and offset.
    public function applyLimitOffset($sql, $limit = -1, $offset = -1)
    {
        $limit = $limit !== null ? (int) $limit : -1;
        $offset = $offset !== null ? (int) $offset : -1;
        $limitStr = $limit >= 0 ? ' LIMIT ' . $limit : '';
        $offsetStr = $offset >= 0 ? ' OFFSET ' . $offset : '';
        return $sql . $limitStr . $offsetStr;
    }