GSP .NET SQL formatter options¶
This is the complete reference for the 69 public fields on
GFmtOpt in GSP .NET. It is generated from the source .NET XML documentation,
so option behavior and website documentation have one source of truth.
For the parse-and-format workflow and runnable recipes, start with
Format (pretty-print) SQL.
.NET has no maxSelectListColumn; its default caseIdentifier is CoLowercase, and its active formatter currently emits plain SQL only.
Configure related options together
A list style, its comma style, and its first-item newline are separate
controls. Comma placement generally produces line breaks only with a
stacked style. Cpmugly compact mode bypasses most normal layout controls.
.NET factory instances are thread-shared
GFmtOptFactory.newInstance() returns the same mutable object on repeated
calls from one managed thread. Configure it once or explicitly reset every
field your code changes; do not assume it creates a clean option set.
Categories¶
Allowed values¶
These enums are shared by several fields. Read their value semantics before combining a layout field with a comma, alignment, case, or blank-line field.
TAlignStyle¶
| Value | Meaning |
|---|---|
AsStacked |
Put later list items on aligned lines using the selected comma style. |
AsWrapped |
Keep list items on the current line and normalize separators to spaces. |
TLinefeedsCommaOption¶
| Value | Meaning |
|---|---|
LfAfterComma |
Keep the comma at the end of the previous item, then break the line. |
LfbeforeCommaWithSpace |
Break before the comma and insert one space between it and the next item. |
LfBeforeComma |
Break before the comma without inserting a following space. |
TAlignOption¶
| Value | Meaning |
|---|---|
AloLeft |
Keep the text's left edge fixed and append padding on the right. |
AloRight |
Prepend padding so the text's right edge aligns with the widest item. |
TCaseOption¶
| Value | Meaning |
|---|---|
CoUppercase |
Convert every character to upper case. |
CoLowercase |
Convert every character to lower case. |
CoNoChange |
Preserve the token text exactly as parsed. |
CoInitCap |
Upper-case each space-delimited word's first character and lower-case the rest. |
TEmptyLinesOption¶
| Value | Meaning |
|---|---|
EloMergeIntoOne |
Collapse two or more separating line breaks to one blank line. |
EloRemove |
Remove blank lines while retaining the newline that separates statements. |
EloPreserve |
Reproduce the number of blank lines present in the input. |
TCompactMode¶
| Value | Meaning |
|---|---|
CpmNone |
Run the normal statement-specific pretty-printing pipeline. |
Cpmugly |
Skip normal layout and emit compact token text, wrapping at the configured line width. |
GOutputFmt¶
| Value | Meaning |
|---|---|
ofSql |
Plain formatted SQL; supported. |
ofCsharp |
Legacy C# source renderer selector; not implemented. |
ofCsharpsbd |
Legacy C# StringBuilder renderer selector; not implemented. |
ofvb |
Legacy Visual Basic source renderer selector; not implemented. |
ofvbsbd |
Legacy Visual Basic StringBuilder renderer selector; not implemented. |
ofjava |
Legacy Java source renderer selector; not implemented. |
ofjavasbf |
Legacy Java StringBuffer renderer selector; not implemented. |
ofvc |
Legacy Visual C++ source renderer selector; not implemented. |
ofpascal |
Legacy Pascal source renderer selector; not implemented. |
ofphp |
Legacy PHP source renderer selector; not implemented. |
ofproc |
Legacy embedded-C renderer selector; not implemented. |
ofprocobol |
Legacy embedded-COBOL renderer selector; not implemented. |
ofhtml |
Legacy HTML renderer selector; not implemented in GSP .NET. |
ofhtml2 |
Legacy alternate HTML renderer selector; not implemented. |
ofhtmlkeeplayout |
Legacy layout-preserving HTML renderer selector; not implemented. |
ofhtmlkeeplayout2 |
Legacy alternate layout-preserving HTML renderer selector; not implemented. |
ofhtmlkeeplayoutmodifycase |
Legacy case-modifying HTML renderer selector; not implemented. |
ofhtmlkeeplayout2modifycase |
Legacy alternate case-modifying HTML renderer selector; not implemented. |
oftxtmodifycase |
Legacy case-modifying text renderer selector; not implemented. |
ofxml |
Legacy XML renderer selector; not implemented. |
ofdbobject |
Legacy database-object renderer selector; not implemented. |
ofrtf |
Legacy rich-text renderer selector; not implemented. |
ofrtfkeeplayout |
Legacy layout-preserving rich-text renderer selector; not implemented. |
ofrtfkeeplayoutmodifycase |
Legacy case-modifying rich-text renderer selector; not implemented. |
ofFromCSharp |
Legacy C#-input conversion selector; not implemented. |
ofFromVB |
Legacy Visual Basic-input conversion selector; not implemented. |
ofFromVC |
Legacy Visual C++-input conversion selector; not implemented. |
ofFromJava |
Legacy Java-input conversion selector; not implemented. |
ofFromPhp |
Legacy PHP-input conversion selector; not implemented. |
ofFromPascal |
Legacy Pascal-input conversion selector; not implemented. |
ofUnknown |
Unknown output selector; treated as plain SQL. |
Lifecycle and advanced controls¶
sessionId¶
- Type:
string - Default: supplied to the constructor
Identifies the formatting session used by formatter, processor, and mediator caches. The id is not rendered in the output. The no-argument factory reuses one option instance per managed thread.
operateSourceToken¶
- Type:
bool - Default: true
Enables the low-level source-token mutations that implement formatting. False makes token add/remove helpers ignore requests and disables most formatting; use it for diagnostics, not as a preserve-layout mode.
SELECT list and query clauses¶
selectColumnlistStyle¶
- Type:
TAlignStyle - Default: AsStacked
Chooses stacked or wrapped layout for SELECT result columns and for GROUP BY and ORDER BY lists. Stacked layout uses selectColumnlistComma; wrapped layout keeps items on the current line. Alias alignment applies only to stacked lists.
selectColumnlistComma¶
- Type:
TLinefeedsCommaOption - Default: LfAfterComma
Chooses whether a comma ends the previous line or begins the next line in stacked SELECT, GROUP BY, and ORDER BY lists. It has no line-break effect when selectColumnlistStyle is wrapped.
selectItemInNewLine¶
- Type:
bool - Default: false
Places the first SELECT item on a line after SELECT. The same switch also places the first GROUP BY and ORDER BY item, and the HAVING expression, after their clause keywords; subsequent breaks use the list style and comma option.
alignAliasInSelectList¶
- Type:
bool - Default: true
Pads stacked SELECT expressions so explicit or implicit aliases start in the same column. It is ignored for wrapped lists.
treatDistinctAsVirtualColumn¶
- Type:
bool - Default: false
Adds a synthetic DISTINCT result-column node to the parsed SELECT list so it participates in stacking and comma-layout calculations. This mutates the statement's result-column list for formatting, although rendered SQL semantics are unchanged.
FROM, JOIN, and WHERE¶
selectFromclauseStyle¶
- Type:
TAlignStyle - Default: AsStacked
Chooses stacked or wrapped layout for comma-separated table sources in a FROM clause. JOIN clauses have separate newline and alignment controls.
selectFromclauseComma¶
- Type:
TLinefeedsCommaOption - Default: LfAfterComma
Positions commas for stacked comma-separated FROM items. It is effective only when selectFromclauseStyle is stacked.
fromClauseInNewLine¶
- Type:
bool - Default: false
Places the first table source on a new indented line after FROM and the corresponding INTO source where that clause shares the processor. False separates the clause keyword and first source with one space.
selectFromclauseJoinOnInNewline¶
- Type:
bool - Default: true
Places the ON condition of a JOIN on a separate line. JOIN keywords are normalized onto their own lines independently of this switch.
alignJoinWithFromKeyword¶
- Type:
bool - Default: false
Aligns the beginning of JOIN phrases with the FROM keyword rather than with the first table source. It does not control the ON line break.
andOrUnderWhere¶
- Type:
bool - Default: false
Aligns leading AND and OR operators under the WHERE keyword. False uses the expression formatter's normal continuation indentation.
INSERT and general lists¶
insertColumnlistStyle¶
- Type:
TAlignStyle - Default: AsStacked
Chooses stacked or wrapped layout for the target-column list of INSERT. Commas use defaultCommaOption.
insertValuelistStyle¶
- Type:
TAlignStyle - Default: AsStacked
Chooses stacked or wrapped layout for each INSERT VALUES list. Commas use defaultCommaOption.
defaultCommaOption¶
- Type:
TLinefeedsCommaOption - Default: LfAfterComma
Provides comma placement for lists without a dedicated comma setting, including INSERT columns/values, UPDATE SET items, and CREATE TABLE items.
defaultAligntype¶
- Type:
TAlignStyle - Default: AsStacked
Provides stacked or wrapped layout for lists without a dedicated style, notably UPDATE SET and CREATE TABLE lists. INSERT has its own style fields.
CREATE TABLE¶
beStyleCreatetableLeftBEOnNewline¶
- Type:
bool - Default: false
Places the opening parenthesis of a CREATE TABLE column list on a new line and indents it by indentLen. Newline list items receive one additional indentation level.
beStyleCreatetableRightBEOnNewline¶
- Type:
bool - Default: false
Places the closing parenthesis of a CREATE TABLE column list on its own line. Indentation accounts for whether the opening parenthesis moved too.
createtableListitemInNewLine¶
- Type:
bool - Default: false
Places the first CREATE TABLE column or constraint on a new line after the opening parenthesis. Remaining items follow the default list style and comma option.
createtableFieldlistAlignOption¶
- Type:
TAlignOption - Default: AloLeft
Left- or right-aligns CREATE TABLE column names within the widest column- name width. It applies only when defaultAligntype is stacked.
Indentation and procedural blocks¶
indentLen¶
- Type:
int - Default: 2
Sets the general indentation increment in columns for nested clauses, expressions, CTE bodies, parameters, and statement processors. Specialized indentation options add to this value.
useTab¶
- Type:
bool - Default: false
Enables the final tab-alignment pass. The formatter first computes spaces, then pads each indented line to a multiple of tabSize; it does not replace all indentation characters with literal tabs.
tabSize¶
- Type:
int - Default: 2
Defines the tab-stop width used by the final tab-alignment pass when useTab is enabled. Use a positive value.
beStyleFunctionBodyIndent¶
- Type:
int - Default: 2; currently has no effect
Reserved compatibility setting for stored-routine body indentation. The active formatter does not read this field; use beStyleBlockIndentSize and indentLen instead.
beStyleBlockLeftBEOnNewline¶
- Type:
bool - Default: true
Places a procedural BEGIN token on a new line. PL/SQL-like blocks and SQL Server block formatting use vendor-specific paths with related indentation fields.
beStyleBlockLeftBEIndentSize¶
- Type:
int - Default: 2
Adds columns to the containing statement's indentation for a BEGIN token moved to a new line. It is meaningful when the left-BEGIN switch is true.
beStyleBlockRightBEIndentSize¶
- Type:
int - Default: 2
Controls END indentation for block paths where BEGIN remains on the current line. Paths that move BEGIN align END using the BEGIN indent instead.
beStyleBlockIndentSize¶
- Type:
int - Default: 2
Adds indentation to statements inside BEGIN/END blocks and to returned query bodies in supported CREATE FUNCTION and CREATE VIEW forms.
beStyleIfElseSingleStmtIndentSize¶
- Type:
int - Default: 2
Adds indentation to a single statement controlled by IF or ELSE when the body is not a BEGIN/END block. Block bodies use the block settings.
CASE expressions¶
caseWhenThenInSameLine¶
- Type:
bool - Default: false
Keeps each WHEN condition and THEN keyword on one line. False puts THEN on a new line and additionally uses indentCaseThen.
indentCaseFromSwitch¶
- Type:
int - Default: 2
Indents WHEN, ELSE, and END relative to the CASE keyword by this many columns at each CASE nesting level.
indentCaseThen¶
- Type:
int - Default: 0
Adds indentation to a line-broken THEN relative to its WHEN indentation. It is ignored when WHEN and THEN stay on the same line.
Keyword alignment and capitalization¶
selectKeywordsAlignOption¶
- Type:
TAlignOption - Default: AloLeft
Left- or right-aligns query clause labels such as SELECT, FROM, WHERE, GROUP BY, HAVING, and ORDER BY within their shared keyword width.
caseKeywords¶
- Type:
TCaseOption - Default: CoUppercase
Converts SQL keyword tokens to the selected case. Datatypes and recognized function names use their dedicated settings instead.
caseIdentifier¶
- Type:
TCaseOption - Default: CoLowercase in GSP .NET; GSP Java defaults to CoNoChange
Converts unquoted identifiers that are not recognized as datatypes or function names. Case conversion can change semantics in case-sensitive databases.
caseQuotedIdentifier¶
- Type:
TCaseOption - Default: CoNoChange
Converts double-quoted identifier contents while preserving quote characters. Quoted identifiers are frequently case-sensitive.
caseFuncname¶
- Type:
TCaseOption - Default: CoInitCap
Converts tokens recognized by the parser as function names, including built-in and user-defined calls where classification is available.
caseDatatype¶
- Type:
TCaseOption - Default: CoUppercase
Converts tokens recognized as datatype names. This classification takes precedence over general keyword and identifier case settings.
Whitespace and parentheses¶
wsPaddingOperatorArithmetic¶
- Type:
bool - Default: true
Inserts one space on both sides of recognized binary arithmetic and comparison operators. Unary plus and minus remain adjacent to the operand.
wsPaddingParenthesesInFunction¶
- Type:
bool - Default: false
Inserts one space inside parameter-list parentheses of CREATE FUNCTION, PROCEDURE, PACKAGE, and TRIGGER declarations when parameters are present. It does not affect ordinary function calls.
wsPaddingParenthesesInExpression¶
- Type:
bool - Default: true
Inserts one space inside parentheses that group an expression. Subqueries, function calls, and datatype parameters use separate options.
wsPaddingParenthesesOfSubQuery¶
- Type:
bool - Default: false
Inserts one space inside parentheses that enclose a formatted subquery. Internal line breaks still come from the nested statement formatter.
wsPaddingParenthesesInFunctionCall¶
- Type:
bool - Default: false
Inserts one space inside ordinary function-call parentheses. Routine declaration parentheses use a separate option.
wsPaddingParenthesesOfTypename¶
- Type:
bool - Default: false
Inserts one space inside datatype-parameter parentheses, such as VARCHAR( 20 ), when the parser classifies the node as a type name.
CTEs and declarations¶
cteNewlineBeforeAs¶
- Type:
bool - Default: true
Places the AS keyword of each common table expression on a new line aligned under the CTE name area. False keeps AS after the header with one space.
linebreakAfterDeclare¶
- Type:
bool - Default: false
Places the first variable declaration on a new indented line after DECLARE. Later declaration items are always stacked by the DECLARE formatter.
Routine declarations and EXEC¶
parametersStyle¶
- Type:
TAlignStyle - Default: AsStacked
Chooses stacked or wrapped layout for stored-routine, package, trigger, and supported CREATE VIEW parameter declarations. Stacked parameters also have their names/types aligned.
parametersComma¶
- Type:
TLinefeedsCommaOption - Default: LfAfterComma
Positions commas for stacked stored-routine parameter declarations. It is effective when parametersStyle is stacked.
beStyleFunctionLeftBEOnNewline¶
- Type:
bool - Default: false
Places the opening parenthesis of a stored-routine parameter list on a new line. It applies only when a parameter declaration list exists.
beStyleFunctionLeftBEIndentSize¶
- Type:
int - Default: 0
Adds columns to the indentation of a stored-routine opening parenthesis moved to a new line. It is ignored unless the related newline option is true.
beStyleFunctionRightBEOnNewline¶
- Type:
bool - Default: true
Places the closing parenthesis of a stored-routine parameter list on a new line. It applies only when a parameter declaration list exists.
beStyleFunctionRightBEIndentSize¶
- Type:
int - Default: 0
Adds columns relative to the routine declaration for a parameter-list closing parenthesis moved to a new line. It is ignored otherwise.
beStyleFunctionFirstParamInNewline¶
- Type:
bool - Default: false
Places the first stored-routine parameter on a new line one general indentation level beyond the current parameter-list indentation. Subsequent parameters follow the parameter style and comma settings.
linebreakBeforeParamInExec¶
- Type:
bool - Default: true
Places the first SQL Server EXEC/EXECUTE argument on a new line, indented by indentLen from the statement.
Blank lines and batches¶
emptyLines¶
- Type:
TEmptyLinesOption - Default: EloMergeIntoOne
Determines how blank lines between top-level statements are handled: remove them, collapse them to one blank line, or preserve their count. Statement-separating newlines remain.
insertBlankLineInBatchSqls¶
- Type:
bool - Default: false
Inserts a blank line between statements inside supported BEGIN/END batches. It is applied in addition to the general blank-line policy.
noEmptyLinesBetweenMultiSetStmts¶
- Type:
bool - Default: false
Suppresses the formatter's automatic blank line between adjacent SET or DECLARE-family statements. Ordinary separator newlines remain.
Line numbers¶
linenumberEnabled¶
- Type:
bool - Default: false
Prefixes every output line with a zero-padded line number. Width is based on the formatted line count and the margin fields control surrounding spaces.
linenumberZeroBased¶
- Type:
bool - Default: false (one-based numbering)
Starts line numbers at zero when true, or one when false. It has no effect unless linenumberEnabled is enabled.
linenumberLeftMargin¶
- Type:
int - Default: 0
Inserts this many spaces before each generated line number. It has no effect unless line numbering is enabled.
linenumberRightMargin¶
- Type:
int - Default: 2
Inserts this many spaces between each generated line number and SQL text. It has no effect unless line numbering is enabled.
Function calls¶
functionCallParametersStyle¶
- Type:
TAlignStyle - Default: AsWrapped
Chooses stacked or wrapped layout for argument lists in ordinary function calls, independently of routine declaration parameter layout.
functionCallParametersComma¶
- Type:
TLinefeedsCommaOption - Default: LfAfterComma
Positions commas when ordinary function-call arguments use stacked layout. It has no line-break effect while the function-call style is wrapped.
Comments, compact mode, and wrapping¶
removeComment¶
- Type:
bool - Default: false
Removes ordinary line and block comments before formatting and reparses the modified token stream. Oracle optimizer hints beginning with /*+ are preserved. Use a fresh parser if original comments are needed later.
compactMode¶
- Type:
TCompactMode - Default: CpmNone
Selects normal pretty-printing or compact output. Cpmugly short-circuits statement-specific layout and wraps only when lineWidth is exceeded, so most layout options are ignored.
lineWidth¶
- Type:
int - Default: 99
Sets the maximum line width used by compact mode. It is a soft limit; indivisible tokens can exceed it. The active normal pretty-printing pipeline does not currently use this field.
Output rendering¶
outputFmt¶
- Type:
GOutputFmt - Default: ofSql. Unlike GSP Java, GSP .NET does not currently implement ofhtml
Selects the output renderer. The active GSP .NET formatter supports ofSql; ofUnknown falls back to SQL. Every other legacy value throws NotSupportedException.
tabHtmlString¶
- Type:
string - Default: four entities; currently has no effect in GSP .NET
Reserved compatibility setting for converting literal tabs in HTML output. GSP .NET has no active HTML renderer and no formatter component currently reads this field.
Keeping this page current¶
Edit the field or enum documentation in the corresponding GSP source tree, then regenerate both references:
1 2 | |