当前位置: 首页>>代码示例>>C#>>正文


C# SqlString.Insert方法代码示例

本文整理汇总了C#中NHibernate.SqlCommand.SqlString.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# SqlString.Insert方法的具体用法?C# SqlString.Insert怎么用?C# SqlString.Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NHibernate.SqlCommand.SqlString的用法示例。


在下文中一共展示了SqlString.Insert方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Apply

        public static SqlString Apply(SqlString sql)
        {
            if (text == null)
                return sql;
            var s = "from " + theTable;
            var index = sql.IndexOfCaseInsensitive(s);
            var indexOfSpaceAfterAlias = sql.IndexOf(" ", index + s.Length +1, sql.Length, StringComparison.InvariantCultureIgnoreCase);
            if (indexOfSpaceAfterAlias == -1)
                return sql;

            return sql.Insert(indexOfSpaceAfterAlias, text);
        }
开发者ID:ayende,项目名称:course-jul-25,代码行数:12,代码来源:Optimizations.cs

示例2: PrependComment

		private static SqlString PrependComment(SqlString sql, QueryParameters parameters)
		{
			string comment = parameters.Comment;
			if (string.IsNullOrEmpty(comment))
			{
				return sql;
			}
			else
			{
				return sql.Insert(0, "/* " + comment + " */");
			}
		}
开发者ID:remcoros,项目名称:nhibernate,代码行数:12,代码来源:Loader.cs

示例3: GetLimitString

		public override SqlString GetLimitString(SqlString querySqlString, SqlString offset, SqlString limit)
		{
			/*
			 * "SELECT TOP limit rest-of-sql-statement"
			 */

			SqlStringBuilder topFragment = new SqlStringBuilder();
			topFragment.Add(" top ");
			topFragment.Add(limit);

			return querySqlString.Insert(GetAfterSelectInsertPoint(querySqlString), topFragment.ToSqlString());
		}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:12,代码来源:MsSql2000Dialect.cs

示例4: GetLimitString

		public override SqlString GetLimitString(SqlString querySqlString, SqlString offset, SqlString limit)
		{
			var top = new SqlStringBuilder()
				.Add(" top (")
				.Add(limit)
				.Add(")")
				.ToSqlString();

			return querySqlString.Insert(GetAfterSelectInsertPoint(querySqlString), top);
		}
开发者ID:nikson,项目名称:nhibernate-core,代码行数:10,代码来源:MsSqlCeDialect.cs

示例5: GetLimitString

		/// <summary>
		/// Add a <c>LIMIT (TOP)</c> clause to the given SQL <c>SELECT</c>
		/// </summary>
		/// <param name="querySqlString">A Query in the form of a SqlString.</param>
		/// <param name="limit">Maximum number of rows to be returned by the query</param>
		/// <param name="offset">Offset of the first row to process in the result set</param>
		/// <returns>A new SqlString that contains the <c>LIMIT</c> clause.</returns>
		public override SqlString GetLimitString(SqlString querySqlString, int offset, int limit)
		{
			if (offset > 0)
			{
				throw new NotSupportedException("SQL Server does not support an offset");
			}

			/*
			 * "SELECT TOP limit rest-of-sql-statement"
			 */

			return querySqlString.Insert(GetAfterSelectInsertPoint(querySqlString), " top " + limit);
		}
开发者ID:remcoros,项目名称:nhibernate,代码行数:20,代码来源:MsSql2000Dialect.cs

示例6: GetLimitString

		public override SqlString GetLimitString(SqlString querySqlString, int offset, int limit)
		{
			int intSelectInsertPoint = GetAfterSelectInsertPoint(querySqlString);
			string strLimit = string.Format(" top {0} start at {1}", limit, offset + 1);
			return querySqlString.Insert(intSelectInsertPoint, strLimit);
		}
开发者ID:pontillo,项目名称:PowerNap,代码行数:6,代码来源:SybaseASA9Dialect.cs

示例7: GetLimitString

        public override SqlString GetLimitString(SqlString queryString, SqlString offset, SqlString limit)
		{
            // FIXME - This should use the ROWS syntax in Firebird to avoid problems with subqueries metioned here:
            // http://www.firebirdsql.org/refdocs/langrefupd20-select.html#langrefupd20-first-skip

            /*
			 * "SELECT FIRST x [SKIP y] rest-of-sql-statement"
			 */

			int insertIndex = GetAfterSelectInsertPoint(queryString);

            SqlStringBuilder limitFragment = new SqlStringBuilder();

            if (limit != null)
            {
                limitFragment.Add(" first ");
                limitFragment.Add(limit);
            }

            if (offset != null)
            {
                limitFragment.Add(" skip ");
                limitFragment.Add(offset);
			}

            return queryString.Insert(insertIndex, limitFragment.ToSqlString());
		}
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:27,代码来源:FirebirdDialect.cs

示例8: GetLimitString

		/// <summary>
		/// Add a <c>FIRST x [SKIP] y</c> clause to the given SQL <c>SELECT</c>
		/// </summary>
		/// <param name="querySqlString">A Query in the form of a SqlString.</param>
		/// <param name="limit">Maximum number of rows to be returned by the query</param>
		/// <param name="offset">Offset of the first row to process in the result set</param>
		/// <returns>A new SqlString that contains the <c>FIRST</c> clause.</returns>
		public override SqlString GetLimitString(SqlString querySqlString, int offset, int limit)
		{
			/*
			 * "SELECT FIRST x [SKIP y] rest-of-sql-statement"
			 */

			int insertIndex = GetAfterSelectInsertPoint(querySqlString);
			if (offset > 0)
			{
				return querySqlString.Insert(insertIndex, " first " + limit.ToString() + " skip " + offset.ToString());
			}
			else
			{
				return querySqlString.Insert(insertIndex, " first " + limit.ToString());
			}
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:23,代码来源:FirebirdDialect.cs

示例9: Insert

		public void Insert()
		{
			SqlString sql = new SqlString(new object[] { "begin ", Parameter.Placeholder, " end" });

			Assert.AreEqual("beginning ? end", sql.Insert(5, "ning").ToString());
			Assert.AreEqual("begin middle? end", sql.Insert(6, "middle").ToString());
			Assert.AreEqual("begin ?middle end", sql.Insert(7, "middle").ToString());
			Assert.AreEqual("beg|in ? end", sql.Insert(3, "|").ToString());
			Assert.AreEqual("begin ? ending", sql.Insert(11, "ing").ToString());
			Assert.AreEqual("begin ? enXd", sql.Insert(10, "X").ToString());
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:11,代码来源:SqlStringFixture.cs

示例10: GetLimitString

		public override SqlString GetLimitString(SqlString querySqlString, SqlString offset, SqlString limit)
		{
			var tokenEnum = new SqlTokenizer(querySqlString).GetEnumerator();
			if (!tokenEnum.TryParseUntilFirstMsSqlSelectColumn()) return null;

			int insertPoint = tokenEnum.Current.SqlIndex;
			return querySqlString.Insert(insertPoint, new SqlString("top ", limit, " "));
		}
开发者ID:marcoCasamento,项目名称:nhibernate-core,代码行数:8,代码来源:MsSql2000Dialect.cs

示例11: GetLimitString

        public override SqlString GetLimitString(SqlString queryString, SqlString offset, SqlString limit)
		{
			/*
             * "SELECT [SKIP x] FIRST y  rest-of-sql-statement"
             */

            // TODO - Check support for cases where only the offset is specified, but the limit is not.  Might need to use int.MaxValue.

			int insertIndex = GetAfterSelectInsertPoint(queryString);

            SqlStringBuilder limitFragment = new SqlStringBuilder();
            if (offset != null)
            {
                limitFragment.Add(" skip ");
                limitFragment.Add(offset);
            }
			if (limit != null)
			{
			    limitFragment.Add(" first ");
			    limitFragment.Add(limit);
			}

			return queryString.Insert(insertIndex, limitFragment.ToSqlString());
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:24,代码来源:InformixDialect.cs

示例12: GetLimitString

        public override SqlString GetLimitString(SqlString queryString, SqlString offset, SqlString limit)
        {
            if (offset != null && offset.Length != 0)
                throw new NotSupportedException("Jet Engine 4.0 does not support an offset");

            int insertIndex = GetAfterSelectInsertPoint(queryString);

            var limitFragment = new SqlStringBuilder();

            if (limit != null && limit.Length != 0)
            {
                limitFragment.Add(" TOP ");
                limitFragment.Add(limit);
            }

            return queryString.Insert(insertIndex, limitFragment.ToSqlString());
        }
开发者ID:tgmayfield,项目名称:nhibernate.jetdriver,代码行数:17,代码来源:JetDialect.cs

示例13: GetLimitString

		public override SqlString GetLimitString(SqlString querySqlString, SqlString offset, SqlString limit)
		{
			var top = new SqlString(" top (", limit, ")");
			return querySqlString.Insert(GetAfterSelectInsertPoint(querySqlString), top);
		}
开发者ID:okb,项目名称:nhibernate-core,代码行数:5,代码来源:MsSqlCeDialect.cs

示例14: GetLimitString

        public override SqlString GetLimitString(SqlString queryString, SqlString offset, SqlString limit)
		{
            int intSelectInsertPoint = GetAfterSelectInsertPoint(queryString);

            SqlStringBuilder limitFragment = new SqlStringBuilder();
            limitFragment.Add(" top ");
            if (limit != null)
                limitFragment.Add(limit);
            else
                limitFragment.Add(int.MaxValue.ToString());

            if (offset != null)
            {
                limitFragment.Add(" start at ");
                limitFragment.Add(offset);
            }

            return queryString.Insert(intSelectInsertPoint, limitFragment.ToSqlString());
		}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:19,代码来源:SybaseASA9Dialect.cs


注:本文中的NHibernate.SqlCommand.SqlString.Insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。