예제 #1
0
        protected override DataObject EvaluateBinary(DataObject ob1, DataObject ob2, IEvaluateContext context)
        {
            if (ob1.IsNull)
            {
                return(ob1);
            }
            if (ob2.IsNull)
            {
                return(ob2);
            }

            char cEscape = '\\';

            if (Escape is ConstantExpression)
            {
                // TODO: some more checks...
                var escapeValue = ((ConstantExpression)Escape).Value;
                cEscape = escapeValue.ToString()[0];
            }

            string val     = ob1.CastTo(PrimitiveTypes.String()).ToStringValue();
            string pattern = ob2.CastTo(PrimitiveTypes.String()).ToStringValue();

            return(DataObject.Boolean(PatternSearch.FullPatternMatch(pattern, val, cEscape)));
        }
예제 #2
0
        protected override DataObject EvaluateBinary(DataObject ob1, DataObject ob2, IEvaluateContext context)
        {
            if (ob1.IsNull)
                return ob1;
            if (ob2.IsNull)
                return ob2;

            char cEscape = '\\';
            if (Escape is ConstantExpression) {
                // TODO: some more checks...
                var escapeValue = ((ConstantExpression) Escape).Value;
                cEscape = escapeValue.ToString()[0];
            }

            string val = ob1.CastTo(PrimitiveTypes.String()).ToStringValue();
            string pattern = ob2.CastTo(PrimitiveTypes.String()).ToStringValue();

            return DataObject.Boolean(PatternSearch.FullPatternMatch(pattern, val, cEscape));
        }
예제 #3
0
        public void SetValue(DataObject value)
        {
            if (IsConstant)
            {
                throw new InvalidOperationException();
            }

            if (!IsNotNull && value.IsNull)
            {
                throw new ArgumentException();
            }

            if (!Type.Equals(value.Type))
            {
                if (!value.Type.CanCastTo(Type))
                {
                    throw new ArgumentException();
                }

                value = value.CastTo(Type);
            }

            Value = value;
        }
예제 #4
0
 public static DataObject Cast(DataObject value, DataType destType)
 {
     return value.CastTo(destType);
 }
예제 #5
0
 public static DataObject ToTimeStamp(DataObject obj)
 {
     return obj.CastTo(PrimitiveTypes.TimeStamp());
 }
예제 #6
0
 public static DataObject ToString(DataObject value)
 {
     return value.CastTo(PrimitiveTypes.String());
 }
예제 #7
0
 public static DataObject ToNumber(DataObject value)
 {
     return value.CastTo(PrimitiveTypes.Numeric());
 }
예제 #8
0
 public static DataObject ToBinary(DataObject value)
 {
     return(value.CastTo(PrimitiveTypes.Binary()));
 }
예제 #9
0
 public static DataObject ToNumber(DataObject value)
 {
     return(value.CastTo(PrimitiveTypes.Numeric()));
 }
예제 #10
0
 public static DataObject Cast(DataObject value, SqlType destType)
 {
     return(value.CastTo(destType));
 }
예제 #11
0
 public static DataObject ToTimeStamp(DataObject obj)
 {
     return(obj.CastTo(PrimitiveTypes.TimeStamp()));
 }
예제 #12
0
 public static DataObject ToDateTime(DataObject obj)
 {
     return(obj.CastTo(PrimitiveTypes.DateTime()));
 }
예제 #13
0
            public override DataObject Evaluate(DataObject ob1, DataObject ob2,
											 IGroupResolver group, IVariableResolver resolver,
											 IQueryContext context)
            {
                if (ob1.IsNull)
                    return ob1;
                if (ob2.IsNull)
                    return ob2;

                string val = ob1.CastTo(PrimitiveTypes.String()).ToStringValue();
                string pattern = ob2.CastTo(PrimitiveTypes.String()).ToStringValue();
                // TODO: return DataObject.Boolean(PatternSearch.RegexMatch(context.Context, pattern, val));
                throw new NotImplementedException();
            }
예제 #14
0
            public override DataObject Evaluate(DataObject ob1, DataObject ob2,
											 IGroupResolver group, IVariableResolver resolver,
											 IQueryContext context)
            {
                if (ob1.IsNull) {
                    return ob1;
                }
                if (ob2.IsNull) {
                    return ob2;
                }
                String val = ob1.CastTo(PrimitiveTypes.String()).ToStringValue();
                String pattern = ob2.CastTo(PrimitiveTypes.String()).ToStringValue();

                return DataObject.Boolean(PatternSearch.FullPatternMatch(pattern, val, '\\'));
            }
예제 #15
0
 public static DataObject ToBinary(DataObject value)
 {
     return value.CastTo(PrimitiveTypes.Binary());
 }
예제 #16
0
 public static DataObject ToDateTime(DataObject obj)
 {
     return obj.CastTo(PrimitiveTypes.DateTime());
 }
예제 #17
0
 public static DataObject ToString(DataObject value)
 {
     return(value.CastTo(PrimitiveTypes.String()));
 }