コード例 #1
0
ファイル: SqlValidator.cs プロジェクト: skyquery/graywulf
        public virtual void Execute(SelectStatement selectStatement)
        {
            // Validate top level query specifications
            foreach (QuerySpecification qs in selectStatement.EnumerateQuerySpecifications())
            {
                ValidateQuerySpecification(qs);
            }

            // Validate Order By
            OrderByClause orderby = selectStatement.FindDescendant<OrderByClause>();

            if (orderby != null)
            {
                // **** TODO
            }
        }
コード例 #2
0
 public void Execute(SelectStatement selectStatement)
 {
     NormalizeSelectStatement(selectStatement);
 }
コード例 #3
0
 public void NormalizeSelectStatement(SelectStatement selectStatement)
 {
     NormalizeQueryExpression(selectStatement.QueryExpression);
 }
コード例 #4
0
        protected void ResolveSelectStatement(SelectStatement selectStatement, int depth)
        {
            // The SqlParser build the parsing tree and tags many nodes with TableReference and ColumnReference objects.
            // At this point these references only contain information directly available in the query, but names are
            // not verified against the database schema.

            // A query consists of a set of query specifications combined using set operators (UNION, EXCEPT etc.)
            // Each query specification has a FROM clause with a complex table expression. A table expression is a
            // set of table sources combined with join operators. A table source can be any of the following four:
            // a table (or view), a table-valued function, a table-valued variable or a subquery.
            // The WHERE clause main contain additional semi-join criteria which contain subqueries.

            // Steps of name resolution:

            // 1. Identify all query specifications and execute name resolution on each of them
            // 2. For each query specification, substitute default values if null is found
            // 3. Collect column descriptions from table sources
            // 4. Resolve column aliases
            // 5. Resolve table aliases
            // 6. Assign default column aliases

            SubstituteFunctionDefaults(selectStatement);
            ResolveFunctionReferences(selectStatement);

            var qe = selectStatement.QueryExpression;

            ResolveQueryExpression(qe, depth);

            var firstqs = qe.FindDescendant<QuerySpecification>();
            var orderby = selectStatement.OrderByClause;

            ResolveOrderByClause(orderby, firstqs);
        }
コード例 #5
0
 /// <summary>
 /// Executes the name resolution over a query
 /// </summary>
 /// <param name="selectStatement"></param>
 public void Execute(SelectStatement selectStatement)
 {
     ResolveSelectStatement(selectStatement, 0);
 }
コード例 #6
0
ファイル: PredicateTest.cs プロジェクト: skyquery/graywulf
 private void GetSearchCondition(string query, out SelectStatement select, out SearchCondition where)
 {
     var p = new SqlParser();
     select = (SelectStatement)p.Execute(new SelectStatement(), query);
     where = select.FindDescendantRecursive<WhereClause>().FindDescendant<SearchCondition>();
 }
コード例 #7
0
ファイル: SelectStatement.cs プロジェクト: skyquery/graywulf
 private void CopyMembers(SelectStatement old)
 {
 }
コード例 #8
0
ファイル: SelectStatement.cs プロジェクト: skyquery/graywulf
 public SelectStatement(SelectStatement old)
     : base(old)
 {
     CopyMembers(old);
 }
コード例 #9
0
ファイル: QueryObject.cs プロジェクト: horvatferi/graywulf
        private void InitializeMembers(StreamingContext context)
        {
            this.syncRoot = new object();

            this.context = null;
            this.scheduler = null;

            this.queryFactoryTypeName = null;
            this.queryFactory = new Lazy<QueryFactory>(() => (QueryFactory)Activator.CreateInstance(Type.GetType(queryFactoryTypeName)), false);

            this.federationReference = new EntityProperty<Federation>();

            this.queryString = null;

            this.defaultDataset = null;
            this.temporaryDataset = null;
            this.codeDataset = null;
            this.customDatasets = new List<DatasetBase>();

            /*this.databaseVersionName = null;
            this.defaultDatasetName = null;
            this.defaultSchemaName = null;*/

            this.executionMode = ExecutionMode.SingleServer;

            this.isCanceled = false;
            this.cancelableTasks = new Dictionary<string, ICancelableTask>();

            this.assignedServerInstanceReference = new EntityProperty<ServerInstance>();
            this.interpretedQueryString = null;
            this.selectStatement = null;

            this.temporaryDatabaseInstanceReference = new EntityProperty<DatabaseInstance>();

            this.temporaryTables = new ConcurrentDictionary<string, Table>(SchemaManager.Comparer);
            this.temporaryViews = new ConcurrentDictionary<string, View>(SchemaManager.Comparer);

            this.codeDatabaseInstanceReference = new EntityProperty<DatabaseInstance>();
        }
コード例 #10
0
ファイル: QueryObject.cs プロジェクト: horvatferi/graywulf
 /// <summary>
 /// Parses the query
 /// </summary>
 protected void Parse(bool forceReinitialize)
 {
     // Reparse only if needed
     if (selectStatement == null || forceReinitialize)
     {
         var parser = queryFactory.Value.CreateParser();
         selectStatement = (SelectStatement)parser.Execute(queryString);
     }
 }