DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
SetDefaultAction.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 
21 
22 namespace Deveel.Data.Sql.Statements {
23  [Serializable]
25  public SetDefaultAction(string columnName, SqlExpression defaultExpression) {
26  ColumnName = columnName;
27  DefaultExpression = defaultExpression;
28  }
29 
30  private SetDefaultAction(ObjectData data) {
31  ColumnName = data.GetString("ColumnName");
32  DefaultExpression = data.GetValue<SqlExpression>("Default");
33  }
34 
35  public string ColumnName { get; private set; }
36 
37  public SqlExpression DefaultExpression { get; private set; }
38 
40  get { return AlterTableActionType.SetDefault; }
41  }
42 
44  var defaultExp = DefaultExpression;
45  if (defaultExp != null)
46  defaultExp = defaultExp.Prepare(preparer);
47 
48  return new SetDefaultAction(ColumnName, defaultExp);
49  }
50 
52  data.SetValue("ColumnName", ColumnName);
53  data.SetValue("Default", DefaultExpression);
54  }
55  }
56 }
void GetData(SerializeData data)
SetDefaultAction(string columnName, SqlExpression defaultExpression)
void SetValue(string key, Type type, object value)
An interface used to prepare a SqlExpression object.
AlterTableActionType
The possible types of actions in a AlterTableAction expression.
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.
A contract for objects that participate to a SqlExpression.Prepare phase of an expression evaluation...
Definition: IPreparable.cs:30