Skip to content

Fix: Formatting and indenting SQL with bind variables #84

@xterao

Description

@xterao

Unintended indentation is generated in specific SQL statements using bind variables:

  1. Insufficient indentation for keyword groups within SELECT statements.
SELECT x
  FROM x
 ORDER BY x
       , y  -- Insufficient indentation
  1. Increased indentation for comma lines in specific UPDATE statement syntax.
UPDATE /*# tableName */
 SET (x
      , x
         , x
            /*%for entity : entities */
            , /*# entity.itemIdentifier */
 /*%end*/) = ( /* @userId() */1
          , x
             , x + 1
                /*%for entity : entities */
                , /* entity.value */'abc'
 /*%end*/)
 WHERE x = /* reportId */1 
  1. Increased indentation for comma lines in INSERT statement syntax.
INSERT INTO /*# tableName */
            (x
             , x
                /*%for entity : entities */
                , /*# entity.itemIdentifier */
                   /*%end*/
                   , x
                      , x
                         , x
                            , x
                               , x
                                  , x)
     VALUES ( /* reportId */1
             , /* @tenantId() */1
                /*%for entity : entities */
                , /* entity.value */'abc'
                   /*%end*/
                   , /* @userId() */1
                      , x
                         , /* @userId() */1
                            , x
                               , 1
                                  , /* @maxDateTime() */'9999-12-31')

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions