DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
SqlUnaryExpression.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 
21 namespace Deveel.Data.Sql.Expressions {
25  [Serializable]
26  public sealed class SqlUnaryExpression : SqlExpression {
28 
29  internal SqlUnaryExpression(SqlExpressionType expressionType, SqlExpression operand) {
30  this.expressionType = expressionType;
31  Operand = operand;
32  }
33 
35  : base(data) {
36  Operand = data.GetValue<SqlExpression>("Operand");
37  expressionType = (SqlExpressionType) data.GetInt32("Operator");
38  }
39 
43  public SqlExpression Operand { get; private set; }
44 
46  public override SqlExpressionType ExpressionType {
47  get { return expressionType; }
48  }
49 
51  public override bool CanEvaluate {
52  get { return true; }
53  }
54 
55  protected override void GetData(SerializeData data) {
56  data.SetValue("Operand", Operand);
57  data.SetValue("Operator", (int)expressionType);
58  }
59  }
60 }
Handles expressions computed against an unary operator.
void SetValue(string key, Type type, object value)
SqlExpressionType
All the possible type of SqlExpression supported
SqlUnaryExpression(SqlExpressionType expressionType, SqlExpression operand)
override void GetData(SerializeData data)
Defines the base class for instances that represent SQL expression tree nodes.