本文整理匯總了PHP中DBManager::checkError方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBManager::checkError方法的具體用法?PHP DBManager::checkError怎麽用?PHP DBManager::checkError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DBManager
的用法示例。
在下文中一共展示了DBManager::checkError方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkError
/**
* @see DBManager::checkError()
*/
public function checkError($msg = '', $dieOnError = false, $stmt = null)
{
if (parent::checkError($msg, $dieOnError)) {
return true;
}
if (empty($stmt)) {
return false;
}
$err = oci_error($stmt);
if ($err) {
$error = $err['code'] . "-" . $err['message'];
$this->registerError($msg, $error, $dieOnError);
return true;
}
return false;
}
示例2: finishStatement
/**
* Finalize after statement execution
* @param mixed $res Result. If false, it failed
* @param string $msg Error message
* @return false|PreparedStatement
*/
protected function finishStatement($res, $msg)
{
$this->DBM->query_time = microtime(true) - $this->DBM->query_time;
$GLOBALS['log']->info('Query Execution Time:' . $this->DBM->query_time);
if ($this->DBM->checkError("{$msg}: Query Failed")) {
$this->stmt = false;
return false;
}
if (!$res) {
$this->DBM->registerError($msg, "Query Failed");
$this->stmt = false;
// Making sure we don't use the statement resource for error reporting
} else {
if ($this->DBM->dump_slow_queries($this->parsedSQL)) {
$this->DBM->track_slow_queries($this->parsedSQL);
}
}
return $this;
}
示例3: checkError
/**
* @see DBManager::checkError()
*/
public function checkError($msg = '', $dieOnError = false)
{
if (parent::checkError($msg, $dieOnError)) {
return true;
}
if (mysql_errno($this->getDatabase())) {
if ($this->dieOnError || $dieOnError) {
$GLOBALS['log']->fatal("MySQL error " . mysql_errno($this->database) . ": " . mysql_error($this->database));
sugar_die($msg . "MySQL error " . mysql_errno($this->database) . ": " . mysql_error($this->database));
} else {
$this->last_error = $msg . "MySQL error " . mysql_errno($this->database) . ": " . mysql_error($this->database);
$GLOBALS['log']->error("MySQL error " . mysql_errno($this->database) . ": " . mysql_error($this->database));
}
return true;
}
return false;
}
示例4: checkError
/**
* @see DBManager::checkError()
*/
public function checkError($msg = '', $dieOnError = false)
{
if (DBManager::checkError($msg, $dieOnError)) {
return true;
}
$userMsg = inDeveloperMode() ? "{$msg}: " : "";
if (mysqli_errno($this->getDatabase())) {
if ($this->dieOnError || $dieOnError) {
$GLOBALS['log']->fatal("{$msg}: MySQL error " . mysqli_errno($this->database) . ": " . mysqli_error($this->database));
sugar_die($userMsg . $GLOBALS['app_strings']['ERR_DB_FAIL']);
} else {
$this->last_error = $userMsg . "MySQL error " . mysqli_errno($this->database) . ": " . mysqli_error($this->database);
$GLOBALS['log']->error("{$msg}: MySQL error " . mysqli_errno($this->database) . ": " . mysqli_error($this->database));
}
return true;
}
return false;
}
示例5: checkError
/**
* @see DBManager::checkError()
*/
public function checkError($msg = '', $dieOnError = false)
{
if (parent::checkError($msg, $dieOnError)) {
return true;
}
if (mysql_errno($this->getDatabase())) {
if ($this->dieOnError || $dieOnError) {
//$GLOBALS['log']->fatal("MySQL error ".mysql_errno($this->database).": ".mysql_error($this->database));
if ($_REQUEST['debug'] == 1) {
ts_die($msg . "SQL Error " . mysql_errno($this->database) . ": " . mysql_error($this->database));
} else {
ts_die("SQL Error :Line 126");
}
} else {
$this->last_error = $msg . "MySQL error " . mysql_errno($this->database) . ": " . mysql_error($this->database);
//$GLOBALS['log']->error("MySQL error ".mysql_errno($this->database).": ".mysql_error($this->database));
}
return true;
}
return false;
}
示例6: checkError
/**
* @see DBManager::checkError()
*/
public function checkError($msg = '', $dieOnError = false)
{
if (DBManager::checkError($msg, $dieOnError)) {
return true;
}
$sqlmsg = $this->_getLastErrorMessages();
$sqlpos = strpos($sqlmsg, 'Changed database context to');
if ($sqlpos !== false) {
$sqlmsg = '';
} else {
global $app_strings;
//ERR_MSSQL_DB_CONTEXT: localized version of 'Changed database context to' message
if (empty($app_strings) or !isset($app_strings['ERR_MSSQL_DB_CONTEXT']) or !isset($app_strings['ERR_MSSQL_WARNING'])) {
//ignore the message from sql-server if $app_strings array is empty. This will happen
//only if connection if made before languge is set.
$GLOBALS['log']->debug("Ignoring this database message: " . $sqlmsg);
$sqlmsg = '';
} else {
$sqlpos = strpos($sqlmsg, $app_strings['ERR_MSSQL_DB_CONTEXT']);
$sqlpos2 = strpos($sqlmsg, $app_strings['ERR_MSSQL_WARNING']);
if ($sqlpos !== false || $sqlpos2 !== false) {
$sqlmsg = '';
}
}
}
if (strlen($sqlmsg) > 2) {
$GLOBALS['log']->fatal("SQL Server error: " . $sqlmsg);
return true;
}
return false;
}
示例7: checkError
/**
* @see DBManager::checkError()
*/
public function checkError($msg = '', $dieOnError = false)
{
if (parent::checkError($msg, $dieOnError)) {
return true;
}
$sqlmsg = mssql_get_last_message();
$sqlpos = strpos($sqlmsg, 'Changed database context to');
$sqlpos2 = strpos($sqlmsg, 'Warning:');
$sqlpos3 = strpos($sqlmsg, 'Checking identity information:');
if ($sqlpos !== false || $sqlpos2 !== false || $sqlpos3 !== false) {
$sqlmsg = '';
} else {
global $app_strings;
//ERR_MSSQL_DB_CONTEXT: localized version of 'Changed database context to' message
if (empty($app_strings) or !isset($app_strings['ERR_MSSQL_DB_CONTEXT'])) {
//ignore the message from sql-server if $app_strings array is empty. This will happen
//only if connection if made before languge is set.
$GLOBALS['log']->debug("Ignoring this database message: " . $sqlmsg);
$sqlmsg = '';
} else {
$sqlpos = strpos($sqlmsg, $app_strings['ERR_MSSQL_DB_CONTEXT']);
if ($sqlpos !== false) {
$sqlmsg = '';
}
}
}
if (strlen($sqlmsg) > 2) {
$GLOBALS['log']->fatal("{$msg}: SQL Server error: " . $sqlmsg);
return true;
}
return false;
}
示例8: checkError
/**
* @see DBManager::checkError()
*/
public function checkError($msg = '', $dieOnError = false)
{
if (parent::checkError($msg, $dieOnError)) {
return true;
}
$sqlmsg = mssql_get_last_message();
$sqlpos = strpos($sqlmsg, 'Changed database context to');
$sqlpos2 = strpos($sqlmsg, 'Caution: Changing any part of an object name could break scripts and stored procedures.');
if ($sqlpos !== false || $sqlpos2 !== false) {
$sqlmsg = '';
} else {
global $app_strings;
//ERR_MSSQL_DB_CONTEXT: localized version of 'Changed database context to' message
if (empty($app_strings) or !isset($app_strings['ERR_MSSQL_DB_CONTEXT'])) {
//ignore the message from sql-server if $app_strings array is empty. This will happen
//only if connection if made before languge is set.
//$GLOBALS['log']->debug("Ignoring this database message: " . $sqlmsg);
$sqlmsg = '';
} else {
$sqlpos = strpos($sqlmsg, $app_strings['ERR_MSSQL_DB_CONTEXT']);
if ($sqlpos !== false) {
$sqlmsg = '';
}
}
}
if (strlen($sqlmsg) > 2) {
//$GLOBALS['log']->fatal("SQL Server error: " . $sqlmsg);
return true;
}
return false;
}
示例9: testDisconnect
public function testDisconnect()
{
$this->_db->disconnect();
$this->assertTrue($this->_db->checkError());
$this->_db = DBManagerFactory::getInstance();
}
示例10: errorInfo
/**
* @return array
*/
public function errorInfo()
{
$this->_db->checkError();
return array(0, 0, $this->_db->lastError());
}