using System.IO;
using System.Text;
-namespace System.Data.OracleClient {
+namespace System.Data.OracleClient
+{
public sealed class OracleLob : Stream, ICloneable, IDisposable, INullable
{
#region Fields
public static readonly new OracleLob Null = new OracleLob ();
internal OracleConnection connection;
- bool isBatched = false;
+ bool isBatched;
bool isOpen = true;
- bool notNull = false;
+ bool notNull;
OciLobLocator locator;
OracleType type;
long length = -1;
- long position = 0;
+ long position;
#endregion // Fields
public int ChunkSize {
[MonoTODO]
- get {
+ get {
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
return locator.GetChunkSize ();
}
public bool IsTemporary {
- get {
+ get {
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
throw new NotImplementedException ();
}
public override long Length {
- get {
+ get {
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
if (length >= 0)
}
public override long Position {
- get {
+ get {
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
return position;
}
public object Value {
- get {
+ get {
AssertObjectNotDisposed ();
if (IsNull)
return DBNull.Value;
if (len == 0) {
// LOB is not Null, but it is Empty
if (LobType == OracleType.Clob)
- return "";
+ return string.Empty;
else // OracleType.Blob
return new byte[0];
}
Read (buffer, 0, len);
UnicodeEncoding encoding = new UnicodeEncoding ();
return encoding.GetString (buffer);
- }
- else {
+ } else {
// OracleType.Blob
buffer = new byte [len];
Read (buffer, 0, len);
#region Methods
[MonoTODO]
- public void Append (OracleLob source)
+ public void Append (OracleLob source)
{
if (source.IsNull)
throw new ArgumentNullException ();
throw new NotImplementedException ();
}
+#if !NET_2_0
[MonoTODO]
public override void Close ()
{
- locator.Dispose ();
+ Dispose (true);
+ }
+
+ [MonoTODO]
+ public void Dispose ()
+ {
+ this.Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+#endif
+
+#if NET_2_0
+ protected override
+#endif
+ void Dispose (bool disposing)
+ {
+ if (disposing) {
+ if (locator != null)
+ locator.Dispose ();
+ }
+ locator = null;
isOpen = false;
}
return (long) locator.Copy (destination.Locator, (uint) amount, (uint) destinationOffset + 1, (uint) sourceOffset + 1);
}
- [MonoTODO]
- public void Dispose ()
- {
- throw new NotImplementedException ();
- }
-
public void EndBatch ()
{
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
int bytesRead;
- byte[] output = new byte[count];
+ byte[] output = new byte [count];
bytesRead = locator.Read (output, (uint) Position + 1, (uint) count, LobType == OracleType.Blob);
output.CopyTo (buffer, offset);