• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List

E:/E/GEAMP/www/openbiz/openbiz/others/Zend/Db/Profiler/Query.php

00001 <?php
00031 class Zend_Db_Profiler_Query
00032 {
00033 
00039     protected $_query = '';
00040 
00046     protected $_queryType = 0;
00047 
00053     protected $_startedMicrotime = null;
00054 
00060     protected $_endedMicrotime = null;
00061 
00065     protected $_boundParams = array();
00066 
00079     public function __construct($query, $queryType)
00080     {
00081         $this->_query = $query;
00082         $this->_queryType = $queryType;
00083         // by default, and for backward-compatibility, start the click ticking
00084         $this->start();
00085     }
00086 
00091     public function __clone()
00092     {
00093         $this->_boundParams = array();
00094         $this->_endedMicrotime = null;
00095         $this->start();
00096     }
00097 
00106     public function start()
00107     {
00108         $this->_startedMicrotime = microtime(true);
00109     }
00110 
00116     public function end()
00117     {
00118         $this->_endedMicrotime = microtime(true);
00119     }
00120 
00126     public function hasEnded()
00127     {
00128         return $this->_endedMicrotime !== null;
00129     }
00130 
00136     public function getQuery()
00137     {
00138         return $this->_query;
00139     }
00140 
00146     public function getQueryType()
00147     {
00148         return $this->_queryType;
00149     }
00150 
00156     public function bindParam($param, $variable)
00157     {
00158         $this->_boundParams[$param] = $variable;
00159     }
00160 
00165     public function bindParams(array $params)
00166     {
00167         if (array_key_exists(0, $params)) {
00168             array_unshift($params, null);
00169             unset($params[0]);
00170         }
00171         foreach ($params as $param => $value) {
00172             $this->bindParam($param, $value);
00173         }
00174     }
00175 
00179     public function getQueryParams()
00180     {
00181         return $this->_boundParams;
00182     }
00183 
00190     public function getElapsedSecs()
00191     {
00192         if (null === $this->_endedMicrotime) {
00193             return false;
00194         }
00195 
00196         return $this->_endedMicrotime - $this->_startedMicrotime;
00197     }
00198 }
00199 

Generated on Thu Apr 19 2012 17:01:17 for openbiz by  doxygen 1.7.2