question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve readibility of where block with multiple and nested and/or

See original GitHub issue

Contexte

Content before formatting: image

Content after formatting: image

As you can see in the images, formatting the querry has reduced it’s readibility:

  • and and or have the same line break rules
  • nested parenthesis are totally ignore in the formatting

Describe the solution you’d like

I think the readibility would be better if nested parenthesis’s elements are right indented +1, example: image

(The same indentation could be done between the or and and statement to visually identify the evaluation groups)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
LonwoLonwocommented, Apr 1, 2021

Implemented in DBeaver 21.0.2 DBeaver will add indents for OR, AND keywords, if they are first in brackets.

Example:

SELECT * FROM table_name
WHERE lname = ’Germy’
AND (fname = ’Ivan’ OR fname = ’Ron’ OR fname = ’Garry’ OR (1 = 1 AND 2 = 2));

Result will be: 2021-04-01 11_51_40-DBeaver Enterprise 21 0 2 - none Script-17

0reactions
uslsscommented, Apr 1, 2021

verified

Read more comments on GitHub >

github_iconTop Results From Across the Web

How would you refactor nested IF Statements? [duplicate]
1 - Nested Small Functions. Take each if and its code block and turn it into a function. If the boolean check fails,...
Read more >
Untangling Nested Code - Jason McCreary
Let's take a look at a few examples of nested code and practices for improving their readability. Empty blocks. You may not believe...
Read more >
6 Tips to Improve Your Conditional Statements for Better ...
6 Tips to Improve Your Conditional Statements for Better Readability · 1. Returning Early Instead of if…else · 2. Using Array.includes · 3....
Read more >
How can I simplify or improve readability in complex logic ...
I'd simply use a temporary variable to clean things up: auto code = ncode[i] + key[ikey]; if ( (code > 90 && code...
Read more >
nginx giving priority to nested location over outer location block
Yes nginx has to choose one location so it won't report the matching later even if you are nesting these. When you use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found