Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed sql formatting for logical operators #820

Merged
merged 1 commit into from May 27, 2023

Conversation

Vladexy88x
Copy link

@Vladexy88x Vladexy88x commented May 25, 2023

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
Copy link
Collaborator

veler commented May 27, 2023

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

@veler veler merged commit 22d943c into DevToys-app:main May 27, 2023
1 check passed
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