Пример #1
0
        string StringLikeFull(CRLExpression.MethodCallObj methodInfo, ref int parIndex, AddParameHandler addParame, string likeFormat)
        {
            var    field    = methodInfo.MemberQueryName;
            var    nodeType = methodInfo.ExpressionType;
            var    args     = methodInfo.Args[0];
            string parName  = string.Format("@like{0}", parIndex);

            parIndex += 1;

            if (args is ExpressionValueObj)
            {
                parName = args.ToString();
                //if (!parName.ToString().Contains("%"))
                //{
                //    parName = string.Format(likeFormat, parName);
                //}
            }
            else
            {
                if (!args.ToString().Contains("%"))
                {
                    args = string.Format(likeFormat, args);
                }
                addParame(parName, args);
            }
            if (nodeType == ExpressionType.Equal)
            {
                return(dBAdapter.StringLikeFormat(field, parName));
            }
            else
            {
                return(dBAdapter.StringNotLikeFormat(field, parName));
            }
            //return string.Format("{0} LIKE {1}", field, parName);
        }
Пример #2
0
        public string StringNotLike(string field, ref int parIndex, AddParameHandler addParame, object[] args)
        {
            string parName = string.Format("@like{0}", parIndex);

            addParame(parName, args[0]);
            return(dBAdapter.StringNotLikeFormat(field, parName));
            //return string.Format("{0} not LIKE {1}", field, parName);
        }
Пример #3
0
        string StringLikeFull(string field, ExpressionType nodeType, ref int parIndex, AddParameHandler addParame, string likeFormat, object args)
        {
            string parName = string.Format("@like{0}", parIndex);

            parIndex += 1;
            if (!args.ToString().Contains("%"))
            {
                args = string.Format(likeFormat, args);
            }
            addParame(parName, args);
            if (nodeType == ExpressionType.Equal)
            {
                return(dBAdapter.StringLikeFormat(field, parName));
            }
            else
            {
                return(dBAdapter.StringNotLikeFormat(field, parName));
            }
            //return string.Format("{0} LIKE {1}", field, parName);
        }
Пример #4
0
        string StringLikeFull(CRLExpression.MethodCallObj methodInfo, ref int parIndex, AddParameHandler addParame, string likeFormat)
        {
            var    field    = methodInfo.MemberQueryName;
            var    nodeType = methodInfo.ExpressionType;
            var    args     = methodInfo.Args[0];
            string parName  = GetParamName("like", parIndex);

            parIndex += 1;

            if (args is ExpressionValueObj)//like 字段名 '%'+t1.[ProductName1]
            {
                parName = args.ToString();

                likeFormat = likeFormat.Replace("%", "+'%'+");
                parName    = string.Format(likeFormat, parName);
                parName    = System.Text.RegularExpressions.Regex.Replace(parName, @"^\+", "");
                parName    = System.Text.RegularExpressions.Regex.Replace(parName, @"\+$", "");
            }
            else
            {
                if (!args.ToString().Contains("%"))
                {
                    args = string.Format(likeFormat, args);
                }
                addParame(parName, args);
            }
            if (nodeType == ExpressionType.Equal)
            {
                return(dBAdapter.StringLikeFormat(field, parName));
            }
            else
            {
                return(dBAdapter.StringNotLikeFormat(field, parName));
            }
            //return string.Format("{0} LIKE {1}", field, parName);
        }