fix(database): classify prepared query exceptions#10182
Open
memleakd wants to merge 5 commits intocodeigniter4:4.8from
Open
fix(database): classify prepared query exceptions#10182memleakd wants to merge 5 commits intocodeigniter4:4.8from
memleakd wants to merge 5 commits intocodeigniter4:4.8from
Conversation
- Reuse semantic database exception classification for prepared query failures - Store typed exceptions for prepared queries when DBDebug is disabled - Document prepared query exception behavior Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
- Execute prepared statements through the send/get-result flow - Classify Postgre prepared failures from structured SQLSTATE diagnostics Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
- Classify OCI8 unique and retryable transaction errors from string codes - Add coverage for OCI8 string-code exception classification Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
- Capture native OCI8 statement errors during prepared execution - Route OCI8 prepared failures through shared exception classification Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
87f8256 to
4a0b49c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This is a follow-up to #10162, based on @michalsn’s request to make prepared queries use the same typed database exceptions as normal queries.
Prepared query failures now go through the shared database exception classification, so they can throw or store
UniqueConstraintViolationExceptionandRetryableTransactionExceptionwhen applicable. This also keepsgetLastException()useful whenDBDebugis disabled.For Postgre, prepared execution now preserves SQLSTATE from the result diagnostics, matching the normal query path and avoiding classification from connection-level error text.
Note
This exposes the connection exception factory and last-exception setter to the database component as
@internalmethods so classification can stay centralized.Tests cover the shared prepared-query failure path,
DBDebug=false, and live unique-constraint behavior.Checklist: