Compare
このインスタンス・メソッドでは、2つのOracleBFile
が参照するデータを比較します。
宣言
// C# public int Compare(Int64 src_offset, OracleBFile obj, Int64 dst_offset, Int64 amount);
パラメータ
-
src_offset
現行インスタンスのオフセット
-
obj
指定された
OracleBFile
オブジェクト -
dst_offset
OracleBFile
オブジェクトのオフセット -
amount
比較するバイト数
戻り値
次の数を戻します。
-
ゼロ未満: 現行のインスタンスの
BFILE
データが指定されたBFILE
データの値より小さい場合。 -
ゼロ:どちらの
BFILE
にも同じデータが格納されている場合 -
ゼロ超過: 現行のインスタンスの
BFILE
データが指定されたBFILE
データの値より大きい場合。
例外
ObjectDisposedException
- オブジェクトはすでに処理されています。
InvalidOperationException
- OracleConnection
がオープンされていないか、またはオブジェクトの存続中にクローズされています。
ArgumentOutOfRangeException
- src_offset
、dst_offset
またはamount
が0
より小さい場合。
備考
指定されたオブジェクトと現行のインスタンスには、同じ接続を使用する必要があります。つまり、同じOracleConnection
オブジェクトを使用します。
BFILE
は、操作前にOpenFile
を使用してオープンされている必要があります。
例
// Database Setup, if you have not done so yet. /* Log on as DBA (SYS or SYSTEM) that has CREATE ANY DIRECTORY privilege. CREATE OR REPLACE DIRECTORY MYDIR AS 'C:\TEMP'; */ // C# using System; using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; class CompareSample { static void Main() { // Create MYDIR directory object as indicated previously and create a file // MyFile.txt with the text ABCDABC under C:\TEMP directory. // Note that the byte representation of the ABCDABC is 65666768656667 string constr = "User Id=scott;Password=tiger;Data Source=oracle"; OracleConnection con = new OracleConnection(constr); con.Open(); OracleBFile bFile1 = new OracleBFile(con, "MYDIR", "MyFile.txt"); OracleBFile bFile2 = new OracleBFile(con, "MYDIR", "MyFile.txt"); // Open the OracleBFiles bFile1.OpenFile(); bFile2.OpenFile(); // Compare 2 bytes from the 1st byte of bFile1 and // the 5th byte of bFile2 onwards int result = bFile1.Compare(1, bFile2, 5, 2); // Prints "result = 0" (Indicates the data is identical) Console.WriteLine("result = " + result); // Close the OracleBFiles bFile1.CloseFile(); bFile2.CloseFile(); bFile1.Close(); bFile1.Dispose(); bFile2.Close(); bFile2.Dispose(); con.Close(); con.Dispose(); } }