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


C# Future.GetNextResult方法代码示例

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


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

示例1: Enlist

		public override void Enlist (object distributedTransaction)
		{
			ITransaction transaction = (ITransaction) distributedTransaction;
			if (transaction == null)
			{
				Future future = new Future (Service.TransactionEnlist, (int) DtpFlags.SQL_TP_UNENLIST, null);
				object result = null;
				try
				{
					futures.Add (future);
					future.SendRequest (Session);
					result = future.GetNextResult (Session, futures);
				}
				finally
				{
					futures.Remove (future);
				}
				if (result != null && result is object[])
				{
					object[] results = (object[]) result;
					errors.AddServerError ((string) results[1], null, (string) results[2]);
					Diagnostics.HandleErrors (CLI.ReturnCode.SQL_ERROR, this);
				}
			}
			else
			{
				byte[] whereabouts = GetServerDtcWhereabouts ();
				DTC.ITransactionExport export = DTC.GetTransactionExport (transaction, whereabouts);
				byte[] cookie = DTC.GetTransactionCookie (transaction, export);
				string cookie_encoded = Encode (cookie);

				ManagedCommand cmd = new ManagedCommand (this);
				cmd.SetParameters (null);
				try
				{
					cmd.Execute ("select mts_enlist_transaction('" + cookie_encoded + "')");
					if (cmd.Fetch ())
					{
						autocommit = false;
					}
				}
				finally
				{
					cmd.CloseCursor (true);
					cmd.Dispose ();
				}
			}
		}
开发者ID:kgardas,项目名称:virtuoso-opensource,代码行数:48,代码来源:ManagedConnection.cs

示例2: EndTransaction

		public override void EndTransaction (bool commit)
		{
		        Debug.WriteLineIf (CLI.FnTrace.Enabled, String.Format (
			      "ManagedConnection.EndTransaction ({0})", commit));
			  CLI.CompletionType completion = commit ? 
			      CLI.CompletionType.SQL_COMMIT : 
			      CLI.CompletionType.SQL_ROLLBACK;
			  Future future = new Future (
			      Service.Transaction, (int) completion, null);
			  object result = null;
			  try 
			  {
			 	  futures.Add (future);
				  future.SendRequest (Session);
				  result = future.GetNextResult (Session, futures);
				  Debug.WriteLineIf (CLI.FnTrace.Enabled, String.Format (
				      "ManagedConnection.EndTransaction ({0}) success", commit));
			  }
			  finally
			  {
				  futures.Remove (future);
			  }
			  if (result is object[])
			  {
			    Debug.WriteLineIf (CLI.FnTrace.Enabled, String.Format (
				"ManagedConnection.EndTransaction ({0}) error", commit));
				  object[] results = (object[]) result;
				  errors.AddServerError ((string) results[1], null, (string) results[2]);
				  Diagnostics.HandleErrors (CLI.ReturnCode.SQL_ERROR, this);
			  }

			autocommit = true;
			isolation = CLI.IsolationLevel.SQL_TXN_READ_COMMITED;
		        Debug.WriteLineIf (CLI.FnTrace.Enabled, String.Format (
			      "ManagedConnection.EndTransaction ({0}) done", commit));
		}
开发者ID:kgardas,项目名称:virtuoso-opensource,代码行数:36,代码来源:ManagedConnection.cs


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