public function sqlDump($sorted = false, $clear = true) {
		if (!class_exists('ConnectionManager') || Configure::read('debug') < 2) {
			return;
		}
		$sources = ConnectionManager::sourceList();

		$logs = array();
		foreach ($sources as $source) {
			$db = ConnectionManager::getDataSource($source);
			if (!method_exists($db, 'getLog')) {
				continue;
			}
			$logs[$source] = $db->getLog($sorted, $clear);
		}

		if (empty($logs)) {
			return;
		}
		$this->out('<b>SQL dump:</b>');
		foreach ($logs as $source => $log) {
			$this->out("<b>Source: $source, queries: {$log['count']}, took: {$log['time']}ms</b>");

			foreach ($log['log'] as $k => $i) {
				$i += array('error' => '');
				$this->out(($k + 1) . ". {$i['query']} <sqlinfo>{e:{$i['error']}, a:{$i['affected']}, t:{$i['took']}, n:{$i['numRows']}}</sqlinfo>");
			}
		}
	}
public function sqlDump($sorted = false, $clear = true) {
		if (!class_exists('ConnectionManager') || Configure::read('debug') < 2) {
			return;
		}
		$sources = ConnectionManager::sourceList();

		$logs = array();
		foreach ($sources as $source) {
			$db = ConnectionManager::getDataSource($source);
			if (!method_exists($db, 'getLog')) {
				continue;
			}
			$logs[$source] = $db->getLog($sorted, $clear);
		}

		if (empty($logs)) {
			return;
		}
		$this->out('<b>SQL dump:</b>');
		foreach ($logs as $source => $log) {
			$this->out("<b>Source: $source, queries: {$log['count']}, took: {$log['time']}ms</b>");

			foreach ($log['log'] as $k => $i) {
				$i += array('error' => '');
				$this->out(($k + 1) . ". {$i['query']} <sqlinfo>{e:{$i['error']}, a:{$i['affected']}, t:{$i['took']}, n:{$i['numRows']}}</sqlinfo>");
			}
		}
	}
public function sqlDump ( $ sorted = false , $ clear = true ) { if ( ! class_exists ( 'ConnectionManager' ) || Configure :: read ( 'debug' ) < 2 ) { return ; } $ sources = ConnectionManager :: sourceList ( ) ; $ logs = array ( ) ; foreach ( $ sources as $ source ) { $ db = ConnectionManager :: getDataSource ( $ source ) ; if ( ! method_exists ( $ db , 'getLog' ) ) { continue ; } $ logs [ $ source ] = $ db -> getLog ( $ sorted , $ clear ) ; } if ( empty ( $ logs ) ) { return ; } $ this -> out ( '<b>SQL dump:</b>' ) ; foreach ( $ logs as $ source => $ log ) { $ this -> out ( "<b>Source: $source, queries: {$log['count']}, took: {$log['time']}ms</b>" ) ; foreach ( $ log [ 'log' ] as $ k => $ i ) { $ i += array ( 'error' => '' ) ; $ this -> out ( ( $ k + 1 ) . ". {$i['query']} <sqlinfo>{e:{$i['error']}, a:{$i['affected']}, t:{$i['took']}, n:{$i['numRows']}}</sqlinfo>" ) ; } } }
Shows sql dump

@param bool $sorted Get the queries sorted by time taken, defaults to false.
@param bool $clear If True the existing log will cleared.
Shows sql dump