Example #1
0
 /**
  * Подготавливает листинг SQL
  *
  * @param string $sql
  * @param string $error
  *
  * @return array
  */
 protected function prepareSqlListing($sql, $error = '')
 {
     $sql = htmlSpecialChars($sql);
     $error = htmlSpecialChars($error);
     if (!empty($error)) {
         preg_match("#'(.+?)'#is", $error, $location);
         if (!empty($location[1])) {
             $sql = $this->view->highlightLocation($sql, $location[1]);
         }
     }
     $cnt = substr_count($sql, "\r") + 2;
     $num = range(1, $cnt);
     return ['num' => $num, 'sql' => $sql];
 }