return $i;
} else {
$i = DB_DataObject::factory($cls);
- if (empty($i)) {
+ if (empty($i) || PEAR::isError($i)) {
return false;
}
foreach ($kv as $k => $v) {
str_replace("\n", " ", $e->getTraceAsString()));
return false;
} else {
- $keys = $this->_allCacheKeys();
+ $keys = $this->_allCacheKeys();
- foreach ($keys as $key) {
- $c->set($key, $this);
- }
+ foreach ($keys as $key) {
+ $c->set($key, $this);
+ }
}
}
}
$start = microtime(true);
- $result = parent::_query($string);
+ $result = null;
+ if (Event::handle('StartDBQuery', array($this, $string, &$result))) {
+ $result = parent::_query($string);
+ Event::handle('EndDBQuery', array($this, $string, &$result));
+ }
$delta = microtime(true) - $start;
$limit = common_config('db', 'log_slow_queries');
function raiseError($message, $type = null, $behaviour = null)
{
$id = get_class($this);
- if ($this->id) {
+ if (!empty($this->id)) {
$id .= ':' . $this->id;
}
if ($message instanceof PEAR_Error) {
return $vstr;
}
}
-