Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Another Small Sql Formatter Issue (with "between")

forums forums SQLyog SQLyog: Bugs / Feature Requests Another Small Sql Formatter Issue (with "between")

  • This topic is empty.
Viewing 1 reply thread
  • Author
    Posts
    • #11544
      vygi
      Member
      Code:
      SELECT * FROM table1 WHERE field1 BETWEEN 1 AND 2 AND field2 > 3

      is being formatted as:

      Code:
      SELECT *
      FROM table1
      WHERE field1 BETWEEN 1
      AND 2
      AND field2 > 3

      Should be:

      Code:
      SELECT *
      FROM table1
      WHERE field1 BETWEEN 1 AND 2
      AND field2 > 3

      (first AND after BETWEEN should remain in the same line)

    • #29159
      peterlaursen
      Participant

      .. and it does not even help to add paranthesis's like

      Code:
      SELECT * FROM table1 WHERE (field1 BETWEEN 1 AND 2) AND (field2 > 3)

      I am afraid this will be a tough one. The formatter does not know the meaning of SQL. It recognizes string patterns using regular expressions. But maybe some additional condition can be added to that reqex when keyword BETWEEN appears in the string (like first AND after BETWEEN has anohter meaning that what AND normally has).

Viewing 1 reply thread
  • You must be logged in to reply to this topic.