From: avl Date: Fri, 29 Aug 2008 02:42:47 +0000 (+0200) Subject: SQL Profiler X-Git-Tag: 0.6~181 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=54ca43c62beaf991785fe0131c5816e446832eba;p=ipf-legacy-orm.git SQL Profiler --- diff --git a/ipf/orm/connection/profiler.php b/ipf/orm/connection/profiler.php new file mode 100644 index 0000000..3c0a340 --- /dev/null +++ b/ipf/orm/connection/profiler.php @@ -0,0 +1,89 @@ +start(); + + if ( ! in_array($a[0], $this->events, true)) { + $this->events[] = $a[0]; + } + } else { + // after-event listener found + $a[0]->end(); + } + /** + * If filtering by query type is enabled, only keep the query if + * it was one of the allowed types. + */ + /* + if ( !is_null($this->filterTypes)) { + if ( ! ($a[0]->getQueryType() & $this->_filterTypes)) { + + } + } + */ + } + + public function get($key) + { + if (isset($this->events[$key])) { + return $this->events[$key]; + } + return null; + } + + public function getAll() + { + return $this->events; + } + + public function getIterator() + { + return new ArrayIterator($this->events); + } + + public function count() + { + return count($this->events); + } + + public function pop() + { + return array_pop($this->events); + } + + public function lastEvent() + { + if (empty($this->events)) { + return false; + } + + end($this->events); + return current($this->events); + } +} \ No newline at end of file diff --git a/ipf/orm/exception/profiler.php b/ipf/orm/exception/profiler.php new file mode 100644 index 0000000..5fa9ad5 --- /dev/null +++ b/ipf/orm/exception/profiler.php @@ -0,0 +1,3 @@ +