mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Refactoring [5988]
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5989 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
656ab3a9ab
commit
dbe9beb6cb
3 changed files with 8 additions and 11 deletions
|
@ -42,13 +42,6 @@ class DataSource extends Object {
|
|||
* @access public
|
||||
*/
|
||||
var $connected = false;
|
||||
/**
|
||||
* Print debug info?
|
||||
*
|
||||
* @var boolean
|
||||
* @access public
|
||||
*/
|
||||
var $debug = false;
|
||||
/**
|
||||
* Print full query debug info?
|
||||
*
|
||||
|
|
|
@ -89,6 +89,7 @@ class DboSource extends DataSource {
|
|||
*/
|
||||
function __construct($config = null, $autoConnect = true) {
|
||||
parent::__construct($config);
|
||||
$this->fullDebug = Configure::read() > 1;
|
||||
|
||||
if ($autoConnect) {
|
||||
return $this->connect();
|
||||
|
@ -428,11 +429,11 @@ class DboSource extends DataSource {
|
|||
*/
|
||||
function showQuery($sql) {
|
||||
$error = $this->error;
|
||||
if (strlen($sql) > 200 && Configure::read() > 1) {
|
||||
if (strlen($sql) > 200 && !$this->fullDebug && Configure::read() > 1) {
|
||||
$sql = substr($sql, 0, 200) . '[...]';
|
||||
}
|
||||
|
||||
if (($error) && Configure::read() > 0) {
|
||||
if (($error) && Configure::read() > 1) {
|
||||
e("<p style = \"text-align:left\"><b>Query:</b> {$sql} ");
|
||||
if ($error) {
|
||||
trigger_error("<span style = \"color:Red;text-align:left\"><b>SQL Error:</b> {$this->error}</span>", E_USER_WARNING);
|
||||
|
|
|
@ -593,6 +593,7 @@ class DboTest extends DboMysql {
|
|||
* @subpackage cake.tests.cases.libs.model.datasources
|
||||
*/
|
||||
class DboSourceTest extends CakeTestCase {
|
||||
var $debug = null;
|
||||
|
||||
function setUp() {
|
||||
$this->_initDb();
|
||||
|
@ -603,16 +604,18 @@ class DboSourceTest extends CakeTestCase {
|
|||
} else {
|
||||
$config = $config->default;
|
||||
}
|
||||
$this->debug = Configure::read('debug');
|
||||
Configure::write('debug', 1);
|
||||
$this->db =& new DboTest($config);
|
||||
$this->db->fullDebug = false;
|
||||
$this->Model = new TestModel();
|
||||
$db =& ConnectionManager::getDataSource($this->Model->useDbConfig);
|
||||
$db->fullDebug = false;
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
unset($this->Model);
|
||||
unset($this->db);
|
||||
Configure::write('debug', $this->debug);
|
||||
unset($this->debug);
|
||||
}
|
||||
|
||||
function testGenerateAssociationQuerySelfJoin() {
|
||||
|
|
Loading…
Reference in a new issue