Example #1
0
        public static QValueType GetStatementResultType(IExpressionNode left, IExpressionNode right)
        {
            if (left.GetQValueType() == QValueType.Text || right.GetQValueType() == QValueType.Text)
            {
                return(QValueType.Text);
            }

            if (left.GetQValueType() == QValueType.Boolean || right.GetQValueType() == QValueType.Boolean)
            {
                return(QValueType.Boolean);
            }

            if (left.GetQValueType() == QValueType.Money || right.GetQValueType() == QValueType.Money)
            {
                return(QValueType.Money);
            }

            if (left.GetQValueType() == QValueType.Double || right.GetQValueType() == QValueType.Double)
            {
                return(QValueType.Double);
            }

            return(QValueType.Integer);
        }
        /// <summary>
        /// Translate QValueType to StatementType.
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        private StatementType GetStatementType(IExpressionNode node)
        {
            switch (node.GetQValueType())
            {
            case QValueType.BOOLEAN:
                return(StatementType.BOOLEAN);

            case QValueType.TEXT:
                return(StatementType.TEXT);

            case QValueType.MONEY:
            case QValueType.INTEGER:
            case QValueType.DOUBLE:
                return(StatementType.NUMERIC);

            case QValueType.UNKNOWN:
                return(StatementType.UNKNOWN);
            }

            throw new UnknownQValueTypeException("We don't know what to do with this QValueType.");
        }
Example #3
0
        /// <summary>
        /// Translate QValueType to StatementType.
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public static StatementType GetStatementType(IExpressionNode node)
        {
            switch (node.GetQValueType())
            {
            case QValueType.Boolean:
                return(StatementType.Boolean);

            case QValueType.Text:
                return(StatementType.Text);

            case QValueType.Money:
            case QValueType.Integer:
            case QValueType.Double:
            case QValueType.Hex:
                return(StatementType.Numeric);

            case QValueType.Unknown:
                return(StatementType.Unknown);
            }

            throw new UnknownQValueTypeException("We don't know what to do with this QValueType.");
        }