Skip to content

test(import): a CSV all the way to the statements that load it - #655

Merged
EVWorth merged 1 commit into
mainfrom
test/csv-roundtrip
Sep 12, 2026
Merged

EVWorth merged 1 commit into
mainfrom
test/csv-roundtrip

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Import audit F8, the last item in #362 worth doing.

The parser and the INSERT builder each had tests. Nothing checked that what comes out of one is what the other needs — which is exactly where the empty-cell distinction was lost before #578: ,, and ,"", both arrived as "" and both became NULL.

Twelve cases through both stages:

  • an absent cell versus an empty one (NULL versus '')
  • a quote inside a value, and one built to end its own statement — the shape that dropped a table through the old escaping ([P1][doc-drift] Parameterized queries are promised in DESIGN_REQUIREMENTS but execute_query does not accept params #285)
  • a comma and a newline inside a quoted field
  • a doubled quote
  • a short row, whose missing cells are absent rather than empty
  • a column name that needs quoting
  • batching at 100 rows to a statement
  • a header-only file
  • the literal word NULL, which is a string when the file wrote it
  • a leading zero, which survives because every value is quoted and the column's type decides

The SQL they produce was run against MySQL 8.0.46 and the rows read back are the ones asserted here.

2715 unit tests.

The parser and the INSERT builder each had tests; nothing checked that
what comes out of one is what the other needs. That gap is where the
empty-cell distinction was lost before #578 — `,,` and `,"",` both
arriving as `""`.

Twelve cases through both: absent versus empty, a quote inside a value,
a value built to end its own statement, a comma and a newline inside a
quoted field, a doubled quote, a short row, a column name that needs
quoting, batching at 100, a header-only file, the literal word NULL, and
a leading zero.

The SQL they produce was run against MySQL 8.0.46 and the rows read back
are the ones asserted here.

Import audit F8.
@EVWorth
EVWorth merged commit 1ac5ade into main Sep 12, 2026
12 checks passed
@EVWorth
EVWorth deleted the test/csv-roundtrip branch September 12, 2026 04:24
@EVWorth EVWorth mentioned this pull request Sep 12, 2026
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant