56 lines
1.1 KiB
Plaintext
56 lines
1.1 KiB
Plaintext
In the absence of enclosing ``++BEGIN...END++`` block, the line immediately after a conditional is the one that is conditionally executed. By both convention and good practice, such lines are indented. In the absence of both ``++BEGIN...END++`` block and indentation the intent of the original programmer is entirely unclear and perhaps not actually what is executed. Additionally, such code is highly likely to be confusing to maintainers.
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,sql]
|
|
----
|
|
IF @condition -- Noncompliant
|
|
EXEC doTheThing;
|
|
EXEC doTheOtherThing;
|
|
EXEX somethingElseEntirely;
|
|
|
|
EXEC foo;
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
[source,sql]
|
|
----
|
|
IF @condition
|
|
BEGIN
|
|
EXEC doTheThing;
|
|
EXEC doTheOtherThing;
|
|
EXEX somethingElseEntirely;
|
|
END;
|
|
|
|
EXEC foo;
|
|
----
|
|
Or
|
|
|
|
[source,sql]
|
|
----
|
|
IF @condition
|
|
EXEC doTheThing;
|
|
EXEC doTheOtherThing;
|
|
EXEX somethingElseEntirely;
|
|
|
|
EXEC foo;
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|