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


C# SqlString.StartsWithCaseInsensitive方法代碼示例

本文整理匯總了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'");
 }
開發者ID:AndyCC,項目名稱:Jumbleblocks-website,代碼行數:12,代碼來源:MsSql2008FixedDialect.cs

示例2: AddCondition

 public JoinSequence AddCondition(SqlString condition)
 {
     if (condition.Trim().Length != 0)
     {
         if (!condition.StartsWithCaseInsensitive(" and "))
             conditions.Add(" and ");
         conditions.Add(condition);
     }
     return this;
 }
開發者ID:zibler,項目名稱:zibler,代碼行數:10,代碼來源:JoinSequence.cs

示例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;
		}
開發者ID:hazzik,項目名稱:nh-contrib-everything,代碼行數:13,代碼來源:SybaseASA9Dialect.cs

示例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;
			}
		}
開發者ID:Novthirteen,項目名稱:sconit_timesseiko,代碼行數:16,代碼來源:JoinFragment.cs

示例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;
        }
開發者ID:zibler,項目名稱:zibler,代碼行數:18,代碼來源:QueryJoinFragment.cs

示例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);
			}
		}
開發者ID:marchlud,項目名稱:nhibernate-core,代碼行數:23,代碼來源:QuerySelect.cs

示例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'");
		}
開發者ID:nikson,項目名稱:nhibernate-core,代碼行數:12,代碼來源:MsSqlCeDialect.cs

示例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);
//.........這裏部分代碼省略.........
開發者ID:jlevitt,項目名稱:nhibernate-core,代碼行數:101,代碼來源:SyntheticAndFactory.cs

示例10: GetAfterSelectInsertPoint

		private static int GetAfterSelectInsertPoint(SqlString text)
		{
			if (text.StartsWithCaseInsensitive("select"))
			{
				return 6;
			}

			return -1;
		}
開發者ID:Ruhollah,項目名稱:nhibernate-core,代碼行數:9,代碼來源:FirebirdDialect.cs

示例11: StartsWithEmptyString

		public void StartsWithEmptyString()
		{
			SqlString sql = new SqlString(new string[] { "", "select", " from table" });
			Assert.IsTrue(sql.StartsWithCaseInsensitive("s"));
			Assert.IsFalse(sql.StartsWithCaseInsensitive(","));
		}
開發者ID:NikGovorov,項目名稱:nhibernate-core,代碼行數:6,代碼來源:SqlStringFixture.cs

示例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"));
		}
開發者ID:NikGovorov,項目名稱:nhibernate-core,代碼行數:6,代碼來源:SqlStringFixture.cs

示例13: IsSelectStatement

 private static bool IsSelectStatement(SqlString sqlString)
 {
     return sqlString.StartsWithCaseInsensitive("select");
 }
開發者ID:deAtog,項目名稱:nhcontrib,代碼行數:4,代碼來源:JetDriver.cs

示例14: GetAfterSelectInsertPoint

 private static int GetAfterSelectInsertPoint(SqlString sql)
 {
     if (sql.StartsWithCaseInsensitive("select distinct"))
     {
         return 15;
     }
     else if (sql.StartsWithCaseInsensitive("select"))
     {
         return 6;
     }
     return 0;
 }
開發者ID:zibler,項目名稱:zibler,代碼行數:12,代碼來源:MsSql2000Dialect.cs

示例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();
        }
開發者ID:mnjstwins,項目名稱:NHibernate.CacheDb,代碼行數:11,代碼來源:Cache71Dialect.cs


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