当前位置: 首页>>代码示例>>C#>>正文


C# SelectStatement类代码示例

本文整理汇总了C#中SelectStatement的典型用法代码示例。如果您正苦于以下问题:C# SelectStatement类的具体用法?C# SelectStatement怎么用?C# SelectStatement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SelectStatement类属于命名空间,在下文中一共展示了SelectStatement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderSingleQuery

        private static void RenderSingleQuery(SelectStatement select, DbmsType dbms, StringBuilder output, DbParameterCollection parameters)
        {
            // Either TOP or ORDER BY is used; but not both.

            // SELECT ... FROM ...
            // WHERE (ROWNUM <= @top) AND (@this.filter)
            // GROUP BY ... HAVING ... ORDER BY ...
            AppendSelectAndDistinctKeyWords(select, output);
            AppendSelectList(select, dbms, output, parameters);
            AppendFromClause(select, dbms, output);

            // WHERE. We have made sure that if TOP is used then ORDER BY is not used.
            if (select.Top > 0)
            {
                // WHERE ROWNUM <= this.top AND (this.filter).
                output.Append(" WHERE ROWNUM <= " + select.Top.ToString(CultureInfo.InvariantCulture));

                if (select.Where != null && !select.Where.IsEmpty)
                {
                    output.Append(" AND (");
                    select.Where.Render(dbms, output, parameters);
                    output.Append(")");
                }
            }
            else
            {
                AppenWhereWoRownum(select, dbms, output, parameters);
            }

            AppendGroupByClause(select, dbms, output, parameters);
            AppendHavingClause(select, dbms, output, parameters);
            AppendOrderByClause(select, dbms, output, parameters);
        }        
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:33,代码来源:OracleSelectRenderer.cs

示例2: CreateSelectFromLevelQuery

        private static SelectStatement CreateSelectFromLevelQuery(IEntity rootEntity, DbRelation recursiveRelation, SearchCondition leafFilter, int level, LevelQuerySelectList itemsToSelect)
        {
            if (level > Settings.GenericHierarchicalQueryExecutorMaxLevel)
                throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, Messages.GenericHierarchicalQueryExecutor_MaxLevelReachedFormat, Settings.GenericHierarchicalQueryExecutorMaxLevel));

            // Target level table must be child table because that is the table which is used in leafFilter.
            // If leaf filter is used then the we must ensure that proper table name is used for target table.
            IDbTable targetLevelTable;
            if (leafFilter != null && !leafFilter.IsEmpty)
                targetLevelTable = recursiveRelation.Child;
            else
                targetLevelTable = rootEntity.Table.Clone("L" + level);

            SelectStatement selectFromTargetLevel = new SelectStatement(targetLevelTable);
            CreateSelectListItems(itemsToSelect, targetLevelTable, selectFromTargetLevel);

            if (leafFilter != null && !leafFilter.IsEmpty)
                selectFromTargetLevel.Where.Add(leafFilter);

            IDbTable prevLevel = targetLevelTable;
            for (int parentLevel = level - 1; parentLevel >= 0; parentLevel--)
            {
                IDbTable nextLevel = rootEntity.Table.Clone("L" + parentLevel);
                DbRelation joinLevels = JoinLevelsInSubTree(prevLevel, nextLevel, recursiveRelation);
                selectFromTargetLevel.Relations.Add(joinLevels, false, false);
                prevLevel = nextLevel;
            }

            IDbTable subTreeRoot = prevLevel;
            foreach (IDbColumn rootPkPart in subTreeRoot.PrimaryKey)
                selectFromTargetLevel.Where.Add(rootPkPart, rootEntity.GetField(rootPkPart));

            return selectFromTargetLevel;
        }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:34,代码来源:GenericHierarchicalQueryExecutor.cs

示例3: ApplyCondition

        public SelectStatement ApplyCondition(SelectStatement statement)
        {
            var extractor = new CriteriaOperatorExtractor();
            extractor.Extract(statement.Condition);
            traceStatement(statement, "ApplyCondition");

            foreach (FilterProviderBase provider in FilterProviderManager.Providers)
            {
                FilterProviderBase providerBase = FilterProviderManager.GetFilterProvider(provider.FilterMemberName);
                if (providerBase!= null)
                {
                    Tracing.Tracer.LogVerboseValue("providerName", providerBase.Name);
                    IEnumerable<BinaryOperator> binaryOperators =
                        extractor.BinaryOperators.Where(
                            @operator =>
                            @operator.RightOperand is OperandValue &&
                            ReferenceEquals(((OperandValue) @operator.RightOperand).Value, providerBase.FilterMemberName));
                    if (!FilterIsShared(statement.TableName,providerBase.Name) && binaryOperators.Count() == 0&&!IsSystemTable(statement.TableName))
                    {
                        string s = providerBase.FilterValue== null? null:providerBase.FilterValue.ToString();

                        string nodeAlias = statement.Operands.OfType<QueryOperand>().Where(
                                               operand => operand.ColumnName == providerBase.FilterMemberName).Select(
                                               operand => operand.NodeAlias).FirstOrDefault() ?? statement.Alias;
                        statement.Condition &= new QueryOperand(providerBase.FilterMemberName, nodeAlias) ==s;
                        Tracing.Tracer.LogVerboseValue("new_statement", statement);
                    }
                }
            }
            return statement;
        }
开发者ID:cevious,项目名称:eXpand,代码行数:31,代码来源:FilterDataStoreModule.cs

示例4: AppendSelectAndDistinctKeyWords

 private static void AppendSelectAndDistinctKeyWords(SelectStatement select, StringBuilder output)
 {
     // SELECT.
     output.Append("SELECT ");
     if (select.Distinct)
         output.Append("DISTINCT ");
 }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:7,代码来源:SqlServerSelectRenderer.cs

示例5: Visit

		public void Visit(SelectStatement select_statement)
		{
			_Query.Append("SELECT ");

			if (select_statement.IsDistinct)
				_Query.Append("DISTINCT ");

			if (select_statement.SelectedAllColumns)
				_Query.Append("* ");

			if (select_statement.SelectedAllColumns && select_statement.SelectList.Count != 0)
				_Query.Append(", ");

			foreach(ISQLExpression item in select_statement.SelectList)
			{
				item.Accept(this);
				if ( select_statement.SelectList.IndexOf(item) != select_statement.SelectList.Count - 1 )
					_Query.Append(", ");
			}

            select_statement.FromClause.Accept(this);
			
			if (select_statement.WhereClause != null)
				select_statement.WhereClause.Accept(this);
			
			if( select_statement.OrderByClause != null)
				select_statement.OrderByClause.Accept(this);
		}
开发者ID:npenin,项目名称:uss,代码行数:28,代码来源:BaseStringSQLVisitor.cs

示例6: NotExists

        public static Predicate NotExists(SelectStatement subQuery)
        {
            if (subQuery == null) {
                throw new ArgumentNullException("subQuery");
            }

            return new NotExistsPredicate(subQuery);
        }
开发者ID:codeinsiders,项目名称:sharpql,代码行数:8,代码来源:Predicate.cs

示例7: AppendSelectList

 private static void AppendSelectList(SelectStatement select, DbmsType dbms, StringBuilder output, DbParameterCollection parameters)
 {
     // Select list.
     if (select.SelectList != null && select.SelectList.Count > 0)
         select.SelectList.Render(dbms, output, parameters);
     else
         output.Append("*");
 }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:8,代码来源:SqlServerSelectRenderer.cs

示例8: ProcessOptimizerHints

 private void ProcessOptimizerHints(IList<OptimizerHint> OptimizerHints, SelectStatement SelStatement)
 {
     /* OptimizerHints is not a decendant of TSQLFragment */
     foreach (OptimizerHint Hint in OptimizerHints)
     {
         ProcessHint(Hint, SelStatement);
     }
 }
开发者ID:dalehhirt,项目名称:TSQL-Smells,代码行数:8,代码来源:SelectStatementProcessor.cs

示例9: SubQuery

    public SubQuery(SelectStatement select) {
      mySelect = select.Clone();
      Name = Naming.NewTableName();

      foreach (Expression column in mySelect.Columns) {
        column.VisitAll<BindExpression>(x => x.BindColumn.Table = this);
      }
    }
开发者ID:slewrate,项目名称:csharpsqlbuilder,代码行数:8,代码来源:SubQuery.cs

示例10: ExistsPredicate

        internal ExistsPredicate(SelectStatement subQuery)
        {
            if (subQuery == null) {
                throw new ArgumentNullException("subQuery");
            }

            this.SubQuery = subQuery;
        }
开发者ID:codeinsiders,项目名称:sharpql,代码行数:8,代码来源:ExistsPredicate.cs

示例11: AppendGroupByClause

 private static void AppendGroupByClause(SelectStatement select, DbmsType dbms, StringBuilder output, DbParameterCollection parameters)
 {
     // GROUP BY.
     if (select.GroupBy != null && select.GroupBy.Fields.Count > 0)
     {
         output.Append(" ");
         select.GroupBy.Render(dbms, output, parameters);
     }
 }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:9,代码来源:GenericSelectRenderer.cs

示例12: CreateSelectListItems

 private static void CreateSelectListItems(LevelQuerySelectList itemsToSelect, IDbTable targetLevelTable, SelectStatement selectFromTargetLevel)
 {
     if (itemsToSelect == LevelQuerySelectList.AllColumns)
         selectFromTargetLevel.SelectList.Add(targetLevelTable.Columns);
     else if (itemsToSelect == LevelQuerySelectList.Count)
         selectFromTargetLevel.SelectList.Add(AggregateFunctionFactory.Count("nodeCount"));
     else if (itemsToSelect == LevelQuerySelectList.PrimaryKey)
         selectFromTargetLevel.SelectList.Add(targetLevelTable.PrimaryKey);
 }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:9,代码来源:GenericHierarchicalQueryExecutor.cs

示例13: AppendWhereClause

 private static void AppendWhereClause(SelectStatement select, DbmsType dbms, StringBuilder output, DbParameterCollection parameters)
 {
     // WHERE.
     if (select.Where != null && !select.Where.IsEmpty)
     {
         output.Append(" WHERE ");
         select.Where.Render(dbms, output, parameters);
     }
 }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:9,代码来源:SqlServerSelectRenderer.cs

示例14: AppendHavingClause

 private static void AppendHavingClause(SelectStatement select, DbmsType dbms, StringBuilder output, DbParameterCollection parameters)
 {
     // HAVING.
     if (select.Having != null && !select.Having.IsEmpty)
     {
         output.Append(" HAVING ");
         select.Having.Render(dbms, output, parameters);
     }
 }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:9,代码来源:GenericSelectRenderer.cs

示例15: Render

 public void Render(SelectStatement select, DbmsType dbms, StringBuilder output, DbParameterCollection parameters)
 {
     // Uses ROWNUM instead of TOP. If ORDER BY is used then current SELECT statement is rendered
     // using sub-queries. ROWNUM is used in outer query.
     bool orderByIsUsed = (select.OrderBy != null && select.OrderBy.Count > 0);
     if (select.Top > 0 && orderByIsUsed)
         RenderOrderByInSubQueryAndRownumInOuterQuery(select, dbms, output, parameters);
     else
         RenderSingleQuery(select, dbms, output, parameters);
 }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:10,代码来源:OracleSelectRenderer.cs


注:本文中的SelectStatement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。