1. Edit \app\Config\core.php, Configure::write(‘debug’, 2);, as shown in Figure 1

2. Edit \app\View\Layouts\base.ctp, <?php echo $this->element(‘sql_dump’); ?>, as shown in Figure 2

3. After a GET request, the executed SQL statements are printed in the view, as shown in Figure 3

4. If it is a POST request, a direct redirect occurs upon successful execution, so the executed SQL statements need to be printed in the controller, as shown in Figure 4

5. After successful execution and before the redirect, print the executed SQL statements of the Product model, as shown in Figure 5
$log = $this->Product->getDataSource()->getLog(false, false);
debug($log);
exit;

6. A total of 10 records, as shown in Figure 6

7. After successful execution and before the redirect, print all executed SQL statements, as shown in Figure 7
$db =& ConnectionManager::getDataSource(‘tmp’);
$db->showLog();
exit;

8. A total of 10 records, as shown in Figure 8

