Get all by SQL with specific offset and limit
@param fullSql
@param offset		the number of first record in the whole query result to be returned, records numbers start from 0
@param limit			the maximum number of records to return
@return the query result
511559
public List< T> getAllBySql(String fullSql, Integer offset, Integer limit) {
		return getAllBySql(fullSql, null, null, offset, limit);
	}
703621
def get_find_all_query(self, table_name, constraints=None, *, columns=None, order_by=None,
                         limiting=(None, None)):
    
    where, params = self.parse_constraints(constraints)

    if columns:
      if isinstance(columns, str):
        pass
      else:
        columns = ", ".join(columns)
    else:
      columns = "*"

    if order_by:
      order = " order by {0}".format(order_by)
    else:
      order = ""

    paging = ""
    if limiting is not None:
      limit, offset = limiting
      if limit is not None:
        paging += " limit {0}".format(limit)
      if offset is not None:
        paging += " offset {0}".format(offset)

    return ("select {0} from {1} where {2}{3}{4}".format(
      columns,
      table_name,
      where or "1 = 1",
      order,
      paging
    ), params)
394613
public Query offset(final Integer offset) {
        this.offset = offset;

        // If we defined offset without limit, force a limit to handle MySQL and others gracefully.
        if (limit <= 0) {
            limit = Integer.MAX_VALUE - offset;
        }

        return this;
    }
80631
public function get($term = null, $limit = null, $offset = 0)
    {
        if (false === $this->has_table()) return false;

        $term = $this->normalize_term($term);

        $this->db->where($term);

        $limit !== null || $limit = $this->data_limit;

        // Limit the result if $limit is int and greater than 0
        if (false !== $limit and is_int($limit) and $limit > 0) {
            // Forget about offset for now :P
            $this->db->limit($limit, $offset);
        }

        if ( ! $data = $this->db->get($this->table)) {
            $this->set_error($this->db->error());
            return false;
        }

        return 1 === $limit ? $data->row() : $data->result();
    }
1215702
private boolean nextWithoutLimit() throws SQLException {
		if (maxRows > 0 && rowsFetched >= maxRows) {
			System.out.println("Reach max rows " + maxRows);
			return false;
		}

		if ((recordItr == null || !recordItr.hasNext()) && !emptyResultSet) {
			TSFetchResultsReq req = new TSFetchResultsReq(sql, fetchSize);

			try {
				TSFetchResultsResp resp = client.fetchResults(req);
				Utils.verifySuccess(resp.getStatus());
				if (!resp.hasResultSet) {
					emptyResultSet = true;
				} else {
					TSQueryDataSet tsQueryDataSet = resp.getQueryDataSet();
					List<RowRecord> records = Utils.convertRowRecords(tsQueryDataSet);
					recordItr = records.iterator();
				}
			} catch (TException e) {
				throw new SQLException("Cannot fetch result from server, because of network connection");
			}

		}
		if (emptyResultSet) {
			return false;
		}
		record = recordItr.next();
		// if(record.getDeltaObjectType() != null &&
		// record.getDeltaObjectType().equals(AGGREGATION_STR)){
		// if(columnInfo.containsKey(TIMESTAMP_STR)){
		// columnInfo.remove(TIMESTAMP_STR);
		// }
		// }

		rowsFetched++;
        // maxRows is a constraint that exists in parallel with the LIMIT&SLIMIT constraints,
        // so rowsFetched will increase whenever the row is fetched,
        // regardless of whether the row satisfies the LIMIT&SLIMIT constraints or not.

		return true;
	}
663912
private function fetchRangeIds($limit, $start)
    {
        $qb = $this->createFilterAndSortQueryBuilder();
        $qb->select(['t.id', 'e.latest_version']);

        if (null !== $limit) {
            $qb->setFirstResult($start);
            $qb->setMaxResults($limit);
        }

        $rows = $this->connection->fetchAll($qb->getSQL());

        $ids = [];
        foreach ($rows as $row) {
            $ids[$row['id']] = $row['latest_version'];
        }

        return $ids;
    }
1051049
private boolean query()
		throws SQLException
	{
		statement = this.connection.createStatement();

		String query = "SELECT PrimaryKey, RevisionCounter,"
				+ " RevisionID, ArticleID, Timestamp, FullRevisionID "
				+ "FROM revisions";

		if (primaryKey > 0) {
			query += " WHERE PrimaryKey > " + primaryKey;
		}

		if (MAX_NUMBER_RESULTS > 0) {
			query += " LIMIT " + MAX_NUMBER_RESULTS;
		}

		result = statement.executeQuery(query);
		return result.next();
	}
185335
public List<ComponentDto> selectByQuery(DbSession session, ComponentQuery query, int offset, int limit) {
    return selectByQueryImpl(session, null, query, offset, limit);
  }
281927
function applyLimit(&$sql, $offset, $limit) {

		$max = $offset + $limit;

		// nesting all queries, in case there's already a WHERE clause
		$sql = <<<EOF
SELECT A.*, rownum AS PROPEL\$ROWNUM
FROM (
  $sql
) A
WHERE rownum <= $max
EOF;

		if ($offset > 0) {
			$sql = <<<EOF
SELECT B.*
FROM (
  $sql
) B
WHERE B.PROPEL\$ROWNUM > $offset
EOF;
		}
	}
490444
@Override
	public SqlEntityQuery<E> offset(final long offset) {
		if (!agent().getSqlConfig().getDialect().supportsLimitClause()) {
			throw new UroborosqlRuntimeException("Unsupported offset clause.");
		}
		this.offset = offset;
		return this;
	}
822561
public function get($limit = 0, $offset = 0)
    {

        //check if there is an error
        if (static::$response['status'] == "error") {
           return static::terminate(static::$response);
        }

        //check if the limit is a number
        if (!is_numeric($limit)) {
            static::$response["status"] = "error";
            static::$response["response"] = "Parameter limit should be numeric at function get()";
            static::$response["code"] = 6000;

            return static::terminate(static::$response);
        }

        //check if the offset is a number
        if (!is_numeric($offset)) {
            static::$response["status"] = "error";
            static::$response["response"] = "Parameter offset should be numeric at function get()";
            static::$response["code"] = 6001;

            return static::terminate(static::$response);
        }

        $table_name = self::$table;

        /* if no column passed as param, select all	 */
        $columns = empty($this->columns) ? "*" : $this->columns;

        $query = /** @lang text */
            "SELECT {$columns} FROM {$table_name}";

        if (!empty($this->whereby)) {

            $query = $query . ' WHERE ' . $this->whereby;
        }
        if(!empty($this->groupby)){
            $query.=' GROUP BY '.$this->groupby;
        }

        if (!empty($this->order)) {
            $query .= $this->order;
        }


        if (!empty($limit)) {
            $query = $query . ' LIMIT ' . $limit;
        }
        if (!empty($offset)) {
            $query = $query . ' OFFSET ' . $offset;
        }



          return  $this->fetch($query);
    }
843865
public function findByFilter($filter, $limit = 0, $offset = 0)
    {
        $limit = $this->getLimit($limit, $offset);
        $query =
            'SELECT ' .
            $this->getFields(", ") .
            ' FROM ' .
            $this->tableName .
            ' WHERE ' .
            join(" AND ", $filter->getConditionArray()) .
            ' ' . $limit . ';';
        $statement = $this->database->prepare($query);
        $statement->execute();
        return $this->buildAll($statement->fetchAll());
    }
648240
public static String genLimitSQL(Integer offset, Integer limit) {
		StringBuilder sb = new StringBuilder();
		if (limit != null) {
			sb.append(" limit ");
			if(offset != null) {
				sb.append(offset).append(",");
			}
			sb.append(limit);
		}
		return sb.toString();
	}
124669
public ViewQuery limit(final int limit) {
        if (limit < 0) {
            throw new IllegalArgumentException("Limit must be >= 0.");
        }
        params[PARAM_LIMIT_OFFSET] = "limit";
        params[PARAM_LIMIT_OFFSET+1] = Integer.toString(limit);
        return this;
    }
619917
private function getSearchQueryLimit($query, $limit, $offset)
	{
		if ($limit > -1) {
			$query->limit($limit);
			$query->offset($offset);
		}

		return $query;
	}
461884
protected function _buildLimitPart($limit, $query)
    {
        if ($limit === null || $query->clause('offset') === null) {
            return '';
        }

        return sprintf(' FETCH FIRST %d ROWS ONLY', $limit);
    }
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;
	}