Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/db/db_connection.php
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | |||||
* @var mysqli_result | * @var mysqli_result | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected $queryID = null; | protected $queryID = null; | ||||
/** | /** | ||||
* Function to handle sql errors | * Function to handle sql errors | ||||
* | * | ||||
* @var Array|string | * @var callable | ||||
* @access public | |||||
*/ | */ | ||||
public $errorHandler = ''; | protected $errorHandler = ''; | ||||
/** | /** | ||||
* Error code | * Error code | ||||
* | * | ||||
* @var int | * @var int | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected $errorCode = 0; | protected $errorCode = 0; | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Line(s) | |||||
if ( class_exists('kApplication') ) { | if ( class_exists('kApplication') ) { | ||||
// prevents "Fatal Error" on 2nd installation step (when database is empty) | // prevents "Fatal Error" on 2nd installation step (when database is empty) | ||||
parent::__construct(); | parent::__construct(); | ||||
} | } | ||||
$this->serverIndex = $server_index; | $this->serverIndex = $server_index; | ||||
if ( !$error_handler ) { | if ( !$error_handler ) { | ||||
$this->errorHandler = Array(&$this, 'handleError'); | $this->setErrorHandler(array(&$this, 'handleError')); | ||||
} | } | ||||
else { | else { | ||||
$this->errorHandler = $error_handler; | $this->setErrorHandler($error_handler); | ||||
} | } | ||||
$this->_captureStatistics = defined('DBG_CAPTURE_STATISTICS') && DBG_CAPTURE_STATISTICS && !(defined('ADMIN') && ADMIN); | $this->_captureStatistics = defined('DBG_CAPTURE_STATISTICS') && DBG_CAPTURE_STATISTICS && !(defined('ADMIN') && ADMIN); | ||||
} | } | ||||
/** | /** | ||||
* Set's custom error | * Set's custom error | ||||
* | * | ||||
▲ Show 20 Lines • Show All 744 Lines • ▼ Show 20 Line(s) | |||||
} | } | ||||
$row = reset($rows); | $row = reset($rows); | ||||
// When slave is too busy catching up with a master we'll get a NULL/empty string here. | // When slave is too busy catching up with a master we'll get a NULL/empty string here. | ||||
return is_numeric($row['Seconds_Behind_Master']) ? $row['Seconds_Behind_Master'] : false; | return is_numeric($row['Seconds_Behind_Master']) ? $row['Seconds_Behind_Master'] : false; | ||||
} | } | ||||
/** | |||||
* Sets an error handler. | |||||
* | |||||
* @param callable $error_handler Error handler. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function setErrorHandler(callable $error_handler) | |||||
{ | |||||
$this->errorHandler = $error_handler; | |||||
} | |||||
} | } | ||||
class kDBConnectionDebug extends kDBConnection { | class kDBConnectionDebug extends kDBConnection { | ||||
protected $_profileSQLs = false; | protected $_profileSQLs = false; | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 496 Lines • Show Last 20 Lines |