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


C# SqlString.Equals方法代碼示例

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


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

示例1: PrepareBatchCommand

		public IDbCommand PrepareBatchCommand(CommandType type, SqlString sql, SqlType[] parameterTypes)
		{
			/* NH:
			 * The code inside this block was added for a strange behaviour
			 * discovered using Firebird (some times for us is external issue).
			 * The problem is that batchCommandSql as a value, batchCommand is not null
			 * BUT batchCommand.CommandText is null (I don't know who clear it)
			 */
			bool forceCommandRecreate = batchCommand == null || string.IsNullOrEmpty(batchCommand.CommandText);
			/****************************************/
			if (sql.Equals(batchCommandSql) &&
				ArrayHelper.ArrayEquals(parameterTypes, batchCommandParameterTypes) && !forceCommandRecreate)
			{
				if (log.IsDebugEnabled)
				{
					log.Debug("reusing command " + batchCommand.CommandText);
				}
			}
			else
			{
				batchCommand = PrepareCommand(type, sql, parameterTypes); // calls ExecuteBatch()
				batchCommandSql = sql;
				batchCommandParameterTypes = parameterTypes;
			}

			return batchCommand;
		}
開發者ID:pallmall,項目名稱:WCell,代碼行數:27,代碼來源:AbstractBatcher.cs

示例2: RestoreMissingParameters

        private void RestoreMissingParameters(SqlString originalSQL, ref SqlString transformedSQL)
        {
            if (originalSQL.Equals(transformedSQL))
            {
                return;
            }

            var parametersOriginal = new ArrayList();
            var parametersTransformed = new ArrayList();

            foreach (var part in originalSQL)
            {
                if (part is Parameter)
                {
                    parametersOriginal.Add(part);
                }
            }

            foreach (var part in transformedSQL)
            {
                if (part is Parameter)
                {
                    parametersTransformed.Add(part);
                }
            }

            //same number of parameters , return
            if (parametersOriginal.Count == parametersTransformed.Count)
            {
                return;
            }

            //fix missing parameters spliting around '?'
            var sqlText = transformedSQL.ToString();
            Regex regex = new Regex("@x\\d+",
                                    RegexOptions.IgnoreCase
                                    | RegexOptions.CultureInvariant
                                    );

            var parametersParts = regex.Split(sqlText);

            //parametersParts = sqlText.Split('?');

            if ((parametersParts.Length - 1) != parametersOriginal.Count)
            {
                //can't restore
                throw new QueryException("FinalizeJoins JetDriver removed SQL parameteres and can not be restored");
            }

            var sqlBuilder = new SqlStringBuilder();

            for (int i = 0; i < parametersParts.Length; i++)
            {
                if (i > 0)
                {
                    sqlBuilder.AddObject(parametersOriginal[i - 1]);
                }

                sqlBuilder.Add(parametersParts[i]);
            }

            transformedSQL = sqlBuilder.ToSqlString();
        }
開發者ID:deAtog,項目名稱:nhcontrib,代碼行數:63,代碼來源:JetDriver.cs

示例3: PrepareBatchCommand

		public IDbCommand PrepareBatchCommand(CommandType type, SqlString sql, SqlType[] parameterTypes)
		{
			if (sql.Equals(batchCommandSql) &&
				ArrayHelper.ArrayEquals(parameterTypes, batchCommandParameterTypes))
			{
				if (log.IsDebugEnabled)
				{
					log.Debug("reusing command " + batchCommand.CommandText);
				}
			}
			else
			{
				batchCommand = PrepareCommand(type, sql, parameterTypes); // calls ExecuteBatch()
				batchCommandSql = sql;
				batchCommandParameterTypes = parameterTypes;
			}

			return batchCommand;
		}
開發者ID:Novthirteen,項目名稱:sconit_timesseiko,代碼行數:19,代碼來源:BatcherImpl.cs

示例4: PrepareBatchCommand

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sql"></param>
		/// <returns></returns>
		public IDbCommand PrepareBatchCommand( SqlString sql )
		{
			if( !sql.Equals( batchCommandSql ) )
			{
				batchCommand = PrepareCommand( sql ); // calls ExecuteBatch()
				batchCommandSql = sql;
			} 
			else 
			{
				if( log.IsDebugEnabled )
				{
					log.Debug( "reusing command " + batchCommand.CommandText );
				}
			}

			return batchCommand;
		}
開發者ID:rcarrillopadron,項目名稱:nhibernate-1.0.2.0,代碼行數:22,代碼來源:BatcherImpl.cs


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