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