コード例 #1
0
 private static System.Data.Entity.Core.Common.EntitySql.AST.Node Parse(
     string commandText,
     ParserOptions parserOptions)
 {
     Check.NotEmpty(commandText, nameof(commandText));
     System.Data.Entity.Core.Common.EntitySql.AST.Node node = new CqlParser(parserOptions, true).Parse(commandText);
     if (node == null)
     {
         throw EntitySqlException.Create(commandText, Strings.InvalidEmptyQuery, 0, (string)null, false, (Exception)null);
     }
     return(node);
 }
コード例 #2
0
ファイル: CqlQuery.cs プロジェクト: rvegajr/entityframework
        // <summary>
        // Parse eSQL command string into an AST
        // </summary>
        // <param name="commandText"> eSQL command </param>
        // <param name="parserOptions">
        // parser options <seealso cref="ParserOptions" />
        // </param>
        // <returns> Ast </returns>
        // <exception cref="System.Data.Entity.Core.EntityException">Thrown when Syntatic or Semantic rules are violated and the query cannot be accepted</exception>
        // <remarks>
        // This method is not thread safe.
        // </remarks>
        // <seealso cref="ParserOptions" />
        private static Node Parse(string commandText, ParserOptions parserOptions)
        {
            // The common practice is to make the null check at the public surface,
            // however this method is a convergence zone from multiple public entry points and it makes sense to
            // check for null once, here.
            Check.NotEmpty(commandText, "commandText");

            //
            // Create Parser
            //
            var cqlParser = new CqlParser(parserOptions, true);

            //
            // Invoke parser
            //
            var astExpr = cqlParser.Parse(commandText);

            if (null == astExpr)
            {
                throw EntitySqlException.Create(commandText, Strings.InvalidEmptyQuery, 0, null, false, null);
            }

            return(astExpr);
        }