DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
QueryPlanNodeExtensions.cs
Go to the documentation of this file.
1 //
2 // Copyright 2010-2015 Deveel
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 using System;
18 using System.Collections.Generic;
19 using System.IO;
20 
21 using Deveel.Data.Sql.Objects;
22 
23 namespace Deveel.Data.Sql.Query {
24  static class QueryPlanNodeExtensions {
25  public static IList<ObjectName> DiscoverTableNames(this IQueryPlanNode node) {
26  var visitor = new QueryNodeTableNameVisitor();
27  return visitor.Discover(node);
28  }
29 
30  public static IList<QueryReference> DiscoverQueryReferences(this IQueryPlanNode node, int level) {
31  return DiscoverQueryReferences(node, level, new List<QueryReference>());
32  }
33 
34  public static IList<QueryReference> DiscoverQueryReferences(this IQueryPlanNode node, int level, IList<QueryReference> references) {
35  // TODO:
36  return references;
37  }
38 
39  public static SqlBinary AsBinary(this IQueryPlanNode planNode, ISystemContext context) {
40  using (var memoryStream = new MemoryStream()) {
41  context.SerializeQueryPlan(planNode, memoryStream);
42  memoryStream.Flush();
43  return new SqlBinary(memoryStream.ToArray());
44  }
45  }
46  }
47 }
The execution context of a database system, that is defining the configurations and the components us...
A query to the database to select data from a set of tables and columns.
static IList< QueryReference > DiscoverQueryReferences(this IQueryPlanNode node, int level)
Implements a BINARY object that handles a limited number of bytes, not exceding MaxLength.
Definition: SqlBinary.cs:27
static IList< QueryReference > DiscoverQueryReferences(this IQueryPlanNode node, int level, IList< QueryReference > references)
static SqlBinary AsBinary(this IQueryPlanNode planNode, ISystemContext context)
A node element of a query plan tree. /summary>
static IList< ObjectName > DiscoverTableNames(this IQueryPlanNode node)