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

SQL Server: use XOR to translate some == and != expressions #34124

Merged
merged 2 commits into from
Jul 3, 2024

Commits on Jul 2, 2024

  1. Use XOR to translate some == and != expressions

    When the parent expression is not a predicate, translate `x != y` to:
    ```sql
    x ^ y
    ```
    
    instead of
    
    ```sql
    CASE
        WHEN x <> y THEN CAST(1 AS bit)
        ELSE CAST(0 AS bit)
    END
    ```
    
    Similarly, translate `x == y` to:
    
    ```sql
    x ^ y ^ CAST(1 AS bit)
    ```
    
    instead of
    
    ```sql
    CASE
        WHEN x == y THEN CAST(1 AS bit)
        ELSE CAST(0 AS bit)
    END
    ```
    
    Contributes to dotnet#34001 for simple cases (comparison of BIT expressions).
    ranma42 committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    0ff8290 View commit details
    Browse the repository at this point in the history
  2. Update baselines

    ranma42 committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    fa88467 View commit details
    Browse the repository at this point in the history