当前位置: 首页>>代码示例>>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;未经允许,请勿转载。