Пример #1
0
        static FunctionCall MakeConvert(LiteralDateTime literalDateTime)
        {
            if (literalDateTime == null)
            {
                throw new ArgumentNullException("literalDateTime");
            }

            DateTime dateTime = literalDateTime.DateTime;
            string   literal  = dateTime.ToString("yyyy-MM-dd HH:mm:ss");

            FunctionCall functionCall = new FunctionCall(
                TailorUtil.CONVERT.ToUpperInvariant());

            // Well, technically it's a type name, not a database ID, but
            // this is what the parser builds from "CONVERT(datetime)"
            // and it should serve just as well...
            functionCall.ExpressionArguments = new ExpressionItem(
                new DbObject(new Identifier("datetime")));

            functionCall.ExpressionArguments.Add(
                TailorUtil.MakeLiteralString(literal));
            functionCall.ExpressionArguments.Add(
                TailorUtil.MakeLiteralInteger(120));

            return(functionCall);
        }
Пример #2
0
        public override void Perform(LiteralDateTime node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            m_sql.Append(node.Literal);
        }
Пример #3
0
        public override void Perform(LiteralDateTime node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            base.Perform(node);

            node.Delimiter = '\'';
        }
Пример #4
0
        public override void Perform(LiteralDateTime node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            base.Perform(node);

            ReplaceTerm(node, MakeConvert(node));
        }
Пример #5
0
        public override void Perform(Variable node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            base.Perform(node);

            string key = Variable.Canonicalize(node.PrefixedName);

            Debug.Assert(key != null);
            if (m_dates.ContainsKey(key))
            {
                LiteralDateTime literalDateTime = new LiteralDateTime(m_dates[key]);
                literalDateTime.Delimiter = '#';
                ReplaceTerm(node, literalDateTime);
            }
        }
Пример #6
0
 public virtual void Perform(LiteralDateTime node)
 {
 }