本文整理汇总了C#中NHibernate.SqlCommand.SqlString.StartsWithCaseInsensitive方法的典型用法代码示例。如果您正苦于以下问题:C# SqlString.StartsWithCaseInsensitive方法的具体用法?C# SqlString.StartsWithCaseInsensitive怎么用?C# SqlString.StartsWithCaseInsensitive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NHibernate.SqlCommand.SqlString
的用法示例。
在下文中一共展示了SqlString.StartsWithCaseInsensitive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAfterSelectInsertPoint
private int GetAfterSelectInsertPoint(int prependCount, SqlString sql)
{
if (sql.StartsWithCaseInsensitive("select distinct"))
{
return prependCount + 15;
}
else if (sql.StartsWithCaseInsensitive("select"))
{
return prependCount + 6;
}
throw new NotSupportedException("The query should start with 'SELECT' or 'SELECT DISTINCT'");
}
示例2: AddCondition
public JoinSequence AddCondition(SqlString condition)
{
if (condition.Trim().Length != 0)
{
if (!condition.StartsWithCaseInsensitive(" and "))
conditions.Add(" and ");
conditions.Add(condition);
}
return this;
}
示例3: GetAfterSelectInsertPoint
private static int GetAfterSelectInsertPoint(SqlString sql)
{
string[] arrSelectStrings = {"select distinct", "select all", "select"};
for (int i = 0; i != arrSelectStrings.Length; ++i)
{
string strSelect = arrSelectStrings[i];
if (sql.StartsWithCaseInsensitive(strSelect))
{
return strSelect.Length;
}
}
return 0;
}
示例4: AddCondition
protected bool AddCondition(SqlStringBuilder buffer, SqlString on)
{
if (StringHelper.IsNotEmpty(on))
{
if (!on.StartsWithCaseInsensitive(" and"))
{
buffer.Add(" and ");
}
buffer.Add(on);
return true;
}
else
{
return false;
}
}
示例5: AddCondition
public override bool AddCondition(SqlString condition)
{
//TODO: this seems hackish
if (
afterFrom.ToString().IndexOf(condition.Trim().ToString()) < 0 &&
afterWhere.ToString().IndexOf(condition.Trim().ToString()) < 0)
{
if (!condition.StartsWithCaseInsensitive(" and "))
{
afterWhere.Add(" and ");
}
afterWhere.Add(condition);
return true;
}
return false;
}
示例6: AddSelectFragmentString
/// <summary>
///
/// </summary>
/// <param name="fragment"></param>
public void AddSelectFragmentString(SqlString fragment)
{
if (fragment.StartsWithCaseInsensitive(","))
{
fragment = fragment.Substring(1);
}
fragment = fragment.Trim();
if (fragment.Length > 0)
{
if (selectBuilder.Count > 0)
{
selectBuilder.Add(StringHelper.CommaSpace);
}
selectBuilder.Add(fragment);
}
}
示例7: GetAfterSelectInsertPoint
private static int GetAfterSelectInsertPoint(SqlString sql)
{
// Assume no common table expressions with the statement.
if (sql.StartsWithCaseInsensitive("select distinct"))
{
return 15;
}
else if (sql.StartsWithCaseInsensitive("select"))
{
return 6;
}
return 0;
}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:13,代码来源:SybaseSQLAnywhere10Dialect.cs
示例8: GetAfterSelectInsertPoint
private static int GetAfterSelectInsertPoint(SqlString sql)
{
if (sql.StartsWithCaseInsensitive("select distinct"))
{
return 15;
}
if (sql.StartsWithCaseInsensitive("select"))
{
return 6;
}
throw new NotSupportedException("The query should start with 'SELECT' or 'SELECT DISTINCT'");
}
示例9: AddWhereFragment
public void AddWhereFragment(
JoinFragment joinFragment,
SqlString whereFragment,
QueryNode query,
FromElement fromElement,
HqlSqlWalker hqlSqlWalker)
{
if (whereFragment == null)
{
return;
}
if (!fromElement.UseWhereFragment && !joinFragment.HasThetaJoins)
{
return;
}
whereFragment = whereFragment.Trim();
if (StringHelper.IsEmpty(whereFragment.ToString()))
{
return;
}
// Forcefully remove leading ands from where fragments; the grammar will
// handle adding them
if (whereFragment.StartsWithCaseInsensitive("and"))
{
whereFragment = whereFragment.Substring(4);
}
log.Debug("Using unprocessed WHERE-fragment [" + whereFragment +"]");
SqlFragment fragment = (SqlFragment) Create(HqlSqlWalker.SQL_TOKEN, whereFragment.ToString());
fragment.SetJoinFragment(joinFragment);
fragment.FromElement = fromElement;
if (fromElement.IndexCollectionSelectorParamSpec != null)
{
fragment.AddEmbeddedParameter(fromElement.IndexCollectionSelectorParamSpec);
fromElement.IndexCollectionSelectorParamSpec = null;
}
if (hqlSqlWalker.IsFilter())
{
//if (whereFragment.IndexOfCaseInsensitive("?") >= 0)
if (whereFragment.ToString().IndexOf("?") >= 0)
{
IType collectionFilterKeyType = hqlSqlWalker.SessionFactoryHelper
.RequireQueryableCollection(hqlSqlWalker.CollectionFilterRole)
.KeyType;
CollectionFilterKeyParameterSpecification paramSpec = new CollectionFilterKeyParameterSpecification(
hqlSqlWalker.CollectionFilterRole,
collectionFilterKeyType,
0
);
fragment.AddEmbeddedParameter(paramSpec);
}
}
JoinProcessor.ProcessDynamicFilterParameters(
whereFragment,
fragment,
hqlSqlWalker
);
log.Debug("Using processed WHERE-fragment [" + fragment.Text + "]");
// Filter conditions need to be inserted before the HQL where condition and the
// theta join node. This is because org.hibernate.loader.Loader binds the filter parameters first,
// then it binds all the HQL query parameters, see org.hibernate.loader.Loader.processFilterParameters().
if (fragment.FromElement.IsFilter || fragment.HasFilterCondition)
{
if (_filters == null)
{
// Find or create the WHERE clause
IASTNode where = (IASTNode) query.WhereClause;
// Create a new FILTERS node as a parent of all filters
_filters = Create(HqlSqlWalker.FILTERS, "{filter conditions}");
// Put the FILTERS node before the HQL condition and theta joins
where.InsertChild(0, _filters);
}
// add the current fragment to the FILTERS node
_filters.AddChild(fragment);
}
else
{
if (_thetaJoins == null)
{
// Find or create the WHERE clause
IASTNode where = (IASTNode) query.WhereClause;
// Create a new THETA_JOINS node as a parent of all filters
_thetaJoins = Create(HqlSqlWalker.THETA_JOINS, "{theta joins}");
// Put the THETA_JOINS node before the HQL condition, after the filters.
if (_filters == null)
{
where.InsertChild(0, _thetaJoins);
//.........这里部分代码省略.........
示例10: GetAfterSelectInsertPoint
private static int GetAfterSelectInsertPoint(SqlString text)
{
if (text.StartsWithCaseInsensitive("select"))
{
return 6;
}
return -1;
}
示例11: StartsWithEmptyString
public void StartsWithEmptyString()
{
SqlString sql = new SqlString(new string[] { "", "select", " from table" });
Assert.IsTrue(sql.StartsWithCaseInsensitive("s"));
Assert.IsFalse(sql.StartsWithCaseInsensitive(","));
}
示例12: StartsWithWhenContainsParameters
public void StartsWithWhenContainsParameters()
{
SqlString sql = new SqlString(" and ", "(", new SqlString("blah = ", Parameter.Placeholder), ")");
Assert.IsTrue(sql.StartsWithCaseInsensitive(" and"));
Assert.IsFalse(sql.StartsWithCaseInsensitive("blah"));
}
示例13: IsSelectStatement
private static bool IsSelectStatement(SqlString sqlString)
{
return sqlString.StartsWithCaseInsensitive("select");
}
示例14: GetAfterSelectInsertPoint
private static int GetAfterSelectInsertPoint(SqlString sql)
{
if (sql.StartsWithCaseInsensitive("select distinct"))
{
return 15;
}
else if (sql.StartsWithCaseInsensitive("select"))
{
return 6;
}
return 0;
}
示例15: GetLimitString
public override SqlString GetLimitString(SqlString queryString, SqlString offset, SqlString limit)
{
// This does not support the Cache SQL 'DISTINCT BY (comma-list)' extensions,
// but this extension is not supported through Hibernate anyway.
int insertionPoint = queryString.StartsWithCaseInsensitive("select distinct") ? 15 : 6;
return new SqlStringBuilder(queryString.Length + 8)
.Add(queryString)
.Insert(insertionPoint, " TOP ? ")
.ToSqlString();
}