CopyToAsync
CopyToAsync returns a Task-based asynchronous version of OracleBFile.CopyTo(), which copies data from the current instance to the provided object.
Overload List:
-
CopyToAsync(Int64, OracleBlob, Int64, Int64)
This method returns a Task-based asynchronous version of
OracleBFile.CopyTo(), which copies data from the current instance to the provided object. -
CopyToAsync(Int64, OracleBlob, Int64, Int64, CancellationToken)
CopyToAsyncreturns a Task-based asynchronous version ofOracleBFile.CopyTo(), which copies data from the current instance to the provided object. -
CopyToAsync(OracleBlob, Int64)
CopyToAsyncreturns a Task-based asynchronous version ofOracleBFile.CopyTo(), which copies data from the current instance to the provided object. -
CopyToAsync(OracleBlob, Int64, CancellationToken)
CopyToAsyncreturns a Task-based asynchronous version ofOracleBFile.CopyTo(), which copies data from the current instance to the provided object. -
CopyToAsyncreturns a Task-based asynchronous version ofOracleBFile.CopyTo(), which copies data from the current instance to the provided object. -
CopyToAsync(OracleBlob, CancellationToken)
CopyToAsyncreturns a Task-based asynchronous version ofOracleBFile.CopyTo(), which copies data from the current instance to the provided object. -
CopyToAsync(Int64, OracleClob, Int64, Int64)
This method returns a Task-based asynchronous version of
OracleBFile.CopyTo(), which copies data from the current instance to the provided object. -
CopyToAsync(Int64, OracleClob, Int64, Int64, CancellationToken)
This method returns a Task-based asynchronous version of
OracleBFile.CopyTo(), which copies data from the current instance to the provided object. -
CopyToAsync(OracleClob, Int64)
This method returns a Task-based asynchronous version of
OracleBFile.CopyTo(), which copies data from the current instance to the provided object. -
CopyToAsync(OracleClob, Int64, CancellationToken)
This method returns a Task-based asynchronous version of
OracleBFile.CopyTo(), which copies data from the current instance to the provided object. -
This method returns a Task-based asynchronous version of
OracleBFile.CopyTo(), which copies data from the current instance to the provided object. -
CopyToAsync(OracleClob, CancellationToken)
This method returns a Task-based asynchronous version of
OracleBFile.CopyTo(), which copies data from the current instance to the provided object.
Example (includes all overloads)
using Oracle.ManagedDataAccess.Client;
using Oracle.ManagedDataAccess.Types;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace AsyncApp
{
class AsyncDemo
{
static async Task Main(string[] args)
{
string connectionString = "User Id=HR; Password=<PASSWORD>; Data Source=oracle;";
OracleConnection oc = new OracleConnection(connectionString);
await oc.OpenAsync(CancellationToken.None);
OracleCommand cmd = oc.CreateCommand();
cmd.CommandText = " select bfile_column from tab1";
OracleBlob blob1 = new OracleBlob(oc);
OracleBlob blob2 = new OracleBlob(oc);
OracleBlob blob3 = new OracleBlob(oc);
OracleBlob blob4 = new OracleBlob(oc);
OracleBlob blob5 = new OracleBlob(oc);
OracleBlob blob6 = new OracleBlob(oc);
OracleClob clob1 = new OracleClob(oc);
OracleClob clob2 = new OracleClob(oc);
OracleClob clob3 = new OracleClob(oc);
OracleClob clob4 = new OracleClob(oc);
OracleClob clob5 = new OracleClob(oc);
OracleClob clob6 = new OracleClob(oc);
OracleDataReader reader = await cmd.ExecuteReaderAsync();
await reader.ReadAsync(CancellationToken.None);
using (OracleBFile bfile = reader.GetOracleBFile(0))
{
//asynchronously copy bfile data
Int64 bytesCopied1 = await bfile.CopyToAsync(0, blob1, 0, bfile.Length);
Console.WriteLine("bytes copied to blob1 = " + bytesCopied1);
//asynchronously copy bfile data
Int64 bytesCopied2 = await bfile.CopyToAsync(0, blob2, 0, bfile.Length, CancellationToken.None);
Console.WriteLine("bytes copied to blob2 = " + bytesCopied2);
//asynchronously copy bfile data
Int64 bytesCopied3 = await bfile.CopyToAsync(blob3, 0);
Console.WriteLine("bytes copied to blob3 = " + bytesCopied3);
//asynchronously copy bfile data
Int64 bytesCopied4 = await bfile.CopyToAsync(blob4, 0, CancellationToken.None);
Console.WriteLine("bytes copied to blob4 = " + bytesCopied4);
//asynchronously copy bfile data
Int64 bytesCopied5 = await bfile.CopyToAsync(blob5);
Console.WriteLine("bytes copied to blob5 = " + bytesCopied5);
//asynchronously copy bfile data
Int64 bytesCopied6 = await bfile.CopyToAsync(blob6, CancellationToken.None);
Console.WriteLine("bytes copied to blob6 = " + bytesCopied6);
//asynchronously copy bfile data
bytesCopied1 = await bfile.CopyToAsync(0, clob1, 0, bfile.Length);
Console.WriteLine("bytes copied to clob1 = " + bytesCopied1);
//asynchronously copy bfile data
bytesCopied2 = await bfile.CopyToAsync(0, clob2, 0, bfile.Length, CancellationToken.None);
Console.WriteLine("bytes copied to clob2 = " + bytesCopied2);
//asynchronously copy bfile data
bytesCopied3 = await bfile.CopyToAsync(clob3, 0);
Console.WriteLine("bytes copied to clob3 = " + bytesCopied3);
//asynchronously copy bfile data
bytesCopied4 = await bfile.CopyToAsync(clob4, 0, CancellationToken.None);
Console.WriteLine("bytes copied to clob4 = " + bytesCopied4);
//asynchronously copy bfile data
bytesCopied5 = await bfile.CopyToAsync(clob5);
Console.WriteLine("bytes copied to clob5 = " + bytesCopied5);
//asynchronously copy bfile data
bytesCopied6 = await bfile.CopyToAsync(clob6, CancellationToken.None);
Console.WriteLine("bytes copied to clob6 = " + bytesCopied6);
}
}
}
}