Ejemplo n.º 1
0
 public void VisitStringConstant(OStringConstant oStringConstant)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// constant :
        ///     TIMESTAMP(string | bind_variable) (AT TIME ZONE string)?
        ///     | INTERVAL(string | bind_variable | general_element_part) (YEAR | MONTH | DAY | HOUR | MINUTE | SECOND)
        ///       (LEFT_PAREN (UNSIGNED_INTEGER | bind_variable) (COMMA (UNSIGNED_INTEGER | bind_variable) )? RIGHT_PAREN )?
        ///       (TO (DAY | HOUR | MINUTE | SECOND(LEFT_PAREN (UNSIGNED_INTEGER | bind_variable) RIGHT_PAREN )?))?
        ///     | numeric
        ///     | DATE string
        ///     | string
        ///     | NULL
        ///     | TRUE
        ///     | FALSE
        ///     | DBTIMEZONE
        ///     | SESSIONTIMEZONE
        ///     | MINVALUE
        ///     | MAXVALUE
        ///     | DEFAULT
        ///     ;
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override object VisitConstant([NotNull] PlSqlParser.ConstantContext context)
        {
            OConstant _result = null;

            if (context.TIMESTAMP() != null)
            {
                Stop();
                // TIMESTAMP (string | bind_variable) (AT TIME ZONE string)?
            }
            else if (context.INTERVAL() != null)
            {
                Stop();

                /*INTERVAL (string | bind_variable | general_element_part) (YEAR | MONTH | DAY | HOUR | MINUTE | SECOND)
                 *  ( LEFT_PAREN (UNSIGNED_INTEGER | bind_variable) (COMMA (UNSIGNED_INTEGER | bind_variable) )? RIGHT_PAREN )?
                 *  (TO ( DAY | HOUR | MINUTE | SECOND ( LEFT_PAREN (UNSIGNED_INTEGER | bind_variable) RIGHT_PAREN )?))?*/
            }
            else if (context.DEFAULT() != null)
            {
                Stop();
            }
            else if (context.MAXVALUE() != null)
            {
                Stop();
            }
            else if (context.MINVALUE() != null)
            {
                Stop();
            }
            else if (context.SESSIONTIMEZONE() != null)
            {
                Stop();
            }
            else if (context.DBTIMEZONE() != null)
            {
                Stop();
            }
            else if (context.NULL() != null)
            {
                Stop();
            }
            else if (context.DATE() != null)
            {
                Stop();
            }
            else if (context.FALSE() != null)
            {
                _result = new OBoolConstant()
                {
                    Value = false
                }
            }
            ;

            else if (context.TRUE() != null)
            {
                _result = new OBoolConstant()
                {
                    Value = true
                }
            }
            ;

            else
            {
                var _numeric = context.numeric();
                if (_numeric != null)
                {
                    if (_numeric.APPROXIMATE_NUM_LIT() != null)
                    {
                        Stop();
                    }
                    else
                    {
                        var i = _numeric.ToInteger();
                        _result = new OIntegerConstant()
                        {
                            Value = i
                        };
                    }
                }
                else
                {
                    var _string = context.@string();
                    if (_string != null)
                    {
                        StringBuilder sb = new StringBuilder();
                        foreach (var item in _string)
                        {
                            sb.Append(item.GetText());
                        }
                        _result = new OStringConstant()
                        {
                            Value = sb.ToString().Trim('\'')
                        };
                    }
                }
            }

            Debug.Assert(_result != null);

            return(_result);
        }
Ejemplo n.º 3
0
 public void VisitStringConstant(OStringConstant oStringConstant)
 {
 }