Only set WHERE filters on delete() if conditions are provided #51

Closed
vlw wants to merge 2 commits from refs/pull/51/head into master
vlw commented 2025-07-29 09:43:47 +02:00 (Migrated from codeberg.org)

This PR fixes a bug where if no conditions are passed to MySQL->from("table")->delete(), the generated query will look like this:

DELETE FROM `table` WHERE 

This is obviously invalid SQL syntax. This PR only adds the WHERE keyword and rules if conditions have been supplied to either where() or with delete([])

This PR fixes a bug where if no conditions are passed to `MySQL->from("table")->delete()`, the generated query will look like this: ```sql DELETE FROM `table` WHERE ``` This is obviously invalid SQL syntax. This PR only adds the `WHERE` keyword and rules if conditions have been supplied to either `where()` or with `delete([])`
vlw commented 2025-07-29 09:48:38 +02:00 (Migrated from codeberg.org)

image
Again.. this PR is actually merged (I am getting kind of tired of this Codeberg/Forgejo bug).

![image](/attachments/474f7e24-bb96-471c-bc5f-aa10268e6e78) Again.. this PR is actually merged (I am getting kind of tired of this Codeberg/Forgejo bug).

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
vlw/php-mysql!51
No description provided.