当前位置: 首页>>代码示例>>PHP>>正文


PHP dibi::dump方法代码示例

本文整理汇总了PHP中dibi::dump方法的典型用法代码示例。如果您正苦于以下问题:PHP dibi::dump方法的具体用法?PHP dibi::dump怎么用?PHP dibi::dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dibi的用法示例。


在下文中一共展示了dibi::dump方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPanels

 /**
  * Returns custom panels.
  * @return array
  */
 public function getPanels()
 {
     $panels = array();
     if ($this->sql !== NULL) {
         $panels['SQL'] = array('expanded' => TRUE, 'content' => dibi::dump($this->sql, TRUE));
     }
     return $panels;
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:12,代码来源:DibiException.php

示例2: test

 /**
  * Generates and prints SQL query.
  * @param  array|mixed  one or more arguments
  * @return bool
  */
 public final function test($args)
 {
     $args = func_get_args();
     $this->connect();
     try {
         $translator = new DibiTranslator($this->driver);
         dibi::dump($translator->translate($args));
         return TRUE;
     } catch (DibiException $e) {
         dibi::dump($e->getSql());
         return FALSE;
     }
 }
开发者ID:vrana,项目名称:dibi,代码行数:18,代码来源:DibiConnection.php

示例3: getPanel

 /**
  * Returns HTML code for custom panel.
  * @return mixed
  */
 public function getPanel()
 {
     if (!dibi::$numOfQueries) {
         return;
     }
     $content = "\n<h1>Queries: " . dibi::$numOfQueries . (dibi::$totalTime === NULL ? '' : ', time: ' . sprintf('%0.3f', dibi::$totalTime * 1000) . ' ms') . "</h1>\n\n<style>\n\t#nette-debug-DibiProfiler td.dibi-sql { background: white }\n\t#nette-debug-DibiProfiler .nette-alt td.dibi-sql { background: #F5F5F5 }\n\t#nette-debug-DibiProfiler .dibi-sql div { display: none; margin-top: 10px; max-height: 150px; overflow:auto }\n</style>\n\n<div class='nette-inner'>\n<table>\n<tr>\n\t<th>Time</th><th>SQL Statement</th><th>Rows</th><th>Connection</th>\n</tr>\n";
     $i = 0;
     $classes = array('class="nette-alt"', '');
     foreach (self::$tickets as $ticket) {
         list($connection, $event, $sql, $time, $count, $explain) = $ticket;
         if (!($event & self::QUERY)) {
             continue;
         }
         $content .= "\n<tr {$classes[++$i % 2]}>\n\t<td>" . sprintf('%0.3f', $time * 1000) . ($explain ? "\n\t<br><a href='#' class='nette-toggler' rel='#nette-debug-DibiProfiler-row-{$i}'>explain&nbsp;&#x25ba;</a>" : '') . "</td>\n\t<td class='dibi-sql'>" . dibi::dump(strlen($sql) > self::$maxLength ? substr($sql, 0, self::$maxLength) . '...' : $sql, TRUE) . ($explain ? "\n\t<div id='nette-debug-DibiProfiler-row-{$i}'>{$explain}</div>" : '') . "</td>\n\t<td>{$count}</td>\n\t<td>" . htmlSpecialChars($connection->getConfig('driver') . '/' . $connection->getConfig('name')) . "</td>\n</tr>\n";
     }
     $content .= '</table></div>';
     return $content;
 }
开发者ID:nella,项目名称:ActiveMapper,代码行数:22,代码来源:DibiProfiler.php

示例4: dirname

<!DOCTYPE html><link rel="stylesheet" href="data/style.css">

<h1>Dumping SQL and Result Set | dibi</h1>

<?php 
require dirname(__FILE__) . '/Nette/Debugger.php';
require dirname(__FILE__) . '/../dibi/dibi.php';
dibi::connect(array('driver' => 'sqlite', 'database' => 'data/sample.sdb'));
$res = dibi::query('
	SELECT * FROM products
	INNER JOIN orders USING (product_id)
	INNER JOIN customers USING (customer_id)
');
echo '<h2>dibi::dump()</h2>';
// dump last query (dibi::$sql)
dibi::dump();
// dump result table
echo '<h2>DibiResult::dump()</h2>';
$res->dump();
开发者ID:besir,项目名称:besir.cz,代码行数:19,代码来源:dumping-sql-and-result-set.php

示例5: getPanel

 /**
  * Returns HTML code for custom panel.
  * @return mixed
  */
 public function getPanel()
 {
     return $this->sql ? dibi::dump($this->sql, TRUE) : NULL;
 }
开发者ID:jaroslavlibal,项目名称:MDW,代码行数:8,代码来源:DibiException.php

示例6: getPanel

    /**
     * Returns HTML code for custom panel. (Nette\Diagnostics\IBarPanel)
     * @return mixed
     */
    public function getPanel()
    {
        $totalTime = $s = NULL;
        $h = 'htmlSpecialChars';
        foreach ($this->events as $event) {
            $totalTime += $event->time;
            $explain = NULL;
            // EXPLAIN is called here to work SELECT FOUND_ROWS()
            if ($this->explain && $event->type === DibiEvent::SELECT) {
                try {
                    $backup = array($event->connection->onEvent, dibi::$numOfQueries, dibi::$totalTime);
                    $event->connection->onEvent = NULL;
                    $cmd = is_string($this->explain) ? $this->explain : ($event->connection->getConfig('driver') === 'oracle' ? 'EXPLAIN PLAN' : 'EXPLAIN');
                    $explain = dibi::dump($event->connection->nativeQuery("{$cmd} {$event->sql}"), TRUE);
                } catch (DibiException $e) {
                }
                list($event->connection->onEvent, dibi::$numOfQueries, dibi::$totalTime) = $backup;
            }
            $s .= '<tr><td>' . sprintf('%0.3f', $event->time * 1000);
            if ($explain) {
                static $counter;
                $counter++;
                $s .= "<br /><a href='#' class='nette-toggler' rel='#nette-debug-DibiProfiler-row-{$counter}'>explain&nbsp;&#x25ba;</a>";
            }
            $s .= '</td><td class="nette-DibiProfiler-sql">' . dibi::dump(strlen($event->sql) > self::$maxLength ? substr($event->sql, 0, self::$maxLength) . '...' : $event->sql, TRUE);
            if ($explain) {
                $s .= "<div id='nette-debug-DibiProfiler-row-{$counter}' class='nette-collapsed'>{$explain}</div>";
            }
            if ($event->source) {
                $helpers = 'Nette\\Diagnostics\\Helpers';
                if (!class_exists($helpers)) {
                    $helpers = class_exists('NDebugHelpers') ? 'NDebugHelpers' : 'DebugHelpers';
                }
                $s .= call_user_func(array($helpers, 'editorLink'), $event->source[0], $event->source[1])->class('nette-DibiProfiler-source');
            }
            $s .= "</td><td>{$event->count}</td><td>{$h($event->connection->getConfig('driver') . '/' . $event->connection->getConfig('name'))}</td></tr>";
        }
        return empty($this->events) ? '' : '<style> #nette-debug td.nette-DibiProfiler-sql { background: white !important }
			#nette-debug .nette-DibiProfiler-source { color: #999 !important }
			#nette-debug nette-DibiProfiler tr table { margin: 8px 0; max-height: 150px; overflow:auto } </style>
			<h1>Queries: ' . count($this->events) . ($totalTime === NULL ? '' : ', time: ' . sprintf('%0.3f', $totalTime * 1000) . ' ms') . '</h1>
			<div class="nette-inner nette-DibiProfiler">
			<table>
				<tr><th>Time&nbsp;ms</th><th>SQL Statement</th><th>Rows</th><th>Connection</th></tr>' . $s . '
			</table>
			</div>';
    }
开发者ID:Scrik,项目名称:Need-For-Speed-World-Statistics-Website,代码行数:51,代码来源:DibiNettePanel.php

示例7: test

 /**
  * Generates and prints SQL query.
  * @param  array|mixed  one or more arguments
  * @return bool
  */
 public final function test($args)
 {
     $args = func_get_args();
     try {
         dibi::dump($this->translateArgs($args));
         return TRUE;
     } catch (DibiException $e) {
         if ($e->getSql()) {
             dibi::dump($e->getSql());
         } else {
             echo get_class($e) . ': ' . $e->getMessage() . (PHP_SAPI === 'cli' ? "\n" : '<br>');
         }
         return FALSE;
     }
 }
开发者ID:Scrik,项目名称:Need-For-Speed-World-Statistics-Website,代码行数:20,代码来源:DibiConnection.php

示例8: getPanel

    /**
     * Returns HTML code for custom panel.
     * @return mixed
     */
    public function getPanel()
    {
        $s = NULL;
        $h = 'htmlSpecialChars';
        foreach (self::$tickets as $i => $ticket) {
            list($connection, $event, $sql, $time, $count, $source) = $ticket;
            if (!($event & self::QUERY)) {
                continue;
            }
            $explain = NULL;
            // EXPLAIN is called here to work SELECT FOUND_ROWS()
            if ($this->explainQuery && $event === self::SELECT) {
                try {
                    $explain = dibi::dump($connection->setProfiler(NULL)->nativeQuery('EXPLAIN ' . $sql), TRUE);
                } catch (DibiException $e) {
                }
                $connection->setProfiler($this);
            }
            $s .= '<tr><td>' . sprintf('%0.3f', $time * 1000);
            if ($explain) {
                $s .= "<br /><a href='#' class='nette-toggler' rel='#nette-debug-DibiProfiler-row-{$i}'>explain&nbsp;&#x25ba;</a>";
            }
            $s .= '</td><td class="dibi-sql">' . dibi::dump(strlen($sql) > self::$maxLength ? substr($sql, 0, self::$maxLength) . '...' : $sql, TRUE);
            if ($explain) {
                $s .= "<div id='nette-debug-DibiProfiler-row-{$i}' class='nette-collapsed'>{$explain}</div>";
            }
            if ($source) {
                list($file, $line) = $source;
                $s .= "<span class='dibi-source' title='{$h($file)}:{$line}'>{$h(basename(dirname($file)) . '/' . basename($file))}:{$line}</span>";
            }
            $s .= "</td><td>{$count}</td><td>{$h($connection->getConfig('driver') . '/' . $connection->getConfig('name'))}</td></tr>";
        }
        return $s === NULL ? '' : '<style> #nette-debug-DibiProfiler td.dibi-sql { background: white !important }
			#nette-debug-DibiProfiler .dibi-source { color: #BBB !important }
			#nette-debug-DibiProfiler tr table { margin: 8px 0; max-height: 150px; overflow:auto } </style>

			<h1>Queries: ' . dibi::$numOfQueries . (dibi::$totalTime === NULL ? '' : ', time: ' . sprintf('%0.3f', dibi::$totalTime * 1000) . ' ms') . '</h1>
			<div class="nette-inner">
			<table>
				<th>Time</th><th>SQL Statement</th><th>Rows</th><th>Connection</th>' . $s . '
			</table>
			</div>';
    }
开发者ID:radekdostal,项目名称:dibi,代码行数:47,代码来源:DibiProfiler.php

示例9: test

 /**
  * Generates and prints SQL query.
  * @param  array|mixed  one or more arguments
  * @return bool
  */
 public final function test($args)
 {
     $args = func_get_args();
     try {
         dibi::dump($this->translateArgs($args));
         return TRUE;
     } catch (DibiException $e) {
         dibi::dump($e->getSql());
         return FALSE;
     }
 }
开发者ID:pracj3am,项目名称:dibi,代码行数:16,代码来源:DibiConnection.php

示例10: getTab

getTab(){return'<span title="dibi profiler"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAEYSURBVBgZBcHPio5hGAfg6/2+R980k6wmJgsJ5U/ZOAqbSc2GnXOwUg7BESgLUeIQ1GSjLFnMwsKGGg1qxJRmPM97/1zXFAAAAEADdlfZzr26miup2svnelq7d2aYgt3rebl585wN6+K3I1/9fJe7O/uIePP2SypJkiRJ0vMhr55FLCA3zgIAOK9uQ4MS361ZOSX+OrTvkgINSjS/HIvhjxNNFGgQsbSmabohKDNoUGLohsls6BaiQIMSs2FYmnXdUsygQYmumy3Nhi6igwalDEOJEjPKP7CA2aFNK8Bkyy3fdNCg7r9/fW3jgpVJbDmy5+PB2IYp4MXFelQ7izPrhkPHB+P5/PjhD5gCgCenx+VR/dODEwD+A3T7nqbxwf1HAAAAAElFTkSuQmCC" />'.dibi::$numOfQueries.' queries</span>';}function
getPanel(){$s=NULL;$h='htmlSpecialChars';foreach(self::$tickets
as$i=>$ticket){list($connection,$event,$sql,$time,$count,$source)=$ticket;if(!($event&self::QUERY))continue;$explain=NULL;if($this->explainQuery&&$event===self::SELECT){try{$explain=dibi::dump($connection->setProfiler(NULL)->nativeQuery('EXPLAIN '.$sql),TRUE);}catch(DibiException$e){}$connection->setProfiler($this);}$s.='<tr><td>'.sprintf('%0.3f',$time*1000);if($explain){$s.="<br /><a href='#' class='nette-toggler' rel='#nette-debug-DibiProfiler-row-$i'>explain&nbsp;&#x25ba;</a>";}$s.='</td><td class="dibi-sql">'.dibi::dump(strlen($sql)>self::$maxLength?substr($sql,0,self::$maxLength).'...':$sql,TRUE);if($explain){$s.="<div id='nette-debug-DibiProfiler-row-$i' class='nette-collapsed'>{$explain}</div>";}if($source){list($file,$line)=$source;$s.="<span class='dibi-source' title='{$h($file)}:$line'>{$h(basename(dirname($file)).'/'.basename($file))}:$line</span>";}$s.="</td><td>{$count}</td><td>{$h($connection->getConfig('driver').'/'.$connection->getConfig('name'))}</td></tr>";}return$s===NULL?'':'<style> #nette-debug-DibiProfiler td.dibi-sql { background: white !important }
			#nette-debug-DibiProfiler .dibi-source { color: #BBB !important }
			#nette-debug-DibiProfiler tr table { margin: 8px 0; max-height: 150px; overflow:auto } </style>

			<h1>Queries: '.dibi::$numOfQueries.(dibi::$totalTime===NULL?'':', time: '.sprintf('%0.3f',dibi::$totalTime*1000).' ms').'</h1>
			<div class="nette-inner">
			<table>
				<th>Time</th><th>SQL Statement</th><th>Rows</th><th>Connection</th>'.$s.'
			</table>
			</div>';}function
开发者ID:nosko,项目名称:socialSearch,代码行数:12,代码来源:dibi.min.php

示例11: test

 /**
  * Generates and prints SQL query.
  *
  * @param  array|mixed  one or more arguments
  * @return bool
  */
 public final function test($args)
 {
     $args = func_get_args();
     $this->connect();
     $trans = new DibiTranslator($this->driver);
     $ok = $trans->translate($args);
     dibi::dump($trans->sql);
     return $ok;
 }
开发者ID:laiello,项目名称:webuntucms,代码行数:15,代码来源:DibiConnection.php

示例12: getQuery

 /**
  * Actual formatted query, e.g. 'SELECT * FROM ...'
  *
  * @return Html|string
  */
 public function getQuery()
 {
     $html = \dibi::dump($this->event->sql, TRUE);
     return Html::el()->setHtml($html);
 }
开发者ID:nextras,项目名称:tracy-query-panel,代码行数:10,代码来源:DibiHandler.php


注:本文中的dibi::dump方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。