Beispiel #1
0
 public function testLoadFileSemicolon()
 {
     $queries = array('SELECT 1 FROM 1;', 'SELECT 2 FROM 2;', 'SELECT 3 FROM 3');
     file_put_contents($tmp = tempnam(sys_get_temp_dir(), 'Neevo'), implode("\n", $queries));
     $count = $this->neevo->loadFile($tmp);
     $this->assertEquals($queries, array_map('trim', $this->neevo->getConnection()->getDriver()->performed()));
     $this->assertEquals($count, count($queries));
     unlink($tmp);
 }
Beispiel #2
0
 /**
  * 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;
 }
Beispiel #3
0
 /**
  * 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);
 }