Enforce the Where parameter for Query Builder |
When using the update and delete methods with Builder, how do I ensure that the operation fails if where is not specified? Which files do we need to check?
Check the builder's result to see if it is true or false (or null).. Do you need it?
$builder->getCompiledQBWhere()
When the Where condition is not specified, we do not want to take this risk because the entire table will be updated or deleted. So we don't want a query without a where condition to go to the database.
If there is no where in the update and delete arguments when creating or creating the active records tsql code, instead of sending the tsql code to sqle, stop the script and suppress the error. Translated with DeepL (04-04-2024, 08:53 PM)mywebmanavgat Wrote: When the Where condition is not specified, we do not want to take this risk because the entire table will be updated or deleted. So we don't want a query without a where condition to go to the database.
maybe try event beforeDelete, beforeUpdate?
|
Welcome Guest, Not a member yet? Register Sign In |