return $i;
} else {
$i = DB_DataObject::factory($cls);
- if (empty($i)) {
+ if (empty($i) || PEAR::isError($i)) {
return false;
}
foreach ($kv as $k => $v) {
$start = microtime(true);
$fail = false;
- try {
- $result = parent::_query($string);
- } catch (Exception $e) {
- $fail = $e;
+ $result = null;
+ if (Event::handle('StartDBQuery', array($this, $string, &$result))) {
+ common_perf_counter('query', $string);
+ try {
+ $result = parent::_query($string);
+ } catch (Exception $e) {
+ $fail = $e;
+ }
+ Event::handle('EndDBQuery', array($this, $string, &$result));
}
$delta = microtime(true) - $start;
}
}
}
+ // Needed to make timestamp values usefully comparable.
+ if (common_config('db', 'type') == 'mysql') {
+ parent::_query("set time_zone='+0:00'");
+ }
}
return $result;