![]() |
Enforce the Where parameter for Query Builder - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Enforce the Where parameter for Query Builder (/showthread.php?tid=90573) |
Enforce the Where parameter for Query Builder - mywebmanavgat - 04-04-2024 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? RE: Enforce the Where parameter for Query Builder - ozornick - 04-04-2024 Check the builder's result to see if it is true or false (or null).. Do you need it? RE: Enforce the Where parameter for Query Builder - kenjis - 04-04-2024 $builder->getCompiledQBWhere() RE: Enforce the Where parameter for Query Builder - mywebmanavgat - 04-04-2024 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. RE: Enforce the Where parameter for Query Builder - ozornick - 04-04-2024 maybe try event beforeDelete, beforeUpdate? |