CodeIgniter Forums
Database test mode in model - 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: Database test mode in model (/showthread.php?tid=75960)



Database test mode in model - kyle - 04-01-2020

I am looking for a way to use the built in transaction test mode while accessing my data through the Codeigniter Model. I want to be able to use test mode while I am developing my site to test my database functions without modifying anything.

If you manually initiate a transaction, you can set test mode to on by setting the first parameter to "true". 
PHP Code:
$this->db->transStart(true);
$this->db->query('AN SQL QUERY...');
$this->db->transComplete(); 


Is there any way to do this through the model? Or in the Database configuration settings?

Or is there a way to override the default database connection to allow for a custom setting to be put in the transStart function?