public function getMarkedQuery(string $style = 'error'): array
  {
    $query   = trim($this->query); // MySQL ignores leading whitespace in queries.
    $message = [];

    if (strpos($query, PHP_EOL)!==false && $this->isQueryError())
    {
      // Query is a multi line query.
      // The format of a 1064 message is: %s near '%s' at line %d
      $error_line = trim(strrchr($this->error, ' '));

      // Prepend each line with line number.
      $lines  = explode(PHP_EOL, $query);
      $digits = ceil(log(sizeof($lines) + 1, 10));
      $format = sprintf('%%%dd %%s', $digits);
      foreach ($lines as $i => $line)
      {
        if (($i + 1)==$error_line)
        {
          $message[] = sprintf('<%s>'.$format.'</%s>', $style, $i + 1, OutputFormatter::escape($line), $style);
        }
        else
        {
          $message[] = sprintf($format, $i + 1, OutputFormatter::escape($line));
        }
      }
    }
    else
    {
      // Query is a single line query or a method name.
      $message[] = $query;
    }

    return $message;
  }
public function getMarkedQuery(string $style = 'error'): array
  {
    $query   = trim($this->query); // MySQL ignores leading whitespace in queries.
    $message = [];

    if (strpos($query, PHP_EOL)!==false && $this->isQueryError())
    {
      // Query is a multi line query.
      // The format of a 1064 message is: %s near '%s' at line %d
      $error_line = trim(strrchr($this->error, ' '));

      // Prepend each line with line number.
      $lines  = explode(PHP_EOL, $query);
      $digits = ceil(log(sizeof($lines) + 1, 10));
      $format = sprintf('%%%dd %%s', $digits);
      foreach ($lines as $i => $line)
      {
        if (($i + 1)==$error_line)
        {
          $message[] = sprintf('<%s>'.$format.'</%s>', $style, $i + 1, OutputFormatter::escape($line), $style);
        }
        else
        {
          $message[] = sprintf($format, $i + 1, OutputFormatter::escape($line));
        }
      }
    }
    else
    {
      // Query is a single line query or a method name.
      $message[] = $query;
    }

    return $message;
  }
public function getMarkedQuery ( string $ style = 'error' ) : array { $ query = trim ( $ this -> query ) ; // MySQL ignores leading whitespace in queries. $ message = [ ] ; if ( strpos ( $ query , PHP_EOL ) !== false && $ this -> isQueryError ( ) ) { // Query is a multi line query. // The format of a 1064 message is: %s near '%s' at line %d $ error_line = trim ( strrchr ( $ this -> error , ' ' ) ) ; // Prepend each line with line number. $ lines = explode ( PHP_EOL , $ query ) ; $ digits = ceil ( log ( sizeof ( $ lines ) + 1 , 10 ) ) ; $ format = sprintf ( '%%%dd %%s' , $ digits ) ; foreach ( $ lines as $ i => $ line ) { if ( ( $ i + 1 ) == $ error_line ) { $ message [ ] = sprintf ( '<%s>' . $ format . '</%s>' , $ style , $ i + 1 , OutputFormatter :: escape ( $ line ) , $ style ) ; } else { $ message [ ] = sprintf ( $ format , $ i + 1 , OutputFormatter :: escape ( $ line ) ) ; } } } else { // Query is a single line query or a method name. $ message [ ] = $ query ; } return $ message ; }
Returns an array with the lines of the SQL statement. The line where the error occurred will be styled.

@param string $style The style for highlighting the line with error.

@return array The lines of the SQL statement.
Returns an array with the lines of the SQL statement . The line where the error occurred will be styled .