Skip to content

feat: add --max-rows flag to limit input size#109

Merged
vmvarela merged 5 commits intomasterfrom
issue-82/add-max-rows-flag
Apr 29, 2026
Merged

feat: add --max-rows flag to limit input size#109
vmvarela merged 5 commits intomasterfrom
issue-82/add-max-rows-flag

Conversation

@vmvarela
Copy link
Copy Markdown
Owner

Closes #82

Summary

  • Adds --max-rows <n> flag; after inserting n rows, stops reading and exits with code 1 and error: input exceeds --max-rows limit (<n> rows) on stderr
  • --max-rows 0 or non-integer value prints a usage error
  • Flag documented in --help, README.md, and docs/sql-pipe.1.scd
  • Tests cover: normal operation (under/at limit), limit exceeded (error message + exit code 1), --max-rows 0 validation

Zig 0.16.0 migration (required to build)

  • Migrated std.iostd.Io API throughout (File.reader/File.writer, takeByte, buffered flush)
  • CsvReader refactored from generic to concrete *std.Io.Reader to avoid @fieldParentPtr breakage when copying the interface value out of File.Reader
  • All buffered writers now explicitly flushed before every process.exit() call
  • build.zig.zon minimum_zig_version and CI/release workflows bumped to 0.16.0

- Add --max-rows <n> CLI option; exit with error if input exceeds the limit
- Migrate to Zig 0.16.0 std.Io API (File.reader/writer, takeByte, flush)
- Fix CsvReader: non-generic struct using *std.Io.Reader to avoid fieldParentPtr breakage when copying interface value
- Flush stdout/stderr before all process.exit() calls to drain buffered writers
@github-actions github-actions Bot added type:feature New functionality type:chore Maintenance, refactoring, tooling type:docs Documentation only labels Apr 29, 2026
- Restore sqlite_static doc comment and ParsedArgs field doc comments
- Add max_rows field doc comment to ParsedArgs
- Fix --max-rows help text wording
- Migrate remaining 6 anytype writer params to *std.Io.Writer
- Fix csv.zig method indentation via zig fmt
- Add integration tests 23-25 (= form, non-numeric value, --no-type-inference path)
@vmvarela vmvarela merged commit c4e7c25 into master Apr 29, 2026
4 checks passed
@vmvarela vmvarela deleted the issue-82/add-max-rows-flag branch April 29, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:chore Maintenance, refactoring, tooling type:docs Documentation only type:feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --max-rows flag to limit input size

1 participant