DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
LoopControlStatement.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.IO;
19 
22 
23 namespace Deveel.Data.Sql.Statements {
24  [Serializable]
27  : this(controlType, (SqlExpression) null) {
28  }
29 
30  public LoopControlStatement(LoopControlType controlType, SqlExpression whenExpression)
31  : this(controlType, null, whenExpression) {
32  }
33 
34  public LoopControlStatement(LoopControlType controlType, string label)
35  : this(controlType, label, null) {
36  }
37 
38  public LoopControlStatement(LoopControlType controlType, string label, SqlExpression whenExpression) {
39  Label = label;
40  WhenExpression = whenExpression;
41  ControlType = controlType;
42  }
43 
45  Label = data.GetString("ControlType");
46  ControlType = (LoopControlType) data.GetInt32("ControlType");
47  WhenExpression = data.GetValue<SqlExpression>("WhenExpression");
48  }
49 
50  public LoopControlType ControlType { get; private set; }
51 
52  public string Label { get; set; }
53 
54  public SqlExpression WhenExpression { get; set; }
55 
57  var label = Label;
58  var whenExp = WhenExpression;
59  if (whenExp != null)
60  whenExp = whenExp.Prepare(preparer);
61 
62  return new LoopControlStatement(ControlType, label, whenExp);
63  }
64 
65  protected override void ExecuteStatement(ExecutionContext context) {
66  throw new NotImplementedException();
67  }
68 
69  protected override void GetData(SerializeData data) {
70  data.SetValue("Label", Label);
71  data.SetValue("WhenExpression", WhenExpression);
72  data.SetValue("ControlType", (int)ControlType);
73  }
74  }
75 }
void SetValue(string key, Type type, object value)
Represents the foundation class of SQL statements to be executed.
Definition: SqlStatement.cs:32
LoopControlStatement(LoopControlType controlType, string label)
An interface used to prepare a SqlExpression object.
LoopControlStatement(LoopControlType controlType, SqlExpression whenExpression)
object Prepare(IExpressionPreparer preparer)
Converts the underlying value of this instance into an object that can be evaluated by an expression...
Defines the base class for instances that represent SQL expression tree nodes.
override void ExecuteStatement(ExecutionContext context)
A contract for objects that participate to a SqlExpression.Prepare phase of an expression evaluation...
Definition: IPreparable.cs:30
LoopControlStatement(LoopControlType controlType, string label, SqlExpression whenExpression)