I've seen people do this in the SELECT portion of SQL queries too.
Personally, I hate this.
I've seen people do this in the SELECT portion of SQL queries too.
Personally, I hate this.
That would only be an advantage above comma at the end on the last line. It really only moves the problem from the last line to the first one. Now you can't comment out the first line without removing a comma...
It can make resolving merges just a little bit easier.
select *
from foo
where 1=1
AND bar = 1
AND baz = 2
That way you can comment out any of your conditions without breaking the syntax. UPDATE FOO
SET BAR = 1
, BAZ = 2
, QUUX = 3
I like it that way. Makes it clear the relationship between the continuing lines and their parents. Just the natural extension of WHERE ALICE = 1
AND BOB =2
AND CHARLIE = 3In your example, I don't know SET BAR = 1 isn't the end until I read the next line.
I mean, it's kind of the SQL analogue to the
MyObject
.Child
.Grandchild
.ItsMethod(stuff)
.HeyThatReturnedAnotherObject()
.MoreObject(moreStuff)It also lets you remove the line (for the same reason that you can comment it out) without modifying other lines. This is somewhat convenient if the file is one that you are going to manually edit (and even more useful if it is going to be the subject of line-oriented diffing tools, since the only changed lines will be the ones with meaningful changes.)
I'd agree that its less readable, though.