コード例 #1
0
ファイル: BaseStatement.php プロジェクト: smasty/neevo
 /**
  * Prints out syntax highlighted statement.
  * @param bool $return
  * @return string|BaseStatement fluent interface
  */
 public function dump($return = false)
 {
     $sql = PHP_SAPI === 'cli' ? preg_replace('/\\s+/', ' ', $this->parse()) . "\n" : Manager::highlightSql($this->parse());
     if (!$return) {
         echo $sql;
     }
     return $return ? $sql : $this;
 }
コード例 #2
0
ファイル: ManagerTest.php プロジェクト: smasty/neevo
 public function testHighlightSql()
 {
     $this->assertEquals('<pre style="color:#555" class="sql-dump"><strong style="color:#e71818">SELECT</strong>' . ' * <strong style="color:#e71818">FROM</strong> `table` <strong style="color:#e71818">WHERE</strong>' . ' <strong style="color:#d59401">RAND</strong>() = <em style="color:#008000">\'John Doe\'</em>;' . ' <em style="color:#999">/* comment */</em></pre>' . "\n", Manager::highlightSql("SELECT * FROM `table` WHERE RAND() = 'John Doe'; /* comment */"));
 }
コード例 #3
0
ファイル: DebugPanel.php プロジェクト: smasty/neevo-nette-ext
 /**
  * Renders SQL query string to Nette debug bluescreen when available.
  * @param NeevoException $e
  * @return array
  */
 public function renderException($e)
 {
     if (!($e instanceof NeevoException && $e->getSql())) {
         return;
     }
     list($file, $line) = $this->failedQuerySource;
     return array('tab' => 'SQL', 'panel' => Manager::highlightSql($e->getSql()) . '<p><b>File:</b> ' . Helpers::editorLink($file, $line) . " &nbsp; <b>Line:</b> {$line}</p>" . ($line ? BlueScreen::highlightFile($file, $line) : '') . 'Neevo v' . Manager::VERSION);
 }