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


C# SqlString.Append方法代码示例

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


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

示例1: GetLimitString

		public override SqlString GetLimitString(SqlString querySqlString, int offset, int limit)
		{
			if (querySqlString.IndexOfCaseInsensitive(" ORDER BY ") < 0)
			{
				querySqlString = querySqlString.Append(" ORDER BY GETDATE()");
			}
			return querySqlString.Append(string.Format(" OFFSET {0} ROWS FETCH NEXT {1} ROWS ONLY", offset, limit));
		}
开发者ID:pontillo,项目名称:PowerNap,代码行数:8,代码来源:MsSqlCe40Dialect.cs

示例2: Append

		public void Append()
		{
			SqlString sql = new SqlString(new string[] { "select", " from table" });

			SqlString postAppendSql = sql.Append(" where A=B");

			Assert.IsFalse(sql == postAppendSql, "should be a new object");
			Assert.AreEqual(1, postAppendSql.Count);

			sql = postAppendSql;

			postAppendSql = sql.Append(new SqlString(" and C=D"));

			Assert.AreEqual(1, postAppendSql.Count);

			Assert.AreEqual("select from table where A=B and C=D", postAppendSql.ToString());
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:17,代码来源:SqlStringFixture.cs

示例3: Count

		public void Count()
		{
			SqlString sql =
				new SqlString(
					new object[] { "select", " from table where a = ", Parameter.Placeholder, " and b = ", Parameter.Placeholder });
			Assert.AreEqual(4, sql.Count, "Count with no nesting failed.");

			sql = sql.Append(new SqlString(new object[] { " more parts ", " another part " }));
			Assert.AreEqual(5, sql.Count, "Added a SqlString to a SqlString");
		}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:10,代码来源:SqlStringFixture.cs

示例4: ToSqlString

		/// <summary>
		/// Render the SQL fragment
		/// </summary>
		public virtual SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery)
		{
			if(projection!=null)
			{
				SqlString sb=new SqlString();
				SqlString produced = this.projection.ToSqlString(criteria, 0, criteriaQuery, new Dictionary<string, IFilter>());
				SqlString truncated = NHibernate.Util.StringHelper.RemoveAsAliasesFromSql(produced);
				sb = sb.Append(truncated);
				sb = sb.Append(ascending ? " asc" : " desc");
				return sb;
			}

			string[] columns = criteriaQuery.GetColumnAliasesUsingProjection(criteria, propertyName);

			StringBuilder fragment = new StringBuilder();

			ISessionFactoryImplementor factory = criteriaQuery.Factory;
			for (int i = 0; i < columns.Length; i++)
			{
				// TODO H3: bool lower = _ignoreCase && type.SqlTypes( factory )[ i ] == Types.VARCHAR
				bool lower = false;
				if (lower)
				{
					fragment.Append(factory.Dialect.LowercaseFunction)
						.Append("(");
				}
				fragment.Append(columns[i]);

				if (lower)
				{
					fragment.Append(")");
				}

				fragment.Append(ascending ? " asc" : " desc");

				if (i < columns.Length - 1)
				{
					fragment.Append(", ");
				}
			}

			return new SqlString(fragment.ToString());
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:46,代码来源:Order.cs

示例5: OuterJoinableAssociation

		public OuterJoinableAssociation(IAssociationType joinableType, String lhsAlias, String[] lhsColumns, String rhsAlias,
		                                JoinType joinType, SqlString withClause, ISessionFactoryImplementor factory,
		                                IDictionary<string, IFilter> enabledFilters)
		{
			this.joinableType = joinableType;
			this.lhsAlias = lhsAlias;
			this.lhsColumns = lhsColumns;
			this.rhsAlias = rhsAlias;
			this.joinType = joinType;
			joinable = joinableType.GetAssociatedJoinable(factory);
			rhsColumns = JoinHelper.GetRHSColumnNames(joinableType, factory);
			on = new SqlString(joinableType.GetOnCondition(rhsAlias, factory, enabledFilters));
			if (StringHelper.IsNotEmpty(withClause))
				on = on.Append(" and ( ").Append(withClause).Append(" )");
			this.enabledFilters = enabledFilters; // needed later for many-to-many/filter application
		}
开发者ID:tkellogg,项目名称:NHibernate3-withProxyHooks,代码行数:16,代码来源:OuterJoinableAssociation.cs

示例6: AppendIdentitySelectToInsert

		public override SqlString AppendIdentitySelectToInsert(SqlString insertString)
		{
			return insertString.Append("\nselect @@identity");
		}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:4,代码来源:SybaseASE15Dialect.cs

示例7: AddWhereFragment

		private SqlString AddWhereFragment(SqlString sql)
		{
			if (!hasWhere)
				return sql;
		    return sql.Append(" and ").Append(sqlWhereString);
		}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:6,代码来源:AbstractCollectionPersister.cs

示例8: AddIdentifierOutParameterToInsert

		public override SqlString AddIdentifierOutParameterToInsert(SqlString insertString, string identifierColumnName, string parameterName)
		{
			return insertString.Append(" returning " + identifierColumnName);
		}
开发者ID:rytmis,项目名称:nhibernate-core,代码行数:4,代码来源:PostgreSQLDialect.cs

示例9: AppendOrderByIfNeeded

		private SqlString AppendOrderByIfNeeded(SqlString sqlString)
		{
			SqlString orderByOrEmpty = queryParameters.FilteredSQL.SubstringStartingWithLast("order by");
			return sqlString.Append(orderByOrEmpty);
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:5,代码来源:SubselectFetch.cs

示例10: AddIdentitySelectToInsert

		public override SqlString AddIdentitySelectToInsert(SqlString insertSql, string identityColumn, string tableName)
		{
			return insertSql.Append("; " + GetIdentitySelectString(identityColumn, tableName));
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:4,代码来源:MsSql2000Dialect.cs

示例11: ApplyLocksToSql

 /// <summary> 
 /// Modifies the given SQL by applying the appropriate updates for the specified
 /// lock modes and key columns.
 /// </summary>
 /// <param name="sql">the SQL string to modify </param>
 /// <param name="aliasedLockModes">a map of lock modes indexed by aliased table names. </param>
 /// <param name="keyColumnNames">a map of key columns indexed by aliased table names. </param>
 /// <returns> the modified SQL string. </returns>
 /// <remarks>
 /// The behavior here is that of an ANSI SQL <tt>SELECT FOR UPDATE</tt>.  This
 /// method is really intended to allow dialects which do not support
 /// <tt>SELECT FOR UPDATE</tt> to achieve this in their own fashion.
 /// </remarks>
 public virtual SqlString ApplyLocksToSql(SqlString sql, IDictionary aliasedLockModes, IDictionary keyColumnNames)
 {
     return sql.Append(new ForUpdateFragment(this, aliasedLockModes, keyColumnNames).ToSqlStringFragment());
 }
开发者ID:aistrate,项目名称:TypingPracticeTexts,代码行数:17,代码来源:Dialect.cs

示例12: ApplyLocks

		protected override SqlString ApplyLocks( SqlString sql, IDictionary lockModes, Dialect.Dialect dialect )
		{
			if( lockModes == null || lockModes.Count == 0 )
			{
				return sql;
			}
			else 
			{
				IDictionary aliasedLockModes = new Hashtable();
				IEnumerator keys = lockModes.Keys.GetEnumerator();
				object key;
				while ( keys.MoveNext() ) 
				{
					key = keys.Current;
					aliasedLockModes.Add( GetAliasName( (String)  key ), lockModes[key] );
				}
				return sql.Append(new ForUpdateFragment(aliasedLockModes).ToSqlStringFragment(dialect));
			}
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:19,代码来源:QueryTranslator.cs

示例13: AggregateQueriesInformation

		private void AggregateQueriesInformation()
		{
			sqlString = new SqlString();
			foreach (AbstractQueryImpl query in queries)
			{
				QueryParameters queryParameters = query.GetQueryParameters();
				queryParameters.ValidateParameters();
				query.VerifyParameters();
				IQueryTranslator[] queryTranslators =
					session.GetQueries(query.ExpandParameterLists(queryParameters.NamedParameters), false);
				foreach (QueryTranslator translator in queryTranslators)
				{
					translators.Add(translator);
					parameters.Add(queryParameters);
					queryParameters = GetFilteredQueryParameters(queryParameters, translator);
					SqlCommandInfo commandInfo = translator.GetQueryStringAndTypes(session, queryParameters);
					sqlString = sqlString.Append(commandInfo.Text).Append(dialect.MultipleQueriesSeparator).Append(Environment.NewLine);
					types.AddRange(commandInfo.ParameterTypes);
				}
			}
		}
开发者ID:ray2006,项目名称:WCell,代码行数:21,代码来源:MultiQueryImpl.cs

示例14: Count

		public void Count() 
		{
			SqlString sql = new SqlString( new object[] {"select", " from table where a = ", new Parameter( "p1" ), " and b = " , new Parameter( "p2" ) } );
			Assert.AreEqual( 5, sql.Count, "Count with no nesting failed." );

			sql = sql.Append( new SqlString( new object[] {" more parts ", " another part "} ) );
			Assert.AreEqual( 7, sql.Count, "Added a SqlString to a SqlString" );

			SqlString nestedSql = new SqlString( new object[] { "nested 1", "nested 2" } );

			sql = sql.Append( new SqlString( new object[] { nestedSql, " not nested 1", " not nested 2" } ) );

			Assert.AreEqual( 11, sql.Count, "Added 2 more levels of nesting" );
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:14,代码来源:SqlStringFixture.cs

示例15: AppendIdentitySelectToInsert

		public override SqlString AppendIdentitySelectToInsert(SqlString insertSql)
		{
			return insertSql.Append("; " + IdentitySelectString);
		}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:4,代码来源:SQLiteDialect.cs


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