示例#1
0
        /// <summary>
        /// 创建新的自选择Sql选择语句
        /// </summary>
        /// <param name="innerTableName">内部数据表名称</param>
        /// <param name="innerTableAliasesName">内部数据表别名</param>
        /// <param name="createInnerCommandAction">创建内部语句的方法</param>
        /// <returns>Sql选择语句</returns>
        public SelectCommand CreateSelectCommand(String innerTableName, String innerTableAliasesName, Action <SelectCommand> createInnerCommandAction)
        {
            SelectCommand innerCommand = this.CreateSelectCommand(innerTableName);

            createInnerCommandAction(innerCommand);

            SelectCommand outerCommand = new SelectCommand(this, innerCommand, innerCommand, innerTableAliasesName);

            outerCommand.InternalAddDataParameterList(innerCommand.GetAllParameters());

            return(outerCommand);
        }
示例#2
0
        /// <summary>
        /// 获取分页后的选择语句
        /// </summary>
        /// <param name="sourceCommand">源选择语句</param>
        /// <param name="orderReverse">是否反转</param>
        /// <returns>分页后的选择语句</returns>
        internal override String InternalGetPagerSelectCommand(SelectCommand sourceCommand, Boolean orderReverse)
        {
            if (sourceCommand.PageSize <= 0 || sourceCommand.RecordStart <= 0)//正常模式或分页模式中的子语句
            {
                return(AccessSelectPager.InternalGetPagerCommand(sourceCommand, 0, orderReverse));
            }

            String cntCommand = AccessSelectPager.InternalGetCountCommand(sourceCommand);

            DataParameter[] parameters = sourceCommand.GetAllParameters();

            DbCommand dbCommand   = this.CreateDbCommand(cntCommand, parameters);
            Int32     recordCount = this.ExecuteScalar <Int32>(dbCommand);

            return(this.InternalGetPagerSelectCommand(sourceCommand, recordCount, orderReverse));
        }