Skip to content

Conversation

fabianfett
Copy link
Collaborator

Motivation

Currently Prepared Statements only work if they only use bindings that have the PostgresDataType text. The reason for this is that text has the same representation in text and binary form. For this reason Postgres does not need to know the datatype upfront.

Changes

  • Allow users to specify the bindings datatypes explicitly. Fallback to unspecified.
  • If binding datatypes are unspecified infer them from the first provided bindings
  • Allow users to override the prepared statement name
  • Add integration test that validates the behavior

@fabianfett fabianfett added the semver-minor Adds new public API. label Feb 21, 2024
@fabianfett fabianfett requested a review from gwynne February 21, 2024 13:16
@codecov-commenter
Copy link

codecov-commenter commented Feb 21, 2024

Codecov Report

❌ Patch coverage is 84.61538% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.02%. Comparing base (85d189c) to head (738d0b7).
⚠️ Report is 60 commits behind head on main.

Files with missing lines Patch % Lines
...es/PostgresNIO/Connection/PostgresConnection.swift 40.00% 3 Missing ⚠️
Sources/PostgresNIO/New/PSQLTask.swift 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #455      +/-   ##
==========================================
- Coverage   62.05%   62.02%   -0.04%     
==========================================
  Files         124      125       +1     
  Lines        9971     9980       +9     
==========================================
+ Hits         6188     6190       +2     
- Misses       3783     3790       +7     
Files with missing lines Coverage Δ
...nection State Machine/ConnectionStateMachine.swift 63.48% <100.00%> (ø)
...tion State Machine/ExtendedQueryStateMachine.swift 79.59% <100.00%> (ø)
...urces/PostgresNIO/New/PostgresChannelHandler.swift 84.31% <100.00%> (+0.02%) ⬆️
Sources/PostgresNIO/New/PreparedStatement.swift 100.00% <100.00%> (ø)
Sources/PostgresNIO/New/PSQLTask.swift 77.77% <83.33%> (-0.35%) ⬇️
...es/PostgresNIO/Connection/PostgresConnection.swift 42.28% <40.00%> (-0.20%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fabianfett fabianfett force-pushed the ff-fix-prepared-statements branch from ba9349d to 738d0b7 Compare February 21, 2024 16:42
@fabianfett fabianfett merged commit 0679ede into vapor:main Feb 21, 2024
@fabianfett fabianfett deleted the ff-fix-prepared-statements branch February 21, 2024 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants