本文整理汇总了PHP中PEAR::isERROR方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR::isERROR方法的具体用法?PHP PEAR::isERROR怎么用?PHP PEAR::isERROR使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR
的用法示例。
在下文中一共展示了PEAR::isERROR方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: callback
function callback($id)
{
global $num_runs;
global $dsn_map;
$db_map = array();
$db_map[master] =& MDB2::connect($dsn_map[master]);
if (PEAR::isERROR($db_map[master])) {
die($db_map[master]->getMessage());
}
if (is_array($dsn_map[slave])) {
foreach ($dsn_map[slave] as $dsn_slave) {
$db_slave =& MDB2::connect($dsn_slave);
if (PEAR::isERROR($db_slave)) {
die($db_slave->getMessage());
}
$db_map[slave][] = $db_slave;
}
}
$cnt = 0;
$times = array();
// wait for the parent to HUP me
pcntl_signal(SIGHUP, create_function('', 'return 1;'));
sleep(600);
while ($cnt < $num_runs) {
$t0 = microtime(true);
do_task($db_map);
$t1 = microtime(true) - $t0;
$times[] = $t1;
$cnt++;
}
// cleanup
$db_map[master]->disconnect;
if (is_array($db_map[slave])) {
foreach ($db_map[slave] as $db_slave) {
$db_slave->disconnect;
}
}
$num = count($times);
$tot = array_sum($times);
$avg = $tot / $num;
$r = array($id, $num, min($times), max($times), $avg, $tot);
return $r;
}