public static Stmts CreateStmts(string sqls , DBMSType dbmsType = DBMSType.Unknown , bool forSqlAccessor = false) { var parser = MiniSqlParserAST.CreateParser(sqls, dbmsType, forSqlAccessor); var astListener = (MakeASTListener)parser.ParseListeners[0]; var errorListener = (CumulativeErrorListener)parser.ErrorListeners[0]; // SQL文を解析する var context = parser.stmts_root(); if (errorListener.HasSyntaxError) { throw errorListener.ThrowException(); } else if (astListener.HasSqlAccessorSyntaxError) { throw astListener.ThrowSqlAccessorException(); } return((Stmts)astListener.GetAST()); }
public static Node CreatePlaceHolderNode(string placeHolderValue , DBMSType dbmsType = DBMSType.Unknown , bool forSqlAccessor = false) { var parser = MiniSqlParserAST.CreateParser(placeHolderValue, dbmsType, forSqlAccessor); var astListener = (MakeASTListener)parser.ParseListeners[0]; var errorListener = (CumulativeErrorListener)parser.ErrorListeners[0]; // SQL文を解析する var context = parser.placeholder_root(); if (errorListener.HasSyntaxError) { throw errorListener.ThrowException(); } else if (astListener.HasSqlAccessorSyntaxError) { throw astListener.ThrowSqlAccessorException(); } return((Node)astListener.GetAST()); }