DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Properties | List of all members
Deveel.Data.Sql.Variables.Variable Class Reference
Inheritance diagram for Deveel.Data.Sql.Variables.Variable:
Deveel.Data.Sql.IDbObject

Public Member Functions

 Variable (VariableInfo variableInfo)
 
bool Equals (Variable other)
 
void SetValue (IQuery context, SqlExpression expression)
 
void SetValue (DataObject value)
 

Properties

VariableInfo VariableInfo [get, private set]
 
string Name [get]
 
SqlType Type [get]
 
SqlExpression Expression [get, private set]
 
bool ValueFromExpression [get]
 
DataObject Value [get, private set]
 
bool IsConstant [get]
 
bool IsNotNull [get]
 
ObjectName IDbObject. FullName [get]
 
DbObjectType IDbObject. ObjectType [get]
 
- Properties inherited from Deveel.Data.Sql.IDbObject
ObjectName FullName [get]
 Gets the fully qualified name of the object used to resolve it uniquely within the database. More...
 
DbObjectType ObjectType [get]
 Gets the type of database object that the implementation is for More...
 

Detailed Description

Definition at line 24 of file Variable.cs.

Constructor & Destructor Documentation

Deveel.Data.Sql.Variables.Variable.Variable ( VariableInfo  variableInfo)
inline

Definition at line 25 of file Variable.cs.

25  {
26  if (variableInfo == null)
27  throw new ArgumentNullException("variableInfo");
28 
29  VariableInfo = variableInfo;
30  }

Member Function Documentation

bool Deveel.Data.Sql.Variables.Variable.Equals ( Variable  other)
inline

Definition at line 66 of file Variable.cs.

66  {
67  if (other == null)
68  return false;
69 
70  if (!Name.Equals(other.Name) ||
71  !Type.Equals(other.Type))
72  return false;
73 
74  if (ValueFromExpression &&
75  other.ValueFromExpression) {
76  // TODO: Determine if the two expressions are equal!
77  return true;
78  }
79 
80  return Value.Equals(other.Value);
81  }
override bool Equals(object obj)
Definition: DataObject.cs:179
override bool Equals(object obj)
Definition: SqlType.cs:373
void Deveel.Data.Sql.Variables.Variable.SetValue ( IQuery  context,
SqlExpression  expression 
)
inline

Definition at line 83 of file Variable.cs.

83  {
84  if (expression == null)
85  throw new ArgumentNullException("expression");
86 
87  if (IsConstant)
88  throw new InvalidOperationException();
89 
90  if (!expression.IsConstant())
91  throw new ArgumentException();
92 
93  Expression = expression;
94 
95  var exp = expression.Evaluate(context, null);
96  if (exp.ExpressionType != SqlExpressionType.Constant)
97  throw new InvalidOperationException();
98 
99  var value = ((SqlConstantExpression) exp).Value;
100  SetValue(value);
101  }
SqlExpressionType
All the possible type of SqlExpression supported
virtual SqlExpression Evaluate(EvaluateContext context)
When overridden by a derived class, this method evaluates the expression within the provided context...
An expression that holds a constant value.
void SetValue(IQuery context, SqlExpression expression)
Definition: Variable.cs:83
void Deveel.Data.Sql.Variables.Variable.SetValue ( DataObject  value)
inline

Definition at line 103 of file Variable.cs.

103  {
104  if (IsConstant)
105  throw new InvalidOperationException();
106 
107  if (!IsNotNull && value.IsNull)
108  throw new ArgumentException();
109 
110  if (!Type.Equals(value.Type)) {
111  if (!value.Type.CanCastTo(Type))
112  throw new ArgumentException();
113 
114  value = value.CastTo(Type);
115  }
116 
117  Value = value;
118  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
DataObject CastTo(SqlType destType)
Converts this object to the given SqlType.
Definition: DataObject.cs:488
virtual bool CanCastTo(SqlType destType)
Verifies if this type can cast any value to the given SqlType.
Definition: SqlType.cs:153
override bool Equals(object obj)
Definition: SqlType.cs:373

Property Documentation

SqlExpression Deveel.Data.Sql.Variables.Variable.Expression
getprivate set

Definition at line 42 of file Variable.cs.

ObjectName IDbObject. Deveel.Data.Sql.Variables.Variable.FullName
getprivate

Definition at line 58 of file Variable.cs.

bool Deveel.Data.Sql.Variables.Variable.IsConstant
get

Definition at line 50 of file Variable.cs.

bool Deveel.Data.Sql.Variables.Variable.IsNotNull
get

Definition at line 54 of file Variable.cs.

string Deveel.Data.Sql.Variables.Variable.Name
get

Definition at line 34 of file Variable.cs.

DbObjectType IDbObject. Deveel.Data.Sql.Variables.Variable.ObjectType
getprivate

Definition at line 62 of file Variable.cs.

SqlType Deveel.Data.Sql.Variables.Variable.Type
get

Definition at line 38 of file Variable.cs.

DataObject Deveel.Data.Sql.Variables.Variable.Value
getprivate set

Definition at line 48 of file Variable.cs.

bool Deveel.Data.Sql.Variables.Variable.ValueFromExpression
get

Definition at line 44 of file Variable.cs.

VariableInfo Deveel.Data.Sql.Variables.Variable.VariableInfo
getprivate set

Definition at line 32 of file Variable.cs.


The documentation for this class was generated from the following file: