![]() |
DBDebug unexpected behavior - 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: DBDebug unexpected behavior (/showthread.php?tid=75521) |
DBDebug unexpected behavior - glihm - 02-15-2020 Sorry, me once again. In a model, I am trying to run bad sql commands to study the MySQLi behavior. As the documentation says, if 'DBDebug' is false, then the execution should not be stopped in case of MySQL errors, right? In my case, I have the line PHP Code: 'DBDebug' => (ENVIRONMENT !== 'production') and the print of the 'ENVIRONMENT' variable is 'production'. With this setup, the execution is stopped after a dummy query to insert something in a table that doesn't exists into the database. When a run a correct query, everything works as expected. Should I forgot something? As the dot in front of the 'env'... x) Thank you! glihm RE: DBDebug unexpected behavior - jreklund - 02-15-2020 In false it will always run your SQL and should return false in case of failure**. What kind of stop are you seeing? Does the entire page crash and return white? Or do you mean it stops executing the following queries. Please provide code or more information about the matter. That flag will enable you too see the errors messages* instead of returning false. It won't prevent bad code. * throw as \CodeIgniter\Database\Exceptions\DatabaseException ** Haven't confirmed this. RE: DBDebug unexpected behavior - glihm - 02-15-2020 Sorry jreklund, I will try to be more explicit. ![]() 1) Controller code PHP Code: <?php namespace App\Controllers; 2) Model code PHP Code: <?php namespace App\Models; The database only contains one table, named `t1`. If I use the correct table name, the output generated is: Code: production------<br>I want to see this print... However, if I run the code as it is in the model (table name voluntary misstaped), the output is: Code: production------<br> I have checked the logs, and the result is a CRITICAL log: Code: CRITICAL - 2020-02-15 21:57:53 --> Table 'ci4.tw' doesn't exist I have checked my CodeIgniter3 code, and I used to check the result of the database query. In the present case, I can't do it. The '.env' file is the default one, I have adjust the database password and user only. Thank you for your lights, and will still looking for a configuration that I am missing. |