本文整理汇总了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() );
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}