Skip to content

SQL block indentation

shenhuan2021 edited this page Mar 3, 2024 · 15 revisions

Delphi

  • gfmtopt.BEStyle_Block_leftBEOnNewline, type of Boolean
  • gfmtopt.BEStyle_Block_leftBEIndentSize, type of Integer, default is 2
  • gfmtopt.BEStyle_Block_rightBEIndentSize , type of Integer, default is 2
  • gfmtopt.BEStyle_BlockIndentSize, type of integer, default is 2

Java

  • public Boolean beStyleBlockLeftBEOnNewline, type of Boolean
  • public Integer beStyleBlockLeftBEIndentSize, type of Integer, default is 2
  • public Integer beStyleBlockRightBEIndentSize, type of Boolean
  • public Integer beStyleBlockIndentSize, type of Integer, default is 2

Uniform

  • SQL block with BEGIN/END keyword

    Option: fmt128_indent_procedure_body_begin_keyword_in_newline = true, type: TFmtBoolean.

    Option: fmt129_indent_procedure_body_begin_keyword = 0, type: TFmtInt.

    Option: fmt130_indent_procedure_body_end_keyword_in_newline = true, type: TFmtBoolean.

    Option: fmt131_indent_procedure_body_end_keyword = 0, type: TFmtInt.

    Option: fmt132_indent_procedure_body_block_inside_begin_end = 2, type: TFmtInt.

    CREATE PROCEDURE humanresources.Uspgetallemployees  
    AS  
    BEGIN  
      SELECT lastname, 
             firstname, 
             jobtitle, 
             department  
      FROM   humanresources.vemployeedepartment;  
    END  
    • Specify indentation size of BEGIN/END keyword, indentation size of SQLs inside block related to BEGIN/END keyword.

      Option: fmt128_indent_procedure_body_begin_keyword_in_newline = true, type: TFmtBoolean.

      Option: fmt129_indent_procedure_body_begin_keyword = 2, type: TFmtInt.

      Option: fmt130_indent_procedure_body_end_keyword_in_newline = true, type: TFmtBoolean.

      Option: fmt131_indent_procedure_body_end_keyword = 2, type: TFmtInt.

      Option: fmt132_indent_procedure_body_block_inside_begin_end = 2, type: TFmtInt.

      CREATE PROCEDURE humanresources.Uspgetallemployees  
      AS  
        BEGIN  
          SELECT lastname, 
                 firstname, 
                 jobtitle, 
                 department  
          FROM   humanresources.vemployeedepartment;  
        END  
    • BEGIN keyword can be specified not on a new line (Apply to BEGIN keyword in if/while/loop statement only )

      Option: fmt134_indent_if_body_begin_keyword_in_newline = false, type: TFmtBoolean.

      Option: fmt136_indent_if_body_end_keyword_in_newline = true, type: TFmtBoolean.

      Option: fmt137_indent_if_body_end_keyword = 2, type: TFmtInt.

      Option: fmt138_indent_if_body_block_inside_begin_end = 2, type: TFmtInt.

      Option: fmt139_indent_else_body = 2, type: TFmtInt.

      IF @cost <= @compareprice BEGIN  
        PRINT 'These products can be purchased for less than '  
        END  
      ELSE  
        PRINT 'The prices for all products in this category exceed '
Clone this wiki locally