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

Please don't indent JOIN-s #89

Open
arcadeus opened this issue Jul 27, 2016 · 1 comment
Open

Please don't indent JOIN-s #89

arcadeus opened this issue Jul 27, 2016 · 1 comment

Comments

@arcadeus
Copy link

JOIN clauses are at the same hierarchy level as FROM clause, which is correctly not indented.

F.e. better formatting for

...
FROM 
  {shop} AS s 
  LEFT JOIN {shop_price} AS pr ON pr.good_id = s.id 
  AND pr.trash = '0' 
  AND pr.date_start <= 1469606657 
  AND (
    pr.date_start = 0 
    OR pr.date_finish >= 1469606657
  ) 
  AND pr.currency_id = 0 
  AND pr.role_id = 0 
  AND (pr.person = '0') 
  INNER JOIN {shop_param_element} AS pe3 ON pe3.element_id = s.id 
  AND pe3.param_id = '%d' 
  AND pe3.trash = '0' 
...

.. would be

...
FROM 
  {shop} AS s 
LEFT JOIN {shop_price} AS pr ON pr.good_id = s.id 
  AND pr.trash = '0' 
  AND pr.date_start <= 1469606657 
  AND (
    pr.date_start = 0 
    OR pr.date_finish >= 1469606657
  ) 
  AND pr.currency_id = 0 
  AND pr.role_id = 0 
  AND (pr.person = '0') 
INNER JOIN {shop_param_element} AS pe3 ON pe3.element_id = s.id 
  AND pe3.param_id = '%d' 
  AND pe3.trash = '0' 
...
@stof
Copy link
Contributor

stof commented Jul 27, 2016

technically, this is not true. Joins are a subpart of the FROM clause in SQL.
The indentation of AND in ON clauses is not good though

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

No branches or pull requests

2 participants