Exemple #1
0
        /// <summary>
        /// 获取只取主键的SQL语句
        /// </summary>
        internal string BuildKeyStringForRetrieve()
        {
            this._sqlString = SqlCommander.BuildForConditions(_conditions);
            string tempre = "";

            //如果不能使用Where从句
            if (_classMap.SuperClass == null && _sqlString == null)
            {
                tempre = this.GetSelectKeyClause();
            }
            else
            {
                //如果未指定过滤条件,且_classMap.SuperClass !=null
                if (_sqlString == null)
                {
                    tempre = GetSelectKeyClause() + " WHERE " + _classMap.StringForInherit;
                }
                //如果指定了过滤条件(_sqlString!= null)
                else
                {
                    tempre = GetSelectKeyClause() + " WHERE " + _sqlString;
                }
            }
            //Order by
            if (this._orderList != null)
            {
                tempre += SelectCommander.GetOrderSql(_orderList, _classMap);
            }
            return(tempre);
        }
Exemple #2
0
        internal void BuildStringForRetrieve()
        {
            this._sqlString = SqlCommander.BuildForConditions(_conditions);

            //如果不能使用Where从句
            if (_classMap.SuperClass == null && _sqlString == null)
            {
                _sqlString = GetSelectClause();
            }
            else
            {
                //如果未指定过滤条件,且_classMap.SuperClass !=null
                if (_sqlString == null)
                {
                    _sqlString = GetSelectClause() + " WHERE " + _classMap.StringForInherit;
                }
                //如果指定了过滤条件(_sqlString!= null)
                else
                {
                    _sqlString = GetSelectClause() + " WHERE " + _sqlString;
                    //且有父类
                    if (_classMap.SuperClass != null)
                    {
                        _sqlString += " AND " + _classMap.StringForInherit;
                    }
                }
            }
            //Order by
            if (this._orderList != null)
            {
                this._sqlString += SelectCommander.GetOrderSql(_orderList, _classMap);
            }
        }