Example #1
0
        public void EqualsShouldPass()
        {
            MathReference first  = Db.foo.id % 1;
            MathReference second = Db.foo.id % 1;

            Assert.IsTrue(first.Equals(second));
        }
        private string TryFormatAsMathReference(MathReference mathReference)
        {
            if (ReferenceEquals(mathReference, null)) return null;

            return string.Format("{0} {1} {2}", FormatObject(mathReference.LeftOperand),
                                 MathOperatorToString(mathReference.Operator), FormatObject(mathReference.RightOperand));
        }
Example #3
0
        private string TryFormatAsMathReference(MathReference mathReference)
        {
            if (ReferenceEquals(mathReference, null))
            {
                return(null);
            }

            return(string.Format("{0} {1} {2}", FormatObject(mathReference.LeftOperand),
                                 MathOperatorToString(mathReference.Operator), FormatObject(mathReference.RightOperand)));
        }
        private string TryFormatAsMathReference(MathReference mathReference, bool excludeAlias)
        {
            if (ReferenceEquals(mathReference, null)) return null;

            if (excludeAlias || mathReference.GetAlias() == null)
            {
                return string.Format("{0} {1} {2}", FormatObject(mathReference.LeftOperand),
                                     MathOperatorToString(mathReference.Operator),
                                     FormatObject(mathReference.RightOperand));
            }

            return string.Format("{0} {1} {2} AS {3}", FormatObject(mathReference.LeftOperand),
                                 MathOperatorToString(mathReference.Operator),
                                 FormatObject(mathReference.RightOperand),
                                 mathReference.GetAlias());

        }
Example #5
0
        private string TryFormatAsMathReference(MathReference mathReference, bool excludeAlias)
        {
            if (ReferenceEquals(mathReference, null))
            {
                return(null);
            }

            if (excludeAlias || mathReference.GetAlias() == null)
            {
                return(string.Format("({0} {1} {2})", FormatObject(mathReference.LeftOperand),
                                     MathOperatorToString(mathReference.Operator),
                                     FormatObject(mathReference.RightOperand)));
            }

            return(string.Format("({0} {1} {2}) AS {3}", FormatObject(mathReference.LeftOperand),
                                 MathOperatorToString(mathReference.Operator),
                                 FormatObject(mathReference.RightOperand),
                                 _schema.QuoteObjectName(mathReference.GetAlias())));
        }