fix: Not allowed empty PK value for update() and delete()#9837
Closed
neznaika0 wants to merge 1 commit intocodeigniter4:4.7from
Closed
fix: Not allowed empty PK value for update() and delete()#9837neznaika0 wants to merge 1 commit intocodeigniter4:4.7from
neznaika0 wants to merge 1 commit intocodeigniter4:4.7from
Conversation
d348aef to
cd6ebfc
Compare
Contributor
Author
|
@michalsn We can discuss with an example. PR is not virtual. |
Member
|
Good direction. Yesterday evening, I started putting together a version of how I'd like it to work/look. I'll try to send a PR on Sunday, as I'll be AFK today. |
|
👋 Hi, @neznaika0! |
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
Comment #9830 (comment)
For the event, I returned the transfer of an array IDs or
null.An attempt to return the check for incorrect PK update()/delete(). Values of
'' 0 '0' nulland the same values in the array[1 => null, 2 => '', 3 => '0',...]are invalid, they can cause SQL exception. We intercept this before executing the query and throw our DatabaseException.In this state, it only solves for the
$idpassed todelete(),update(). But we can pass the value viawhere('id', [1, 2, 3])-> update()orwhereIn('id', [1, 2, 3])-> update()and other. Therefore, I need to know whether to handle these cases or return an SQL exception to the user?Example bad SQL:
Checklist: