DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
QueryContextExtensions.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 
20 using Deveel.Data.Types;
21 
22 namespace Deveel.Data.Sql.Variables {
23  public static class QueryContextExtensions {
24  //public static void DeclareConstantVariable(this IQueryContext context, string name, SqlType type, SqlExpression defaultExpression) {
25  // if (defaultExpression == null)
26  // throw new ArgumentNullException("defaultExpression");
27  // if (type == null)
28  // throw new ArgumentNullException("type");
29 
30  // // TODO: Create a variable resolver for the query context scope
31  // var expType = defaultExpression.ReturnType(context, null);
32  // if (!type.IsComparable(expType))
33  // throw new ArgumentException();
34 
35  // var info = new VariableInfo(name, type, true);
36  // info.DefaultExpression = defaultExpression;
37  // info.IsNotNull = true;
38 
39  // context.DeclareVariable(info);
40  //}
41 
42  //public static Variable FindVariable(this IQueryContext context, string name) {
43  // var variable = context.VariableManager.GetVariable(name);
44  // if (variable == null &&
45  // context.ParentContext != null)
46  // variable = context.ParentContext.FindVariable(name);
47 
48  // return variable;
49  //}
50 
51  //public static void SetVariable(this IQueryContext context, string name, SqlExpression expression) {
52  // var variable = context.FindVariable(name);
53  // if (variable == null && expression != null) {
54  // // TODO: Create a variable resolver for the query context scope
55  // var varType = expression.ReturnType(context, null);
56  // variable = context.DeclareVariable(name, varType);
57  // }
58 
59  // if (variable == null)
60  // throw new ObjectNotFoundException(new ObjectName(name));
61 
62  // variable.SetValue(context, expression);
63  //}
64  }
65 }