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


C# SqlStringBuilder.RemoveAt方法代码示例

本文整理汇总了C#中NHibernate.SqlCommand.SqlStringBuilder.RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C# SqlStringBuilder.RemoveAt方法的具体用法?C# SqlStringBuilder.RemoveAt怎么用?C# SqlStringBuilder.RemoveAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NHibernate.SqlCommand.SqlStringBuilder的用法示例。


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

示例1: RemoveAt

		public void RemoveAt() 
		{
			SqlStringBuilder builder = new SqlStringBuilder();

			builder.Add("   select * ");
			builder.Add("from table");
			Assert.AreEqual( "   select * from table", builder.ToSqlString().ToString() );

			builder.RemoveAt(0);
			Assert.AreEqual( "from table", builder.ToSqlString().ToString(), "Removed the first element in the SqlStringBuilder" );

			builder.Insert(0, "SELECT * ");
			Assert.AreEqual( "SELECT * from table", builder.ToSqlString().ToString() );
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:14,代码来源:SqlStringBuilderFixture.cs

示例2: ToGroupSqlString

		public override SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery,
												   IDictionary<string, IFilter> enabledFilters)
		{
			SqlStringBuilder buf = new SqlStringBuilder();
			foreach (IProjection projection in args)
			{
				if (projection.IsGrouped)
				{
					buf.Add(projection.ToGroupSqlString(criteria, criteriaQuery, enabledFilters)).Add(", ");
				}
			}
			if (buf.Count >= 2)
			{
				buf.RemoveAt(buf.Count - 1);
			}
			return buf.ToSqlString();
		}
开发者ID:snbbgyth,项目名称:WorkFlowEngine,代码行数:17,代码来源:SqlFunctionProjection.cs

示例3: ToGroupSqlString

		public SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
		{
			SqlStringBuilder buf = new SqlStringBuilder();
			for (int i = 0; i < Length; i++)
			{
				IProjection proj = this[i];
				if (proj.IsGrouped)
				{
					buf.Add(proj.ToGroupSqlString(criteria, criteriaQuery,enabledFilters))
						.Add(", ");
				}
			}
			if (buf.Count >= 2)
			{
				buf.RemoveAt(buf.Count - 1);
			}
			return buf.ToSqlString();
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:18,代码来源:ProjectionList.cs

示例4: ToGroupSqlString

		public SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery)
		{
			SqlStringBuilder buf = new SqlStringBuilder();
			for (int i = 0; i < Length; i++)
			{
				IProjection proj = this[i];
				if (proj.IsGrouped)
				{
					buf.Add(proj.ToGroupSqlString(criteria, criteriaQuery))
						.Add(", ");
				}
			}
			if (buf.Count >= 2)
			{
				buf.RemoveAt(buf.Count - 1);
			}
			//if (buf.Length > 2) buf.Length = buf.Length - 2; //pull off the last ", "
			return buf.ToSqlString();
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:19,代码来源:ProjectionList.cs

示例5: OrderBy

		/// <summary>
		/// Get the order by string required for collection fetching
		/// </summary>
		protected SqlString OrderBy(IList<OuterJoinableAssociation> associations)
		{
			SqlStringBuilder buf = new SqlStringBuilder();

			OuterJoinableAssociation last = null;
			foreach (OuterJoinableAssociation oj in associations)
			{
				if (oj.JoinType == JoinType.LeftOuterJoin)
				{
					if (oj.Joinable.IsCollection)
					{
						IQueryableCollection queryableCollection = (IQueryableCollection)oj.Joinable;
						if (queryableCollection.HasOrdering)
						{
							string orderByString = queryableCollection.GetSQLOrderByString(oj.RHSAlias);
							buf.Add(orderByString).Add(StringHelper.CommaSpace);
						}
					}
					else
					{
						// it might still need to apply a collection ordering based on a
						// many-to-many defined order-by...
						if (last != null && last.Joinable.IsCollection)
						{
							IQueryableCollection queryableCollection = (IQueryableCollection)last.Joinable;
							if (queryableCollection.IsManyToMany && last.IsManyToManyWith(oj))
							{
								if (queryableCollection.HasManyToManyOrdering)
								{
									string orderByString = queryableCollection.GetManyToManyOrderByString(oj.RHSAlias);
									buf.Add(orderByString).Add(StringHelper.CommaSpace);
								}
							}
						}
					}
				}
				last = oj;
			}

			if (buf.Count > 0) {
				buf.RemoveAt(buf.Count-1);
			}

			return buf.ToSqlString();
		}
开发者ID:rbirkby,项目名称:nhibernate-core,代码行数:48,代码来源:JoinWalker.cs

示例6: BuildSubstring

		private SqlStringBuilder BuildSubstring(int startIndex)
		{
			SqlStringBuilder builder = new SqlStringBuilder(this);

			int offset = 0;

			while (builder.Count > 0)
			{
				int nextOffset = offset + LengthOfPart(builder[0]);

				if (nextOffset > startIndex)
				{
					break;
				}

				builder.RemoveAt(0);
				offset = nextOffset;
			}

			if (builder.Count > 0 && offset < startIndex)
			{
				builder[0] = ((string) builder[0]).Substring(startIndex - offset);
			}

			return builder;
		}
开发者ID:remcoros,项目名称:nhibernate,代码行数:26,代码来源:SqlString.cs

示例7: Substring

		/// <summary>
		/// Retrieves a substring from this instance. The substring starts at a specified character position. 
		/// </summary>
		/// <param name="startIndex">The starting character position of a substring in this instance.</param>
		/// <returns>
		/// A new SqlString to the substring that begins at startIndex in this instance. 
		/// </returns>
		/// <remarks>
		/// If the first SqlPart is a Parameter then no action is taken and a copy of the SqlString is
		/// returned.
		/// 
		/// If the startIndex is greater than the length of the strings before the first SqlPart that
		/// is a Parameter then all of the strings will be removed and the first SqlPart returned
		/// will be the Parameter. 
		/// </remarks>
		public SqlString Substring( int startIndex )
		{
			SqlStringBuilder builder = new SqlStringBuilder( Compact() );

			string part = builder[ 0 ] as string;

			// if the first part is null then it is not a string so just
			// return them the compacted version
			if( part != null )
			{
				if( part.Length < startIndex )
				{
					builder.RemoveAt( 0 );
				}
				else
				{
					builder[ 0 ] = part.Substring( startIndex );
				}
			}

			return builder.ToSqlString();
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:37,代码来源:SqlString.cs


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