public class FormatterFactory extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
FormatterFactory.IFormatterBuilderCreator<E extends AbstractStmtFormatter>
the callback interface to achieve the formatter builder
|
| Constructor and Description |
|---|
FormatterFactory() |
public FormatterFactory()
public static SelectStmtFormatter createSelectStmtFormatter(GFmtOpt opt)
opt - optionspublic static InsertStmtFormatter createInsertStmtFormatter(GFmtOpt opt)
public static DeleteStmtFormatter createDeleteStmtFormatter(GFmtOpt opt)
public static UpdateStmtFormatter createUpdateStmtFormatter(GFmtOpt opt)
public static CreateTableStmtFormatter createCreateTableStmtFormatter(GFmtOpt opt)
public static DeclareStmtFormatter createDeclareStmtFormatter(GFmtOpt opt)
public static ExecuteStmtFormatter createExecuteStmtFormatter(GFmtOpt opt)
public static SetStmtFormatter createSetStmtFormatter(GFmtOpt opt)
public static IfStmtFormatter createIfStmtFormatter(GFmtOpt opt)
public static PlsqlIfStmtFormatter createPlsqlIfStmtFormatter(GFmtOpt opt)
public static PlsqlStmtFormatter createPlsqlStmtFormatter(GFmtOpt opt)
public static GoStmtFormatter createGoStmtFormatter(GFmtOpt opt)
public static CompactModeStmtFormatter createCompactModeStmtFormatter(GFmtOpt opt)
public static ReturnStmtFormatter createReturnStmtFormatter(GFmtOpt opt)
public static CreateViewStmtFormatter createCreateViewStmtFormatter(GFmtOpt opt)
public static AlterTableStmtFormatter createAlterTableStatement(GFmtOpt opt)
public static <E extends AbstractStmtFormatter> E createFormatter(GFmtOpt opt, Class<E> clazz, FormatterFactory.IFormatterBuilderCreator<E> creater)
E - opt - clazz - creater - public static void processStatement(GFmtOpt option, TCustomSqlStatement sql)
public static boolean isNotNeedFormat(TCustomSqlStatement sql)
public static boolean isNotNeedFormat(TSourceToken t)
public static void processBlockStmt(GFmtOpt opt, TMssqlBlock stmt, TSourceToken ifToken)
public static String pp(TGSqlParser parser, GFmtOpt option)
public static Pp2FormatResult pp2(TGSqlParser parser, Pp2FormatOptions opts)
pp(TGSqlParser, GFmtOpt),
this does not require parser.parse() to have returned 0: it
re-tokenizes parser.sqltext internally, splits the script into
statement regions, formats each region independently, and recovers
gracefully from malformed input. It never throws for non-null inputs and
preserves every solid input token.
This is the single additive pp2 bridge (plan §4.1/S17). It does not
change the behavior of pp(TGSqlParser, GFmtOpt) or any other
existing method. The heavy lifting lives in
gudusoft.gsqlparser.pp2.engine.Pp2Engine.
parser - carries the SQL text (parser.sqltext) and dialect
(parser.getDbVendor()); need not be parsed firstopts - pp2 formatting options; must not be nullPp2FormatResult with per-region renderer
choice, status, and diagnostics; never nullNullPointerException - if parser or opts is nullpublic static String pp2(TGSqlParser parser, GFmtOpt opt)
pp(TGSqlParser, GFmtOpt)
signature: returns the formatted text directly. The caller's
GFmtOpt is copied into a Pp2FormatOptions via
Pp2FormatOptions.from(GFmtOpt) so casing/comma/indent options
carry over (giving byte-parity with pp() on parseable input).parser - carries the SQL text and dialect; need not be parsed firstopt - existing formatter options; must not be nullNullPointerException - if parser or opt is nullpublic static OutputConfig getOutputConfig()
public static void setOutputConfig(OutputConfig outputConfig)
public static AllStmtsFormatter createAllStmtsFormatter(GFmtOpt option)
public static void clearAllObject(String sessionId)