phpmyadmin / phpmyadmin/shapefile

Add a max number of records to load

Open
#42 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
28
Forks
11
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at \PhpMyAdmin\ShapeFile\ShapeFile::loadRecords and inspect how record loading is exposed and how the maximum should be configured. Define the intended behavior for an unset or disabled limit, then verify that loading stops after the requested number of records without changing unrestricted loading.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.