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

new format config for skipping white spaces before and after block pa… #69

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

hemlac
Copy link
Contributor

@hemlac hemlac commented Jan 10, 2024

With this new config parameter you are able to skip white spaces before and after block parentheses.
For example
Without this parameter:
CREATE VIEW sakila.v_exampl (customer, phone, title) AS select concat(sakila.customer.last_name,', ',sakila.customer.first_name) AS customer,sakila.address.phone AS phone,sakila.film.title AS title from ((((sakila.rental join sakila.customer on((sakila.rental.customer_id = sakila.customer.customer_id))) join sakila.address on((sakila.customer.address_id = sakila.address.address_id))) join sakila.inventory on((sakila.rental.inventory_id = sakila.inventory.inventory_id))) join sakila.film on((sakila.inventory.film_id = sakila.film.film_id))) where ((sakila.rental.return_date is null) and ((sakila.rental.rental_date + interval sakila.film.rental_duration day) < curdate())) order by sakila.film.title limit 5
Result:
CREATE VIEW sakila.v_exampl (customer, phone, title) AS
select
concat(
sakila.customer.last_name,
', ',
sakila.customer.first_name
) AS customer,
sakila.address.phone AS phone,
sakila.film.title AS title
from
(
(
(
(
sakila.rental
join sakila.customer on(
(
sakila.rental.customer_id = sakila.customer.customer_id
)
)
)
join sakila.address on(
(
sakila.customer.address_id = sakila.address.address_id
)
)
)
join sakila.inventory on(
(
sakila.rental.inventory_id = sakila.inventory.inventory_id
)
)
)
join sakila.film on((sakila.inventory.film_id = sakila.film.film_id))
)
where
(
(sakila.rental.return_date is null)
and (
(
sakila.rental.rental_date + interval sakila.film.rental_duration day
) < curdate()
)
)
order by
sakila.film.title
limit
5

With this new parameter
CREATE VIEW sakila.v_exampl (customer, phone, title) AS
select
concat(sakila.customer.last_name,
', ',
sakila.customer.first_name)AS customer,
sakila.address.phone AS phone,
sakila.film.title AS title
from
((((sakila.rental
join sakila.customer on((sakila.rental.customer_id = sakila.customer.customer_id)))
join sakila.address on((sakila.customer.address_id = sakila.address.address_id)))
join sakila.inventory on((sakila.rental.inventory_id = sakila.inventory.inventory_id)))
join sakila.film on((sakila.inventory.film_id = sakila.film.film_id)))
where
((sakila.rental.return_date is null)
and ((sakila.rental.rental_date + interval sakila.film.rental_duration day)< curdate()))
order by
sakila.film.title
limit
5

@hemlac hemlac marked this pull request as ready for review January 10, 2024 20:58
@hemlac
Copy link
Contributor Author

hemlac commented Apr 3, 2024

@vertical-blank could you please review my pull request?

@vertical-blank
Copy link
Owner

@hemlac
I am very sorry that I have kept you waiting for so long.

The Github actions were broken and I have fixed it.
Could you please reopen the pull request to check the CI results?

@hemlac hemlac closed this Apr 4, 2024
@hemlac hemlac reopened this Apr 4, 2024
@hemlac
Copy link
Contributor Author

hemlac commented Apr 4, 2024

@vertical-blank
done

@vertical-blank
Copy link
Owner

LGTM
@hemlac Thanks a lot.

@vertical-blank vertical-blank merged commit 86233c3 into vertical-blank:master Apr 4, 2024
1 check failed
@hemlac
Copy link
Contributor Author

hemlac commented Apr 4, 2024

@vertical-blank
thank you too!
can you please create a new release?

@vertical-blank
Copy link
Owner

@hemlac
I've just released 2.0.5 to Maven Central.
https://repo1.maven.org/maven2/com/github/vertical-blank/sql-formatter/2.0.5/

@hemlac
Copy link
Contributor Author

hemlac commented Apr 9, 2024

@vertical-blank
Thank you very much!

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