Exemple #1
0
 /**
  * Displays complete result set as HTML table for debug purposes.
  * @return void
  */
 public static function dumpResult(Statement $statement)
 {
     echo "\n<table class=\"dump\">\n<caption>" . htmlSpecialChars($statement->queryString) . "</caption>\n";
     if (!$statement->columnCount()) {
         echo "\t<tr>\n\t\t<th>Affected rows:</th>\n\t\t<td>", $statement->rowCount(), "</td>\n\t</tr>\n</table>\n";
         return;
     }
     $i = 0;
     foreach ($statement as $row) {
         if ($i === 0) {
             echo "<thead>\n\t<tr>\n\t\t<th>#row</th>\n";
             foreach ($row as $col => $foo) {
                 echo "\t\t<th>" . htmlSpecialChars($col) . "</th>\n";
             }
             echo "\t</tr>\n</thead>\n<tbody>\n";
         }
         echo "\t<tr>\n\t\t<th>", $i, "</th>\n";
         foreach ($row as $col) {
             //if (is_object($col)) $col = $col->__toString();
             echo "\t\t<td>", htmlSpecialChars($col), "</td>\n";
         }
         echo "\t</tr>\n";
         $i++;
     }
     if ($i === 0) {
         echo "\t<tr>\n\t\t<td><em>empty result set</em></td>\n\t</tr>\n</table>\n";
     } else {
         echo "</tbody>\n</table>\n";
     }
 }
Exemple #2
0
 public function __construct(Statement $statement)
 {
     $data = array();
     foreach ((array) $this as $key => $value) {
         $data[$key] = $value;
         unset($this->{$key});
     }
     foreach ($statement->normalizeRow($data) as $key => $value) {
         $this->{$key} = $value;
     }
 }
Exemple #3
0
 public function logQuery(Statement $result, array $params = NULL)
 {
     $source = NULL;
     foreach (debug_backtrace(FALSE) as $row) {
         if (isset($row['file']) && is_file($row['file']) && strpos($row['file'], NETTE_DIR . DIRECTORY_SEPARATOR) !== 0) {
             $source = array($row['file'], (int) $row['line']);
             break;
         }
     }
     $this->totalTime += $result->time;
     $this->queries[] = array($result->queryString, $params, $result->time, $result->rowCount(), $result->getConnection(), $source);
 }
 public function logQuery(Nette\Database\Statement $result, array $params = NULL)
 {
     if ($this->disabled) {
         return;
     }
     $source = NULL;
     foreach (debug_backtrace(FALSE) as $row) {
         if (isset($row['file']) && is_file($row['file']) && strpos($row['file'], NETTE_DIR . DIRECTORY_SEPARATOR) !== 0) {
             if (isset($row['function']) && strpos($row['function'], 'call_user_func') === 0) {
                 continue;
             }
             if (isset($row['class']) && is_subclass_of($row['class'], '\\Nette\\Database\\Connection')) {
                 continue;
             }
             $source = array($row['file'], (int) $row['line']);
             break;
         }
     }
     $this->totalTime += $result->getTime();
     $this->queries[] = array($result->queryString, $params, $result->getTime(), $result->rowCount(), $result->getConnection(), $source);
 }
 public function __construct(Statement $statement)
 {
     $statement->normalizeRow($this);
 }
Exemple #6
0
Nette\ArrayHash{function
__construct(Statement$statement){$statement->normalizeRow($this);}function
Exemple #7
0
	public function logQuery(Statement $result, array $params = NULL)
	{
		$this->totalTime += $result->time;
		$this->queries[] = array($result->queryString, $params, $result->time, $result->rowCount());
	}