| 82 | | * Surcharge de la fonction query pour les logs de requêtes |
| | 103 | * Fonction débug récupérée dans ezdbinterface.php |
| | 104 | * Stops the current timer and calculates the time taken. |
| | 105 | * @see startTimer, timeTaken |
| | 106 | */ |
| | 107 | private function endTimer() |
| | 108 | { |
| | 109 | $this->EndTime = microtime(); |
| | 110 | // Calculate time taken in ms |
| | 111 | list($usec, $sec) = explode( " ", $this->StartTime ); |
| | 112 | $start_val = ((float)$usec + (float)$sec); |
| | 113 | list($usec, $sec) = explode( " ", $this->EndTime ); |
| | 114 | $end_val = ((float)$usec + (float)$sec); |
| | 115 | $this->TimeTaken = $end_val - $start_val; |
| | 116 | $this->TimeTaken *= 1000.0; |
| | 117 | } |
| | 118 | |
| | 119 | |
| | 120 | |
| | 121 | /** |
| | 122 | * Fonction débug récupérée dans ezdbinterface.php |
| | 123 | * @return the micro time when the timer was start or false if no timer. |
| | 124 | */ |
| | 125 | private function startTime() { |
| | 126 | return $this->StartTime; |
| | 127 | } |
| | 128 | |
| | 129 | |
| | 130 | |
| | 131 | /** |
| | 132 | * Fonction débug récupérée dans ezdbinterface.php |
| | 133 | * return the micro time when the timer was ended or false if no timer. |
| | 134 | */ |
| | 135 | private function endTime() { |
| | 136 | return $this->EndTime; |
| | 137 | } |
| | 138 | |
| | 139 | |
| | 140 | |
| | 141 | /** |
| | 142 | * Fonction débug récupérée dans ezdbinterface.php |
| | 143 | * @return the number of milliseconds the last operation took or false if no value. |
| | 144 | */ |
| | 145 | private function timeTaken() { |
| | 146 | return $this->TimeTaken; |
| | 147 | } |
| | 148 | |
| | 149 | |
| | 150 | |
| | 151 | /** |
| | 152 | * Surcharge de la fonction query pour utiliser le débug eZ |
| 89 | | |
| 90 | | /* |
| 91 | | * La fonction reportQuery() étant private on la recopie ici... |
| 92 | | */ |
| 93 | | $debug = eZDebug::instance(); |
| 94 | | $debug->writeNotice( "$the_query", "IPB query", "" ); |
| 95 | | |
| 96 | | return db_driver_mysql::query($the_query, $bypass=0); |
| | 159 | |
| | 160 | $this->ezini = eZINI::instance(); |
| | 161 | if ( ( $this->ezini->variable( "DatabaseSettings", "SQLOutput" ) == "enabled" ) and |
| | 162 | ( $this->ezini->variable( "DebugSettings", "DebugOutput" ) == "enabled" ) ) { |
| | 163 | $this->debug->accumulatorStart( 'mysql_query', 'mysql_total', 'Mysql_queries' ); |
| | 164 | $this->startTimer(); |
| | 165 | } |
| | 166 | |
| | 167 | $return = db_driver_mysql::query($the_query, $bypass=0); |
| | 168 | |
| | 169 | if ( ( $this->ezini->variable( "DatabaseSettings", "SQLOutput" ) == "enabled" ) and |
| | 170 | ( $this->ezini->variable( "DebugSettings", "DebugOutput" ) == "enabled" ) ) { |
| | 171 | $this->debug->accumulatorStop( 'mysql_query' ); |
| | 172 | $this->endTimer(); |
| | 173 | $this->debug->writeNotice( "$the_query", "IPB query (".intval($this->get_num_rows())." rows, ".number_format( $this->timeTaken(), 3 )." ms) query number per page:".$this->ezdb->NumQueries++, "" ); |
| | 174 | } |
| | 175 | |
| | 176 | return $return; |