vapor / postgres-nio

🐘 Non-blocking, event-driven Swift client for PostgreSQL.
https://api.vapor.codes/postgresnio/documentation/postgresnio/
MIT License
317 stars 72 forks source link

Remove PrepareStatementStateMachine #391

Closed fabianfett closed 1 year ago

fabianfett commented 1 year ago

Preparing a statement is a substep of running an extended query. For this reason we should reuse the ExtendedQueryStateMachine as much as we can. This patch removes the PrepareStatementStateMachine and uses the ExtendedQueryStateMachine. As a result of this we can simplify our code in lots of other places.

codecov-commenter commented 1 year ago

Codecov Report

Merging #391 (7e4baca) into main (220eb50) will decrease coverage by 1.55%. Report is 1 commits behind head on main. The diff coverage is 72.18%.

:exclamation: Current head 7e4baca differs from pull request most recent head 85fd93a. Consider uploading reports for the commit 85fd93a to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #391 +/- ## ========================================== - Coverage 46.02% 44.47% -1.55% ========================================== Files 110 109 -1 Lines 8833 8724 -109 ========================================== - Hits 4065 3880 -185 - Misses 4768 4844 +76 ``` | [Files Changed](https://app.codecov.io/gh/vapor/postgres-nio/pull/391?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor) | Coverage Δ | | |---|---|---| | [...es/PostgresNIO/Connection/PostgresConnection.swift](https://app.codecov.io/gh/vapor/postgres-nio/pull/391?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9Qb3N0Z3Jlc05JTy9Db25uZWN0aW9uL1Bvc3RncmVzQ29ubmVjdGlvbi5zd2lmdA==) | `35.45% <0.00%> (-0.10%)` | :arrow_down: | | [Sources/PostgresNIO/New/PSQLTask.swift](https://app.codecov.io/gh/vapor/postgres-nio/pull/391?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9Qb3N0Z3Jlc05JTy9OZXcvUFNRTFRhc2suc3dpZnQ=) | `19.35% <28.57%> (-13.98%)` | :arrow_down: | | [...nection State Machine/ConnectionStateMachine.swift](https://app.codecov.io/gh/vapor/postgres-nio/pull/391?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9Qb3N0Z3Jlc05JTy9OZXcvQ29ubmVjdGlvbiBTdGF0ZSBNYWNoaW5lL0Nvbm5lY3Rpb25TdGF0ZU1hY2hpbmUuc3dpZnQ=) | `55.68% <40.00%> (-0.53%)` | :arrow_down: | | [...urces/PostgresNIO/New/PostgresChannelHandler.swift](https://app.codecov.io/gh/vapor/postgres-nio/pull/391?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9Qb3N0Z3Jlc05JTy9OZXcvUG9zdGdyZXNDaGFubmVsSGFuZGxlci5zd2lmdA==) | `72.27% <65.38%> (+0.84%)` | :arrow_up: | | [...tion State Machine/ExtendedQueryStateMachine.swift](https://app.codecov.io/gh/vapor/postgres-nio/pull/391?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9Qb3N0Z3Jlc05JTy9OZXcvQ29ubmVjdGlvbiBTdGF0ZSBNYWNoaW5lL0V4dGVuZGVkUXVlcnlTdGF0ZU1hY2hpbmUuc3dpZnQ=) | `76.27% <90.32%> (+2.08%)` | :arrow_up: | | [Sources/PostgresNIO/New/PSQLRowStream.swift](https://app.codecov.io/gh/vapor/postgres-nio/pull/391?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9Qb3N0Z3Jlc05JTy9OZXcvUFNRTFJvd1N0cmVhbS5zd2lmdA==) | `54.48% <100.00%> (-30.52%)` | :arrow_down: | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/vapor/postgres-nio/pull/391/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor)