Skip to content

Normalize parameter binding and update API type handling#4

Merged
bernard-ng merged 3 commits intomainfrom
improve-dx
Mar 17, 2026
Merged

Normalize parameter binding and update API type handling#4
bernard-ng merged 3 commits intomainfrom
improve-dx

Conversation

@bernard-ng
Copy link
Member

This pull request introduces a new release (v1.1.2) with two major improvements: it standardizes the return value of single-row fetch methods (fetchNumeric(), fetchAssociative(), and fetchOne()) to return undefined instead of false when no row is available, and it normalizes bound query parameters so that undefined is treated as SQL NULL before reaching the driver. These changes improve consistency across drivers, prevent binding errors (especially with MySQL), and align the codebase with modern JavaScript/TypeScript conventions. The updates are reflected throughout the implementation, tests, and metadata-provider integrations.

Fetch methods contract and test alignment:

  • Refactored fetchNumeric(), fetchAssociative(), and fetchOne() in Result, Connection, QueryBuilder, portability wrappers, and all bundled drivers to return undefined instead of false when no row is available. All relevant unit tests and metadata-provider integrations were updated to expect undefined as the sentinel value. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21]

Parameter normalization and binding improvements:

  • Normalized bound query parameter values so that undefined is converted to SQL NULL (null) before binding to driver statements, preventing errors (notably with mysql2) and ensuring consistency between positional and named parameter flows. [1] [2] [3]

Versioning and documentation:

  • Bumped the package version to 1.1.2 and updated the CHANGELOG.md to document these changes. [1] [2]

@bernard-ng bernard-ng merged commit aa9cfb5 into main Mar 17, 2026
24 of 40 checks passed
@bernard-ng bernard-ng deleted the improve-dx branch March 17, 2026 18:26
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