Skip to content

Latest commit

 

History

History
90 lines (64 loc) · 1.84 KB

DdlPositionSelectRule.md

File metadata and controls

90 lines (64 loc) · 1.84 KB

<-- previous rule | overview | next rule -->

Break before AS SELECT etc.

Standardizes line breaks and indentation before entity name, WITH PARAMETERS, [AS] SELECT, AS PROJECTION ON and data source.

Options

  • Break before AS SELECT FROM: [Always]
  • Indent if breaking: [2]
  • Break before SELECT FROM after UNION etc. [Always]
  • Indent if breaking: [2]
  • Break before AS PROJECTION ON: [Always]
  • Indent if breaking: [2]
  • Break before data source: [Never]
  • Indent if breaking: [4]

Examples

define view entity C_AnyEntity as select
from I_AnyEntity as AnyAlias

    left outer to one join I_OtherEntity as OtherAlias
      on AnyAlias.IdField = OtherAlias.IdField

{
  key AnyAlias.AnyKeyField,
      AnyAlias.AnyNonKeyField
}

union
  all
    select
      from
        I_ThirdEntity As ThirdAlias

{
  key ThirdAlias.AnyKeyField,
      ThirdAlias.AnyNonKeyField
}

except select
from I_FourthEntity As FourthAlias

{
  key FourthAlias.AnyKeyField,
      FourthAlias.AnyNonKeyField
}

Resulting code:

define view entity C_AnyEntity
  as select from I_AnyEntity as AnyAlias

    left outer to one join I_OtherEntity as OtherAlias
      on AnyAlias.IdField = OtherAlias.IdField

{
  key AnyAlias.AnyKeyField,
      AnyAlias.AnyNonKeyField
}

union all
  select from I_ThirdEntity As ThirdAlias

{
  key ThirdAlias.AnyKeyField,
      ThirdAlias.AnyNonKeyField
}

except
  select from I_FourthEntity As FourthAlias

{
  key FourthAlias.AnyKeyField,
      FourthAlias.AnyNonKeyField
}

Related code