예제 #1
0
        /// <summary>
        /// 进行转换
        /// </summary>
        /// <param name="info"></param>
        /// <param name="item"></param>
        /// <returns></returns>
        private static AbsCondition DoConver(KeyWordInfomation info, BQLQuery item)
        {
            KeyWordConver conver = new KeyWordConver();
            AbsCondition  con    = conver.ToConver(item, info);

            con.AliasManager = info.AliasManager;
            con.DbParamList  = info.ParamList;
            con.CacheTables  = info.ContainTables;
            return(con);
        }
예제 #2
0
        internal override string DisplayValue(KeyWordInfomation info)
        {
            SelectCondition con     = info.Condition as SelectCondition;
            bool            isGroup = false;

            if (con != null)
            {
                isGroup = con.HasGroup;
            }
            if (info.Condition.PrimaryKey.Count <= 0 && !CommonMethods.IsNull(_table) && !isGroup)
            {
                foreach (string pks in _table.GetPrimaryParam())
                {
                    StringBuilder pkStr = new StringBuilder();
                    if (!string.IsNullOrEmpty(_aliasName))
                    {
                        pkStr.Append(info.DBInfo.CurrentDbAdapter.FormatTableName(_aliasName) + ".");
                    }
                    else
                    {
                        pkStr.Append(_table.DisplayValue(info) + ".");
                    }
                    pkStr.Append(pks);
                    info.Condition.PrimaryKey.Add(pkStr.ToString());
                }
            }

            string result = null;

            if (!CommonMethods.IsNull(_table))
            {
                result = _table.DisplayValue(info);
            }
            else if (_query != null)
            {
                KeyWordInfomation qinfo = info.Clone() as KeyWordInfomation;
                qinfo.Condition = new SelectCondition(info.DBInfo);
                qinfo.ParamList = info.ParamList;
                KeyWordConver objCover = new KeyWordConver();
                string        sql      = objCover.ToConver(_query, qinfo).GetSql(false);
                foreach (KeyValuePair <string, bool> kvp in qinfo.ContainTables)
                {
                    info.ContainTables[kvp.Key] = true;
                }
                result = "(" + sql + ")";
            }
            if (!string.IsNullOrEmpty(_aliasName))
            {
                result += " " + info.DBInfo.CurrentDbAdapter.FormatTableName(_aliasName);
            }

            return(result);
        }