Skip to content

Fixed sql formatting for logical operators - #820

Merged
veler merged 1 commit into
DevToys-app:mainfrom
Vladexy88x:fix/format-sql-operators
May 27, 2023
Merged

Fixed sql formatting for logical operators#820
veler merged 1 commit into
DevToys-app:mainfrom
Vladexy88x:fix/format-sql-operators

Conversation

@Vladexy88x

@Vladexy88x Vladexy88x commented May 25, 2023

Copy link
Copy Markdown

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • New feature or enhancement
  • UI change (please include screenshot!)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Internationalization and localization
  • Other (please describe):

What is the current behavior?

Issue Number: #816

What is the new behavior?

I corrected wrong formatting, similar behavior appears when selecting TSQL, Standart Sql, Postgres, N1QL

Before correction:
Input:


SELECT
  U1.FULL_NAME || ' (' || U1.USER_NAME || ')' AS CREATED_BY,
  U2.FULL_NAME || ' (' || U2.USER_NAME || ')' AS LAST_EDITED_BY
FROM SOMETABLE

Output:


SELECT
  U1.FULL_NAME | | ' (' | | U1.USER_NAME | | ')' AS CREATED_BY,
  U2.FULL_NAME | | ' (' | | U2.USER_NAME | | ')' AS LAST_EDITED_BY
FROM
  SOMETABLE

After correcting:
Input:


SELECT
  U1.FULL_NAME || ' (' || U1.USER_NAME || ')' AS CREATED_BY,
  U2.FULL_NAME || ' (' || U2.USER_NAME || ')' AS LAST_EDITED_BY
FROM SOMETABLE

Output:


SELECT
  U1.FULL_NAME || ' (' || U1.USER_NAME || ')' AS CREATED_BY,
  U2.FULL_NAME || ' (' || U2.USER_NAME || ')' AS LAST_EDITED_BY
FROM
  SOMETABLE

I tested these operators '&&', '!=' and they were also formatted incorrectly
I fixed this
Before correction:
Input:


SELECT
  U1.FULL_NAME && ' (' && U1.USER_NAME && ')' AS CREATED_BY,
  U2.FULL_NAME && ' (' != U2.USER_NAME &&')' AS LAST_EDITED_BY
FROM SOMETABLE

Output


SELECT
   U1.FULL_NAME & & ' (' & & U1.USER_NAME & & ')' AS CREATED_BY,
   U2.FULL_NAME & & ' (' ! = U2.USER_NAME & & ')' AS LAST_EDITED_BY
FROM
  SOMETABLE

After correcting:
Input:


SELECT
  U1.FULL_NAME && ' (' && U1.USER_NAME && ')' AS CREATED_BY,
  U2.FULL_NAME && ' (' != U2.USER_NAME &&')' AS LAST_EDITED_BY
FROM SOMETABLE

Output


SELECT
   U1.FULL_NAME && ' (' && U1.USER_NAME && ')' AS CREATED_BY,
   U2.FULL_NAME && ' (' != U2.USER_NAME && ')' AS LAST_EDITED_BY
FROM
  SOMETABLE

Quality check

Before creating this PR:

  • Did you follow the code style guideline as described in CONTRIBUTING.md
  • Did you build the app and test your changes?
  • Did you check for accessibility? On Windows, you can use Accessibility Insights for this.
  • Did you verify that the change work in Release build configuration
  • Did you verify that all unit tests pass
  • If necessary and if possible, did you verify your changes on:
    • Windows
    • macOS (DevToys 2.0)
    • Linux (DevToys 2.0)

@Vladexy88x Vladexy88x changed the title Added new operators param Added new operators param, and fixed formatted sql May 25, 2023
@Vladexy88x Vladexy88x changed the title Added new operators param, and fixed formatted sql Fixed formatted sql May 25, 2023
@Vladexy88x Vladexy88x changed the title Fixed formatted sql fixed sql formatting for logical operators May 25, 2023
@Vladexy88x Vladexy88x changed the title fixed sql formatting for logical operators Fixed sql formatting for logical operators May 25, 2023
@veler

veler commented May 27, 2023

Copy link
Copy Markdown
Collaborator

Hi,
Thank you very this fix! It will be published soon. :)

@veler
veler merged commit 22d943c into DevToys-app:main May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PostgreSQL SQL formatter breaking concatentation || by adding a space between the pipes

2 participants