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

allow expanded select to be multiline #689

Merged
merged 1 commit into from
Sep 17, 2023

Conversation

roddone
Copy link

@roddone roddone commented Sep 12, 2023

Hi,

This PR's purpose is to allow expanded select to accept multiline inputs. (currently any multiline expanded select compiles a wrong SQL query)
Expanded select is a great feature for small queries, but for big ones it quickly became complicated to read the query.
For example, the following Query :

var q = new Query().From("users").Select("users.{id,name, age, password, description, admin, last_update, company, title, addr1 as AddressNumber, addr2 as AddressStreet, addr3 as AddressPostalCode, addr4 as AddressCountry, dept, /* other fields */ }");

is much more readable this way :

var q = new Query().From("users").Select(@"users.{
          id, name, age, password, description, //allow multiple parameters on the same line
          admin, last_update, //allow multiple lines
          company, title, dept,  
          addr1 as AddressNumber, addr2 as AddressStreet, //allow "as" syntax
          addr3 as AddressPostalCode, addr4 as AddressCountry, 
          /* other fields */
      }");

Regards,

Romain.

@ghost
Copy link

ghost commented Sep 12, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@ahmad-moussawi
Copy link
Contributor

I like this!, added to the merge train

@ahmad-moussawi ahmad-moussawi merged commit c202922 into sqlkata:master Sep 17, 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.

2 participants