本文整理汇总了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;
}