Skip to content

fix(builder): quote values that contain ( - #309

Draft
dhensby wants to merge 2 commits into
tediousjs:masterfrom
dhensby:fix/quote-bare-paren
Draft

dhensby wants to merge 2 commits into
tediousjs:masterfrom
dhensby:fix/quote-bare-paren

Conversation

@dhensby

@dhensby dhensby commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

build() now puts a value that contains ( in braces. Before, the quoting pattern matched the two characters |(, not a bare (. So a value such as a(b stayed unquoted, unless it also had another special character. This PR also adds a README section on build().

Changes

  • build() quotes a value that contains any of []{}(),;?*=!@. This is the list from the ODBC SQLDriverConnect documentation. A bare | is not in the list, so it stays unquoted.
  • The README documents build(): an example, the encoding rules, and that the output is the ODBC format, not a SqlClient connection string. It also describes the current behaviour for a value that is already in braces: build() writes it unchanged. Item 2 of Parser swallows the pair after an empty value; builder mis-quotes brace-wrapped values and a bare ( #279 is about that behaviour, and this PR does not change it.

Behaviour changes

Only values that contain ( change, and the change only adds braces. For example, build({ Pwd: 'a(b' }) now gives Pwd={a(b}, not Pwd=a(b. parse() reads both forms as a(b.

Testing

  • The new tests for the ODBC list and for ( fail on 1.1.3 and pass on this branch. The list test also fails if any one character is removed from the pattern.
  • I compared 1.1.3 and this branch for every UTF-16 code unit, alone and in short values. The only difference is (.
  • npm run lint, tsc --noEmit, npm run build and commitlint pass on each commit. All 74 tests pass on Node 20, 22, 24 and 26.

Part of #279.

🤖 Generated with Claude Code

dhensby and others added 2 commits November 29, 2026 09:22
The quoting pattern had `\|\(`, which matches the two characters `|(`,
not `(`. So build() did not put a value such as `a(b` in braces, unless
the value also had another special character, such as `)`.

Use the character list from the ODBC SQLDriverConnect documentation:
[]{}(),;?*=!@. Only values that contain `(` change, and the change only
adds braces. A bare `|` is not in that list, so it stays unquoted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README did not describe build(). Add a section with an example and
the encoding rules: booleans, empty values, when a value goes in braces,
how a `}` and a `=` in a key are escaped, and that the output is the
ODBC format, not a SqlClient connection string.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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