當前位置: 首頁>>代碼示例>>C#>>正文


C# SqlString.EndsWithCaseInsensitive方法代碼示例

本文整理匯總了C#中NHibernate.SqlCommand.SqlString.EndsWithCaseInsensitive方法的典型用法代碼示例。如果您正苦於以下問題:C# SqlString.EndsWithCaseInsensitive方法的具體用法?C# SqlString.EndsWithCaseInsensitive怎麽用?C# SqlString.EndsWithCaseInsensitive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NHibernate.SqlCommand.SqlString的用法示例。


在下文中一共展示了SqlString.EndsWithCaseInsensitive方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetLimitString

		public override SqlString GetLimitString(SqlString sql, SqlString offset, SqlString limit)
		{
			sql = sql.Trim();
			bool isForUpdate = false;
			if (sql.EndsWithCaseInsensitive(" for update"))
			{
				sql = sql.Substring(0, sql.Length - 11);
				isForUpdate = true;
			}

			string selectColumns = ExtractColumnOrAliasNames(sql);

			var pagingSelect = new SqlStringBuilder(sql.Parts.Count + 10);
			if (offset != null)
			{
				pagingSelect.Add("select " + selectColumns + " from ( select row_.*, rownum rownum_ from ( ");
			}
			else
			{
				pagingSelect.Add("select " + selectColumns + " from ( ");
			}
			pagingSelect.Add(sql);
			if (offset != null && limit != null)
			{
				pagingSelect.Add(" ) row_ where rownum <=").Add(limit).Add(") where rownum_ >").Add(offset);
			}
			else if (limit != null)
			{
				pagingSelect.Add(" ) where rownum <=").Add(limit);
			}
			else
			{
				// offset is specified, but limit is not.
				pagingSelect.Add(" ) row_ ) where rownum_ >").Add(offset);
			}

			if (isForUpdate)
			{
				pagingSelect.Add(" for update");
			}

			return pagingSelect.ToSqlString();
		}
開發者ID:ntuveri,項目名稱:nhibernate-core,代碼行數:43,代碼來源:Oracle8iDialect.cs

示例2: GetLimitString

		public override SqlString GetLimitString(SqlString sql, int offset, int limit, int? offsetParameterIndex, int? limitParameterIndex)
		{
			sql = sql.Trim();
			bool hasOffset = offset > 0;
			bool isForUpdate = false;
			if (sql.EndsWithCaseInsensitive(" for update"))
			{
				sql = sql.Substring(0, sql.Length - 11);
				isForUpdate = true;
			}

			var pagingSelect = new SqlStringBuilder(sql.Parts.Count + 10);
			if (hasOffset)
			{
				pagingSelect.Add("select * from ( select row_.*, rownum rownum_ from ( ");
			}
			else
			{
				pagingSelect.Add("select * from ( ");
			}
			pagingSelect.Add(sql);
			if (hasOffset)
			{
				pagingSelect.Add(" ) row_ where rownum <=").AddParameter(limitParameterIndex.Value).Add(") where rownum_ >").AddParameter(offsetParameterIndex.Value);
			}
			else
			{
				pagingSelect.Add(" ) where rownum <=").AddParameter(limitParameterIndex.Value);
			}

			if (isForUpdate)
			{
				pagingSelect.Add(" for update");
			}

			return pagingSelect.ToSqlString();
		}
開發者ID:renefc3,項目名稱:nhibernate,代碼行數:37,代碼來源:Oracle8iDialect.cs


注:本文中的NHibernate.SqlCommand.SqlString.EndsWithCaseInsensitive方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。