Class GFmtOpt
- Namespace
- gudusoft.gsqlparser.pp.para
- Assembly
- gudusoft.gsqlparser.dll
Mutable configuration for the SQL pretty-printer. Create an instance with GFmtOptFactory, finish configuring it, and do not modify it while a formatting call is in progress.
public class GFmtOpt
- Inheritance
-
GFmtOpt
- Inherited Members
Remarks
Every public field is documented with its default and interactions. Fields in the Lifecycle and advanced controls category are public for compatibility but are not ordinary presentation settings.
Constructors
GFmtOpt(string)
Creates an option set for the supplied formatting-session id.
public GFmtOpt(string sessionId)
Parameters
sessionIdstringCache key shared by components in one formatting call.
Fields
alignAliasInSelectList
Pads stacked SELECT expressions so explicit or implicit aliases start in the same column. It is ignored for wrapped lists.
public bool alignAliasInSelectList
Field Value
Remarks
Category: SELECT list and query clauses. Default: true.
alignJoinWithFromKeyword
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.
public bool alignJoinWithFromKeyword
Field Value
Remarks
Category: FROM, JOIN, and WHERE. Default: false.
andOrUnderWhere
Aligns leading AND and OR operators under the WHERE keyword. False uses the expression formatter's normal continuation indentation.
public bool andOrUnderWhere
Field Value
Remarks
Category: FROM, JOIN, and WHERE. Default: false.
beStyleBlockIndentSize
Adds indentation to statements inside BEGIN/END blocks and to returned query bodies in supported CREATE FUNCTION and CREATE VIEW forms.
public int beStyleBlockIndentSize
Field Value
Remarks
Category: Indentation and procedural blocks. Default: 2.
beStyleBlockLeftBEIndentSize
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.
public int beStyleBlockLeftBEIndentSize
Field Value
Remarks
Category: Indentation and procedural blocks. Default: 2.
beStyleBlockLeftBEOnNewline
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.
public bool beStyleBlockLeftBEOnNewline
Field Value
Remarks
Category: Indentation and procedural blocks. Default: true.
beStyleBlockRightBEIndentSize
Controls END indentation for block paths where BEGIN remains on the current line. Paths that move BEGIN align END using the BEGIN indent instead.
public int beStyleBlockRightBEIndentSize
Field Value
Remarks
Category: Indentation and procedural blocks. Default: 2.
beStyleCreatetableLeftBEOnNewline
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.
public bool beStyleCreatetableLeftBEOnNewline
Field Value
Remarks
Category: CREATE TABLE. Default: false.
beStyleCreatetableRightBEOnNewline
Places the closing parenthesis of a CREATE TABLE column list on its own line. Indentation accounts for whether the opening parenthesis moved too.
public bool beStyleCreatetableRightBEOnNewline
Field Value
Remarks
Category: CREATE TABLE. Default: false.
beStyleFunctionBodyIndent
Reserved compatibility setting for stored-routine body indentation. The active formatter does not read this field; use beStyleBlockIndentSize and indentLen instead.
public int beStyleFunctionBodyIndent
Field Value
Remarks
Category: Indentation and procedural blocks. Default: 2; currently has no effect.
beStyleFunctionFirstParamInNewline
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.
public bool beStyleFunctionFirstParamInNewline
Field Value
Remarks
Category: Routine declarations and EXEC. Default: false.
beStyleFunctionLeftBEIndentSize
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.
public int beStyleFunctionLeftBEIndentSize
Field Value
Remarks
Category: Routine declarations and EXEC. Default: 0.
beStyleFunctionLeftBEOnNewline
Places the opening parenthesis of a stored-routine parameter list on a new line. It applies only when a parameter declaration list exists.
public bool beStyleFunctionLeftBEOnNewline
Field Value
Remarks
Category: Routine declarations and EXEC. Default: false.
beStyleFunctionRightBEIndentSize
Adds columns relative to the routine declaration for a parameter-list closing parenthesis moved to a new line. It is ignored otherwise.
public int beStyleFunctionRightBEIndentSize
Field Value
Remarks
Category: Routine declarations and EXEC. Default: 0.
beStyleFunctionRightBEOnNewline
Places the closing parenthesis of a stored-routine parameter list on a new line. It applies only when a parameter declaration list exists.
public bool beStyleFunctionRightBEOnNewline
Field Value
Remarks
Category: Routine declarations and EXEC. Default: true.
beStyleIfElseSingleStmtIndentSize
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.
public int beStyleIfElseSingleStmtIndentSize
Field Value
Remarks
Category: Indentation and procedural blocks. Default: 2.
caseDatatype
Converts tokens recognized as datatype names. This classification takes precedence over general keyword and identifier case settings.
public TCaseOption caseDatatype
Field Value
Remarks
Category: Keyword alignment and capitalization. Default: CoUppercase.
caseFuncname
Converts tokens recognized by the parser as function names, including built-in and user-defined calls where classification is available.
public TCaseOption caseFuncname
Field Value
Remarks
Category: Keyword alignment and capitalization. Default: CoInitCap.
caseIdentifier
Converts unquoted identifiers that are not recognized as datatypes or function names. Case conversion can change semantics in case-sensitive databases.
public TCaseOption caseIdentifier
Field Value
Remarks
Category: Keyword alignment and capitalization. Default: CoLowercase in GSP .NET; GSP Java defaults to CoNoChange.
caseKeywords
Converts SQL keyword tokens to the selected case. Datatypes and recognized function names use their dedicated settings instead.
public TCaseOption caseKeywords
Field Value
Remarks
Category: Keyword alignment and capitalization. Default: CoUppercase.
caseQuotedIdentifier
Converts double-quoted identifier contents while preserving quote characters. Quoted identifiers are frequently case-sensitive.
public TCaseOption caseQuotedIdentifier
Field Value
Remarks
Category: Keyword alignment and capitalization. Default: CoNoChange.
caseWhenThenInSameLine
Keeps each WHEN condition and THEN keyword on one line. False puts THEN on a new line and additionally uses indentCaseThen.
public bool caseWhenThenInSameLine
Field Value
Remarks
Category: CASE expressions. Default: false.
compactMode
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.
public TCompactMode compactMode
Field Value
Remarks
Category: Comments, compact mode, and wrapping. Default: CpmNone.
createtableFieldlistAlignOption
Left- or right-aligns CREATE TABLE column names within the widest column- name width. It applies only when defaultAligntype is stacked.
public TAlignOption createtableFieldlistAlignOption
Field Value
Remarks
Category: CREATE TABLE. Default: AloLeft.
createtableListitemInNewLine
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.
public bool createtableListitemInNewLine
Field Value
Remarks
Category: CREATE TABLE. Default: false.
cteNewlineBeforeAs
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.
public bool cteNewlineBeforeAs
Field Value
Remarks
Category: CTEs and declarations. Default: true.
defaultAligntype
Provides stacked or wrapped layout for lists without a dedicated style, notably UPDATE SET and CREATE TABLE lists. INSERT has its own style fields.
public TAlignStyle defaultAligntype
Field Value
Remarks
Category: INSERT and general lists. Default: AsStacked.
defaultCommaOption
Provides comma placement for lists without a dedicated comma setting, including INSERT columns/values, UPDATE SET items, and CREATE TABLE items.
public TLinefeedsCommaOption defaultCommaOption
Field Value
Remarks
Category: INSERT and general lists. Default: LfAfterComma.
emptyLines
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.
public TEmptyLinesOption emptyLines
Field Value
Remarks
Category: Blank lines and batches. Default: EloMergeIntoOne.
fromClauseInNewLine
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.
public bool fromClauseInNewLine
Field Value
Remarks
Category: FROM, JOIN, and WHERE. Default: false.
functionCallParametersComma
Positions commas when ordinary function-call arguments use stacked layout. It has no line-break effect while the function-call style is wrapped.
public TLinefeedsCommaOption functionCallParametersComma
Field Value
Remarks
Category: Function calls. Default: LfAfterComma.
functionCallParametersStyle
Chooses stacked or wrapped layout for argument lists in ordinary function calls, independently of routine declaration parameter layout.
public TAlignStyle functionCallParametersStyle
Field Value
Remarks
Category: Function calls. Default: AsWrapped.
indentCaseFromSwitch
Indents WHEN, ELSE, and END relative to the CASE keyword by this many columns at each CASE nesting level.
public int indentCaseFromSwitch
Field Value
Remarks
Category: CASE expressions. Default: 2.
indentCaseThen
Adds indentation to a line-broken THEN relative to its WHEN indentation. It is ignored when WHEN and THEN stay on the same line.
public int indentCaseThen
Field Value
Remarks
Category: CASE expressions. Default: 0.
indentLen
Sets the general indentation increment in columns for nested clauses, expressions, CTE bodies, parameters, and statement processors. Specialized indentation options add to this value.
public int indentLen
Field Value
Remarks
Category: Indentation and procedural blocks. Default: 2.
insertBlankLineInBatchSqls
Inserts a blank line between statements inside supported BEGIN/END batches. It is applied in addition to the general blank-line policy.
public bool insertBlankLineInBatchSqls
Field Value
Remarks
Category: Blank lines and batches. Default: false.
insertColumnlistStyle
Chooses stacked or wrapped layout for the target-column list of INSERT. Commas use defaultCommaOption.
public TAlignStyle insertColumnlistStyle
Field Value
Remarks
Category: INSERT and general lists. Default: AsStacked.
insertValuelistStyle
Chooses stacked or wrapped layout for each INSERT VALUES list. Commas use defaultCommaOption.
public TAlignStyle insertValuelistStyle
Field Value
Remarks
Category: INSERT and general lists. Default: AsStacked.
lineWidth
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.
public int lineWidth
Field Value
Remarks
Category: Comments, compact mode, and wrapping. Default: 99.
linebreakAfterDeclare
Places the first variable declaration on a new indented line after DECLARE. Later declaration items are always stacked by the DECLARE formatter.
public bool linebreakAfterDeclare
Field Value
Remarks
Category: CTEs and declarations. Default: false.
linebreakBeforeParamInExec
Places the first SQL Server EXEC/EXECUTE argument on a new line, indented by indentLen from the statement.
public bool linebreakBeforeParamInExec
Field Value
Remarks
Category: Routine declarations and EXEC. Default: true.
linenumberEnabled
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.
public bool linenumberEnabled
Field Value
Remarks
Category: Line numbers. Default: false.
linenumberLeftMargin
Inserts this many spaces before each generated line number. It has no effect unless line numbering is enabled.
public int linenumberLeftMargin
Field Value
Remarks
Category: Line numbers. Default: 0.
linenumberRightMargin
Inserts this many spaces between each generated line number and SQL text. It has no effect unless line numbering is enabled.
public int linenumberRightMargin
Field Value
Remarks
Category: Line numbers. Default: 2.
linenumberZeroBased
Starts line numbers at zero when true, or one when false. It has no effect unless linenumberEnabled is enabled.
public bool linenumberZeroBased
Field Value
Remarks
Category: Line numbers. Default: false (one-based numbering).
noEmptyLinesBetweenMultiSetStmts
Suppresses the formatter's automatic blank line between adjacent SET or DECLARE-family statements. Ordinary separator newlines remain.
public bool noEmptyLinesBetweenMultiSetStmts
Field Value
Remarks
Category: Blank lines and batches. Default: false.
operateSourceToken
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.
public bool operateSourceToken
Field Value
Remarks
Category: Lifecycle and advanced controls. Default: true.
outputFmt
Selects the output renderer. The active GSP .NET formatter supports ofSql; ofUnknown falls back to SQL. Every other legacy value throws NotSupportedException.
public GOutputFmt outputFmt
Field Value
Remarks
Category: Output rendering. Default: ofSql. Unlike GSP Java, GSP .NET does not currently implement ofhtml.
- See Also
parametersComma
Positions commas for stacked stored-routine parameter declarations. It is effective when parametersStyle is stacked.
public TLinefeedsCommaOption parametersComma
Field Value
Remarks
Category: Routine declarations and EXEC. Default: LfAfterComma.
parametersStyle
Chooses stacked or wrapped layout for stored-routine, package, trigger, and supported CREATE VIEW parameter declarations. Stacked parameters also have their names/types aligned.
public TAlignStyle parametersStyle
Field Value
Remarks
Category: Routine declarations and EXEC. Default: AsStacked.
removeComment
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.
public bool removeComment
Field Value
Remarks
Category: Comments, compact mode, and wrapping. Default: false.
selectColumnlistComma
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.
public TLinefeedsCommaOption selectColumnlistComma
Field Value
Remarks
Category: SELECT list and query clauses. Default: LfAfterComma.
selectColumnlistStyle
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.
public TAlignStyle selectColumnlistStyle
Field Value
Remarks
Category: SELECT list and query clauses. Default: AsStacked.
selectFromclauseComma
Positions commas for stacked comma-separated FROM items. It is effective only when selectFromclauseStyle is stacked.
public TLinefeedsCommaOption selectFromclauseComma
Field Value
Remarks
Category: FROM, JOIN, and WHERE. Default: LfAfterComma.
selectFromclauseJoinOnInNewline
Places the ON condition of a JOIN on a separate line. JOIN keywords are normalized onto their own lines independently of this switch.
public bool selectFromclauseJoinOnInNewline
Field Value
Remarks
Category: FROM, JOIN, and WHERE. Default: true.
selectFromclauseStyle
Chooses stacked or wrapped layout for comma-separated table sources in a FROM clause. JOIN clauses have separate newline and alignment controls.
public TAlignStyle selectFromclauseStyle
Field Value
Remarks
Category: FROM, JOIN, and WHERE. Default: AsStacked.
selectItemInNewLine
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.
public bool selectItemInNewLine
Field Value
Remarks
Category: SELECT list and query clauses. Default: false.
selectKeywordsAlignOption
Left- or right-aligns query clause labels such as SELECT, FROM, WHERE, GROUP BY, HAVING, and ORDER BY within their shared keyword width.
public TAlignOption selectKeywordsAlignOption
Field Value
Remarks
Category: Keyword alignment and capitalization. Default: AloLeft.
sessionId
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.
public readonly string sessionId
Field Value
Remarks
Category: Lifecycle and advanced controls. Default: supplied to the constructor.
tabHtmlString
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.
public string tabHtmlString
Field Value
Remarks
Category: Output rendering. Default: four entities; currently has no effect in GSP .NET.
tabSize
Defines the tab-stop width used by the final tab-alignment pass when useTab is enabled. Use a positive value.
public int tabSize
Field Value
Remarks
Category: Indentation and procedural blocks. Default: 2.
treatDistinctAsVirtualColumn
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.
public bool treatDistinctAsVirtualColumn
Field Value
Remarks
Category: SELECT list and query clauses. Default: false.
useTab
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.
public bool useTab
Field Value
Remarks
Category: Indentation and procedural blocks. Default: false.
wsPaddingOperatorArithmetic
Inserts one space on both sides of recognized binary arithmetic and comparison operators. Unary plus and minus remain adjacent to the operand.
public bool wsPaddingOperatorArithmetic
Field Value
Remarks
Category: Whitespace and parentheses. Default: true.
wsPaddingParenthesesInExpression
Inserts one space inside parentheses that group an expression. Subqueries, function calls, and datatype parameters use separate options.
public bool wsPaddingParenthesesInExpression
Field Value
Remarks
Category: Whitespace and parentheses. Default: true.
wsPaddingParenthesesInFunction
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.
public bool wsPaddingParenthesesInFunction
Field Value
Remarks
Category: Whitespace and parentheses. Default: false.
wsPaddingParenthesesInFunctionCall
Inserts one space inside ordinary function-call parentheses. Routine declaration parentheses use a separate option.
public bool wsPaddingParenthesesInFunctionCall
Field Value
Remarks
Category: Whitespace and parentheses. Default: false.
wsPaddingParenthesesOfSubQuery
Inserts one space inside parentheses that enclose a formatted subquery. Internal line breaks still come from the nested statement formatter.
public bool wsPaddingParenthesesOfSubQuery
Field Value
Remarks
Category: Whitespace and parentheses. Default: false.
wsPaddingParenthesesOfTypename
Inserts one space inside datatype-parameter parentheses, such as
VARCHAR( 20 ), when the parser classifies the node as a type name.
public bool wsPaddingParenthesesOfTypename
Field Value
Remarks
Category: Whitespace and parentheses. Default: false.