Write(char[ ], int, int)
このインスタンス・メソッドでは、指定された文字配列バッファからOracleClobにデータを書き込みます。
宣言
// C# public void Write(char[ ] buffer, int offset, int count);
パラメータ
-
bufferOracleClobに書き込まれた文字配列バッファ -
offsetbufferの読取り元のオフセット(文字) -
countOracleClobに書き込まれるバッファ数(文字)
例外
ObjectDisposedException - オブジェクトはすでに処理されています。
InvalidOperationException - OracleConnectionがオープンされていないか、またはオブジェクトの存続中にクローズされています。
ArgumentOutOfRangeException - この例外は次のいずれかの条件が存在する場合に表示されます。
-
offsetまたはcountが0未満の場合 -
offsetがbuffer.Length以上である場合 -
offsetおよびcountの合計がbuffer.Lengthより大きい場合 -
Positionが偶数でない場合
備考
すべてのCLOBおよびNCLOBデータをUnicodeとして処理します。
LOBデータの読取りは、Positionプロパティにより指定された位置から開始されます。
必要に応じて、クライアント文字セットからデータベース文字セットに適切なデータ変換が行われます。
例
// C#
using System;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
class WriteSample
{
static void Main()
{
string constr = "User Id=scott;Password=tiger;Data Source=oracle";
OracleConnection con = new OracleConnection(constr);
con.Open();
OracleClob clob = new OracleClob(con);
// Set the Position for the Write;
clob.Position = 0;
// Begin ChunkWrite to improve performance
// Index updates occur only once after EndChunkWrite
clob.BeginChunkWrite();
// Write to the OracleClob in 5 chunks of 2 chars each
char[] c = new char[2] {'a', 'b'};
for (int index = 0; index < 5; index++)
{
clob.Write(c, 0, c.Length);
}
clob.EndChunkWrite();
// Prints "clob.Value = ababababab"
Console.WriteLine("clob.Value = " + clob.Value);
clob.Close();
clob.Dispose();
con.Close();
con.Dispose();
}
}