本文整理汇总了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 ();
}
}
}
示例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));
}