本文整理匯總了PHP中TikiDb::getErrorMessage方法的典型用法代碼示例。如果您正苦於以下問題:PHP TikiDb::getErrorMessage方法的具體用法?PHP TikiDb::getErrorMessage怎麽用?PHP TikiDb::getErrorMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TikiDb
的用法示例。
在下文中一共展示了TikiDb::getErrorMessage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handle
/**
* @param TikiDb $db
* @param $query
* @param $values
* @param $result
*/
function handle(TikiDb $db, $query, $values, $result)
{
global $smarty, $prefs;
$msg = $db->getErrorMessage();
$q = $query;
if (is_array($values)) {
foreach ($values as $v) {
if (is_null($v)) {
$v = 'NULL';
} else {
$v = "'" . addslashes($v) . "'";
}
$pos = strpos($q, '?');
if ($pos !== false) {
$q = substr($q, 0, $pos) . "{$v}" . substr($q, $pos + 1);
}
}
}
if (function_exists('xdebug_get_function_stack')) {
/**
* @param $stack
* @return string
*/
function mydumpstack($stack)
{
$o = '';
foreach ($stack as $line) {
$o .= '* ' . $line['file'] . " : " . $line['line'] . " -> " . $line['function'] . "(" . var_export($line['params'], true) . ")<br />";
}
return $o;
}
$stacktrace = mydumpstack(xdebug_get_function_stack());
} else {
$stacktrace = false;
}
require_once 'installer/installlib.php';
$installer = new Installer();
require_once 'tiki-setup.php';
$smarty->assign('msg', $msg);
$smarty->assign('base_query', $query);
$smarty->assign('values', $values);
$smarty->assign('built_query', $q);
$smarty->assign('stacktrace', $stacktrace);
$smarty->assign('requires_update', $installer->requiresUpdate());
header("Cache-Control: no-cache, pre-check=0, post-check=0");
$smarty->display('database-connection-error.tpl');
$this->log($msg . ' - ' . $q);
die;
}
示例2: handle
/**
* @param TikiDb $db
* @param $query
* @param $values
* @param $result
*/
function handle(TikiDb $db, $query, $values, $result)
{
global $prefs;
$smarty = TikiLib::lib('smarty');
$msg = $db->getErrorMessage();
$q = $query;
if (is_array($values)) {
foreach ($values as $v) {
if (is_null($v)) {
$v = 'NULL';
} else {
$v = "'" . addslashes($v) . "'";
}
$pos = strpos($q, '?');
if ($pos !== false) {
$q = substr($q, 0, $pos) . "{$v}" . substr($q, $pos + 1);
}
}
}
if (function_exists('xdebug_get_function_stack')) {
$stacktrace = mydumpstack(xdebug_get_function_stack());
} else {
$stacktrace = false;
}
require_once 'installer/installlib.php';
$installer = new Installer();
require_once 'tiki-setup.php';
$smarty->assign('msg', $msg);
$smarty->assign('base_query', $query);
$smarty->assign('values', $values);
$smarty->assign('built_query', $q);
$smarty->assign('stacktrace', $stacktrace);
$smarty->assign('requires_update', $installer->requiresUpdate());
header("Cache-Control: no-cache, pre-check=0, post-check=0");
$smarty->display('database-connection-error.tpl');
$this->log($msg . ' - ' . $q);
die;
}