• Kentico selectall


    c:workspacecompanykenticosourcekentico12DataEngineDatabaseAbstractAbstractSqlGenerator.cs

        // SELECT ALL query
                    case SqlOperationTypeEnum.SelectAll:
                        sb.Append(SqlHelper.GetSelectQuery(tableName));
                        break;

    c:workspacecompanykenticosourcekentico12DataEngineDatabaseHelpersSqlHelper.cs

     /// <summary>
            /// Gets the general select query
            /// </summary>
            /// <param name="source">Query source</param>
            /// <param name="where">Where condition</param>
            public static string GetSelectQuery(string source, string where = null)
            {
                var query = SqlMacroHelper.ReplaceSource(GENERAL_SELECT, source, null);
    
                if (!String.IsNullOrEmpty(where))
                {
                    query = SqlMacroHelper.ReplaceWhere(query, where, true);
                }
    
                return query;
            }

    C:workspaceCompanyKenticoSourceKentico12DataEngineDatabaseHelpersSqlMacroHelper.cs

       /// <summary>
            /// Replaces the source macro in the query text
            /// </summary>
            /// <param name="queryText">Query text</param>
            /// <param name="source">Query source</param>
            /// <param name="defaultSource">Default source</param>
            public static string ReplaceSource(string queryText, string source, string defaultSource)
            {
                // Replace source
                if (!ReplaceMacro(ref queryText, QueryMacros.SOURCE, source, defaultSource) && !String.IsNullOrEmpty(source))
                {
                    throw new NotSupportedException("[SqlHelper.ReplaceSource]: Missing ##SOURCE## macro in the query text '" + queryText + "', cannot apply the source '" + source + "'.");
                }
    
                return queryText;
            }

    自己遇到的错误的堆栈信息是

    Message: [SqlHelper.ReplaceColumns]: Missing ##COLUMNS## macro in the query text '
    WITH AllData AS
    (
    SELECT
    MLR.ItemID
    ,MLR.UserId
    ,TypeOfEmployment
    ,CardType
    ,WalletType
    ,CustomerNumber
    ,ConfirmationResultCode
    ,RepeatingAction
    ,CustomerID
    ,FirstName
    ,LastName
    ,Email
    ,SocialSecurityNumber
    ,EmployeeNumber
    ,City
    ,CostCenter
    ,Department
    ,StatusTR
    ,StatusTMB
    ,StatusTT
    ,StatusTD
    ,BalanceTR
    ,BalanceTMB
    ,BalanceTT
    ,BalanceTD_TR
    ,BalanceTD_TMB
    ,LoadValue
    ,LoadDate
    ,LoadWorkingDays
    ,LoadWorkingDaysValue
    ,LoadDay
    ,MLR.ItemCreatedWhen
    ,CASE WHEN IsNull(ConfirmationResultCode,-1)=0 THEN MLR.ItemModifiedWhen ELSE MLR.ItemCreatedWhen END TimeStamp
    ,DayOfMonthForLoad_TR
    ,DayOfMonthForLoad_TMB
    ,DayOfMonthForLoad_TD_TR
    ,DayOfMonthForLoad_TD_TMB
    ,DayOfMonthForLoad_TT
    ,PossibleValueChoice1_TR
    ,PossibleValueChoice2_TR
    ,PossibleValueChoice3_TR
    ,PossibleValueChoice1_TMB
    ,PossibleValueChoice2_TMB
    ,PossibleValueChoice3_TMB
    ,PossibleValueChoice1_TD_TR
    ,PossibleValueChoice2_TD_TR
    ,PossibleValueChoice3_TD_TR
    ,PossibleValueChoice1_TD_TMB
    ,PossibleValueChoice2_TD_TMB
    ,PossibleValueChoice3_TD_TMB
    ,PossibleValueChoice1_TT
    ,PossibleValueChoice2_TT
    ,PossibleValueChoice3_TT
    ,CardStatusTD
    ,WorkingDays_TR
    ,WorkingDays_TD_TR
    ,WorkingDaysCounter_TR
    ,WorkingDaysCounter_TD_TR
    ,WorkingDaysValueChoice1_TR
    ,WorkingDaysValueChoice2_TR
    ,WorkingDaysValueChoice3_TR
    ,WorkingDaysValueChoice1_TD_TR
    ,WorkingDaysValueChoice2_TD_TR
    ,WorkingDaysValueChoice3_TD_TR
    ,LoadPercentage
    ,EmploymentEndDate
    ,ScheduledDroppingDate
    ,ROW_NUMBER() over (order by lastname, firstname) as CMS_RN
    FROM dbo.WOT_MyLodRequest MLR
    INNER JOIN dbo.WOT_Company C ON C.Number = MLR.CustomerNumber
    INNER JOIN dbo.MobileApplicationUser MAU ON MAU.UserID = MLR.UserId
    INNER JOIN dbo.CMS_User U ON U.UserID =MLR.UserId
    LEFT JOIN dbo.View_WOT_CardholderSettings CS ON CS.MAUItemId = MAU.ItemId
    WHERE ##WHERE##
    )
    SELECT *, (SELECT COUNT(*) FROM AllData) AS [CMS_TOT]
    FROM AllData
    WHERE CMS_RN BETWEEN 1 AND 25
    ORDER BY CMS_RN
    ', cannot apply the specified columns '*, ROW_NUMBER() OVER (ORDER BY [LastName], [Firstname]) AS [CMS_RN]'.

    Exception type: System.NotSupportedException
    Stack trace:
    at CMS.DataEngine.SqlMacroHelper.ReplaceColumns(String queryText, String columns)
    at CMS.DataEngine.SqlMacroHelper.ResolveMacrosInQueryText(QueryMacros queryMacros, String queryText)
    at CMS.DataEngine.SqlMacroHelper.ResolveQueryMacros(QueryMacros queryMacros, String queryText)
    at CMS.DataEngine.QueryParameters.ResolveMacrosInternal(Boolean updateQueryText)
    at CMS.DataEngine.GeneralConnection.ExecuteQuery(QueryParameters query)
    at CMS.DataEngine.GeneralConnection.ExecuteQuery(QueryParameters query, Int32& totalRecords)
    at CMS.DataEngine.DataQueryBase`1.GetDataFromDBInternal()
    at CMS.DataEngine.DataQueryBase`1.GetDataFromDB()
    at CMS.DataEngine.DataQueryBase`1.GetData()
    at CMS.DataEngine.DataQueryBase`1.get_Result()
    at CMS.DataEngine.ConnectionHelper.ExecuteQuery(String queryName, QueryDataParameters parameters, String where, String orderBy, Int32 topN, String columns, Int32 offset, Int32 maxRecords, Int32& totalRecords)
    at CMS.UIControls.UniGrid.LoadDataFromQuery()
    at CMS.UIControls.UniGrid.RetrieveData()
    at CMS.UIControls.UniGrid.ReloadData()

    这样过滤速度比较快

    SELECT b.ClassDisplayName,
           b.ClassName,
           a.*
    FROM dbo.CMS_Query AS a
        LEFT JOIN dbo.CMS_Class AS b
            ON a.ClassID = b.ClassID
    WHERE a.QueryText LIKE '%View_WOT_CardholderSettings%'
  • 相关阅读:
    UVA 11488 Hyper Prefix Sets (字典树)
    UVALive 3295 Counting Triangles
    POJ 2752 Seek the Name, Seek the Fame (KMP)
    UVA 11584 Partitioning by Palindromes (字符串区间dp)
    UVA 11100 The Trip, 2007 (贪心)
    JXNU暑期选拔赛
    计蒜客---N的-2进制表示
    计蒜客---线段的总长
    计蒜客---最大质因数
    JustOj 2009: P1016 (dp)
  • 原文地址:https://www.cnblogs.com/chucklu/p/15178983.html
Copyright © 2020-2023  润新知