Skip to content

Add a max number of records to load #42

Description

@JoolsMcFly

Hi!

We have a use case where we need to only load the first N records of a file.

It's currently not supported but the change could be minimal.
So in \PhpMyAdmin\ShapeFile\ShapeFile::loadRecords we would need to change

$this->records[] = $record;

to

$this->records[] = $record;
if (count($this->records) >= $this->maxRecords) {
    break;
}

$maxRecords could be initialized to a large value or accept int or bool and code would be

$this->records[] = $record;
if ($this->maxRecords && count($this->records) >= $this->maxRecords) {
    break;
}

Thoughts?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions