VariableReference() public static method

public static VariableReference ( string varName ) : SqlVariableReferenceExpression
varName string
return SqlVariableReferenceExpression
        public void StringFormat()
        {
            var assign = SqlExpression.Assign(SqlExpression.VariableReference("t"), SqlExpression.Constant("test"));

            var expected = ":t := 'test'";

            Assert.AreEqual(expected, assign.ToString());
        }
Ejemplo n.º 2
0
        public static void FormatToString()
        {
            var trueExp   = SqlExpression.FunctionCall("testResult");
            var falseExp  = SqlExpression.Constant(false);
            var testExp   = SqlExpression.Equal(SqlExpression.VariableReference("a"), SqlExpression.Constant(22));
            var condition = SqlExpression.Conditional(testExp, trueExp, falseExp);

            var expected = "CASE WHEN :a = 22 THEN testResult() ELSE FALSE";

            Assert.AreEqual(expected, condition.ToString());
        }
        public void SimpleAssign()
        {
            var assign = SqlExpression.Assign(SqlExpression.VariableReference("t"), SqlExpression.Constant("test"));
            var result = assign.EvaluateToConstant(null, variableResolver);

            Assert.IsFalse(Field.IsNullField(result));
            Assert.IsInstanceOf <StringType>(result.Type);

            var value = ((SqlString)result.Value).ToString();

            Assert.AreEqual("test", value);
        }
Ejemplo n.º 4
0
 public virtual SqlExpression VisitVariableReference(SqlVariableReferenceExpression reference)
 {
     return(SqlExpression.VariableReference(reference.VariableName));
 }
Ejemplo n.º 5
0
            public override SqlVariableReferenceExpression Deserialize(BinaryReader reader)
            {
                var varName = reader.ReadString();

                return(SqlExpression.VariableReference(varName));
            }