예제 #1
0
        /// <summary>
        /// 填充值的括号
        /// </summary>
        /// <param name="left">连接符左边</param>
        /// <param name="isLeft">是否在运算符左边</param>
        /// <param name="operLevel">当前符号优先级</param>
        /// <param name="info">输出信息</param>
        /// <returns></returns>
        public static string FillBreak(BQLValueItem value, bool isLeft, int operLevel, KeyWordInfomation info)
        {
            IOperatorPriorityLevel pl = value as IOperatorPriorityLevel;

            if (pl == null)
            {
                return(value.DisplayValue(info));
            }

            if ((!info.DBInfo.OperatorPrecedence) || (isLeft && pl.PriorityLevel < operLevel) ||
                ((!isLeft) && pl.PriorityLevel <= operLevel)
                )
            {
                return("(" + value.DisplayValue(info) + ")");
            }
            return(value.DisplayValue(info));
        }
예제 #2
0
        /// <summary>
        /// 进行除法运算
        /// </summary>
        /// <param name="handle"></param>
        /// <returns></returns>
        internal static string DoMod(BQLOperatorHandle handle, KeyWordInfomation info)
        {
            BQLValueItem[] parameters = handle.GetParameters();
            BQLValueItem   item1      = parameters[0];
            BQLValueItem   item2      = parameters[1];
            string         value1     = item1.DisplayValue(info);
            string         value2     = item2.DisplayValue(info);

            return(info.DBInfo.Math.DoMod(new string[] { value1, value2 }));
        }
예제 #3
0
        internal override string DisplayValue(KeyWordInfomation info)
        {
            KeyWordConver objCover = new KeyWordConver();

            StringBuilder sb = new StringBuilder();

            sb.Append("(");
            sb.Append(caseItem.DisplayValue(info));
            sb.Append(" end) ");
            return(sb.ToString());
        }
예제 #4
0
        /// <summary>
        /// 不等于
        /// </summary>
        /// <param name="handle"></param>
        /// <returns></returns>
        internal static string DoNotequal(BQLComparItem handle, KeyWordInfomation info)
        {
            IList <BQLValueItem> parameters = handle.GetParameters();

            if (parameters[1].IsNullValue())
            {
                BQLValueItem item = parameters[0];
                return(item.DisplayValue(info) + " is not null");
            }
            return(ConditionsFunction(handle, "<>", info));
        }
예제 #5
0
        internal override string DisplayValue(KeyWordInfomation info)
        {
            IDBAdapter idba    = info.DBInfo.CurrentDbAdapter;
            bool       isWhere = info.IsWhere;

            info.IsWhere = true;
            string ret = _prmHandle.DisplayValue(info);

            if (!string.IsNullOrEmpty(_aliasName))
            {
                ret += " as " + idba.FormatParam(_aliasName);
            }
            info.IsWhere = isWhere;
            return(ret);
        }
예제 #6
0
        /// <summary>
        /// 进行加法运算
        /// </summary>
        /// <param name="handle"></param>
        /// <returns></returns>
        internal static string DoAdd(BQLOperatorHandle fHandle, KeyWordInfomation info)
        {
            BQLValueItem[] parameters = fHandle.GetParameters();
            BQLValueItem   item1      = parameters[0];
            BQLValueItem   item2      = parameters[1];

            if (IsStringDBType(item1.ValueDbType) || IsStringDBType(item2.ValueDbType)) //字符串拼合
            {
                string value1 = item1.DisplayValue(info);
                string value2 = item2.DisplayValue(info);
                //if(OperatorPrecedenceUnit.LeftNeedBreak(
                fHandle.ValueDbType = DbType.String;
                return(info.DBInfo.CurrentDbAdapter.ConcatString(value1, value2));
            }
            else
            {
                fHandle.ValueDbType = DbType.Double;
            }
            return(CustomerConnectFunction(fHandle.GetParameters(), "+", info, fHandle.PriorityLevel));
        }