Exemplo n.º 1
0
		[Test] // ctor (Int64)
		public void Constructor1 ()
		{
			OracleTimeSpan ots;
			TimeSpan ts;
			
			ts = new TimeSpan (29, 7, 34, 58, 200);
			ots = new OracleTimeSpan (ts.Ticks);
			Assert.AreEqual (ts.Days, ots.Days, "#A1");
			Assert.AreEqual (ts.Hours, ots.Hours, "#A2");
			Assert.IsFalse (ots.IsNull, "#A3");
			Assert.AreEqual (ts.Milliseconds, ots.Milliseconds, "#A4");
			Assert.AreEqual (ts.Minutes, ots.Minutes, "#A5");
			Assert.AreEqual (ts.Seconds, ots.Seconds, "#A6");
			Assert.AreEqual (ts, ots.Value, "#A7");
			Assert.AreEqual (ts.ToString (), ots.ToString (), "#A8");

			ts = new TimeSpan (0L);
			ots = new OracleTimeSpan (0L);
			Assert.AreEqual (ts.Days, ots.Days, "#B1");
			Assert.AreEqual (ts.Hours, ots.Hours, "#B2");
			Assert.IsFalse (ots.IsNull, "#B3");
			Assert.AreEqual (ts.Milliseconds, ots.Milliseconds, "#B4");
			Assert.AreEqual (ts.Minutes, ots.Minutes, "#B5");
			Assert.AreEqual (ts.Seconds, ots.Seconds, "#B6");
			Assert.AreEqual (ts, ots.Value, "#B7");
			Assert.AreEqual (ts.ToString (), ots.ToString (), "#B8");
		}
Exemplo n.º 2
0
		public OracleTimeSpan (OracleTimeSpan from)
		{
			if (from.IsNull)
				throw new NullReferenceException ();
			value = from.value;
			notNull = true;
		}
Exemplo n.º 3
0
        public int CompareTo(object obj)
        {
            OracleTimeSpan o = (OracleTimeSpan)obj;

            if (obj == null)
            {
                throw new NullReferenceException("Object reference not set to an instance of an object");
            }
            else if (!(obj is OracleTimeSpan))
            {
                throw new ArgumentException("Value is not a System.Data.OracleClient.OracleTimeSpan", obj.ToString());
            }
            else if (o.IsNull && this.IsNull)
            {
                return(0);
            }
            else if (o.IsNull && !(this.IsNull))
            {
                return(1);
            }
            else
            {
                return(value.CompareTo(o.Value));
            }
        }
Exemplo n.º 4
0
 public static OracleBoolean GreaterThan(OracleTimeSpan x, OracleTimeSpan y)
 {
     if (x.IsNull || y.IsNull)
     {
         return(OracleBoolean.Null);
     }
     return(x.Value > y.Value);
 }
Exemplo n.º 5
0
 public static OracleBoolean NotEquals(OracleTimeSpan x, OracleTimeSpan y)
 {
     if (x.IsNull || y.IsNull)
     {
         return(OracleBoolean.Null);
     }
     return(x.Value != y.Value);
 }
Exemplo n.º 6
0
 public static OracleBoolean Equals(OracleTimeSpan x, OracleTimeSpan y)
 {
     if (x.IsNull || y.IsNull)
     {
         return(OracleBoolean.Null);
     }
     return(new OracleBoolean(x.Value == y.Value));
 }
Exemplo n.º 7
0
 public static OracleBoolean LessThanOrEqual(OracleTimeSpan x, OracleTimeSpan y)
 {
     if (x.IsNull || y.IsNull)
     {
         return(OracleBoolean.Null);
     }
     return(x.Value <= y.Value);
 }
Exemplo n.º 8
0
 public OracleTimeSpan(OracleTimeSpan from)
 {
     if (from.IsNull)
     {
         throw new NullReferenceException();
     }
     value   = from.value;
     notNull = true;
 }
Exemplo n.º 9
0
        ////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////
        //
        // Methods
        //
        ////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////

        /// <include file='doc\OracleTimeSpan.uex' path='docs/doc[@for="OracleTimeSpan.CompareTo"]/*' />
        public int CompareTo(
            object obj
            )
        {
            if (obj.GetType() == typeof(OracleTimeSpan))
            {
                OracleTimeSpan odt = (OracleTimeSpan)obj;

                // If both values are Null, consider them equal.
                // Otherwise, Null is less than anything.
                if (IsNull)
                {
                    return(odt.IsNull ? 0  : -1);
                }

                if (odt.IsNull)
                {
                    return(1);
                }

                // Neither value is null, do the comparison.

                int days1, hours1, minutes1, seconds1, fsecs1;
                int days2, hours2, minutes2, seconds2, fsecs2;

                Unpack(_value, out days1, out hours1, out minutes1, out seconds1, out fsecs1);
                Unpack(odt._value, out days2, out hours2, out minutes2, out seconds2, out fsecs2);

                int delta;

                delta = (days1 - days2);                if (0 != delta)
                {
                    return(delta);
                }
                delta = (hours1 - hours2);              if (0 != delta)
                {
                    return(delta);
                }
                delta = (minutes1 - minutes2);  if (0 != delta)
                {
                    return(delta);
                }
                delta = (seconds1 - seconds2);  if (0 != delta)
                {
                    return(delta);
                }
                delta = (fsecs1 - fsecs2);              if (0 != delta)
                {
                    return(delta);
                }
                return(0);
            }

            // Wrong type!
            throw ADP.Argument();
        }
Exemplo n.º 10
0
 internal TimeSpan GetTimeSpan(NativeBuffer_RowBuffer buffer)
 {
     if (typeof(TimeSpan) != this._metaType.BaseType)
     {
         throw System.Data.Common.ADP.InvalidCast();
     }
     if (this.IsDBNull(buffer))
     {
         throw System.Data.Common.ADP.DataReaderNoData();
     }
     return(OracleTimeSpan.MarshalToTimeSpan(buffer, this._valueOffset));
 }
Exemplo n.º 11
0
		[Test] // ctor (OracleTimeSpan)
		public void Constructor2 ()
		{
			TimeSpan ts = new TimeSpan (29, 7, 34, 58, 200);

			OracleTimeSpan ots = new OracleTimeSpan (new OracleTimeSpan (ts));
			Assert.AreEqual (ts.Days, ots.Days, "#1");
			Assert.AreEqual (ts.Hours, ots.Hours, "#2");
			Assert.IsFalse (ots.IsNull, "#3");
			Assert.AreEqual (ts.Milliseconds, ots.Milliseconds, "#4");
			Assert.AreEqual (ts.Minutes, ots.Minutes, "#5");
			Assert.AreEqual (ts.Seconds, ots.Seconds, "#6");
			Assert.AreEqual (ts, ots.Value, "#7");
			Assert.AreEqual (ts.ToString (), ots.ToString (), "#8");
		}
Exemplo n.º 12
0
 public override bool Equals(object value)
 {
     if (value is OracleTimeSpan)
     {
         OracleTimeSpan t = (OracleTimeSpan)value;
         if (!(this.IsNull) && !(t.IsNull))
         {
             return(this.value == t.value);
         }
         else
         {
             throw new InvalidOperationException("The value is null");
         }
     }
     return(false);
 }
Exemplo n.º 13
0
		public static OracleBoolean LessThanOrEqual (OracleTimeSpan x, OracleTimeSpan y)
		{
			if (x.IsNull || y.IsNull)
				return OracleBoolean.Null;
			return (x.Value <= y.Value);
		}
        internal int PutOracleValue(
            object value,
            HandleRef valueBuffer,
            MetaType metaType,
            OracleConnection connection
            )
        {
            //  writes the managed object into the buffer in the appropriate
            //  native Oracle format.

            OCI.DATATYPE    ociType = metaType.OciType;
            int             dataSize;
            OracleParameter parameter = Parameter;

            switch (ociType)
            {
            case OCI.DATATYPE.FLOAT:
            case OCI.DATATYPE.INTEGER:
            case OCI.DATATYPE.UNSIGNEDINT:
                Marshal.StructureToPtr(value, (IntPtr)valueBuffer, false);
                dataSize = metaType.BindSize;
                break;

            case OCI.DATATYPE.RAW:
            case OCI.DATATYPE.LONGRAW:
            case OCI.DATATYPE.LONGVARRAW:
                dataSize = OracleBinary.MarshalToNative(value, parameter.Offset, parameter.Size, valueBuffer, ociType);
                break;

            case OCI.DATATYPE.DATE:
            case OCI.DATATYPE.INT_TIMESTAMP:
            case OCI.DATATYPE.INT_TIMESTAMP_TZ:
            case OCI.DATATYPE.INT_TIMESTAMP_LTZ:
                dataSize = OracleDateTime.MarshalToNative(value, valueBuffer, ociType);
                break;

            case OCI.DATATYPE.BFILE:
                // We cannot construct lobs; if you want to bind a lob, you have to have
                // a lob.
                if (!(value is OracleBFile))
                {
                    throw ADP.BadBindValueType(value.GetType(), metaType.OracleType);
                }

                Marshal.WriteIntPtr((IntPtr)valueBuffer, (IntPtr)((OracleBFile)value).Descriptor.Handle);
                dataSize = IntPtr.Size;
                break;

            case OCI.DATATYPE.BLOB:
            case OCI.DATATYPE.CLOB:
                // We cannot construct lobs; if you want to bind a lob, you have to have
                // a lob.
                if (!(value is OracleLob))
                {
                    throw ADP.BadBindValueType(value.GetType(), metaType.OracleType);
                }

                // If you don't disable the buffering, you'll cause the PL/SQL code that
                // uses this LOB to have problems doing things like DBMS_LOB.GET_LENGTH()
                ((OracleLob)value).EnsureBuffering(false);

                Marshal.WriteIntPtr((IntPtr)valueBuffer, (IntPtr)((OracleLob)value).Descriptor.Handle);
                dataSize = IntPtr.Size;
                break;

            case OCI.DATATYPE.INT_INTERVAL_YM:
                dataSize = OracleMonthSpan.MarshalToNative(value, valueBuffer);
                break;

            case OCI.DATATYPE.VARNUM:
                dataSize = OracleNumber.MarshalToNative(value, valueBuffer, connection);
                break;

            case OCI.DATATYPE.CHAR:
            case OCI.DATATYPE.VARCHAR2:
            case OCI.DATATYPE.LONG:
            case OCI.DATATYPE.LONGVARCHAR:
                dataSize = OracleString.MarshalToNative(value, parameter.Offset, parameter.Size, valueBuffer, ociType, _bindAsUCS2);
                break;

            case OCI.DATATYPE.INT_INTERVAL_DS:
                dataSize = OracleTimeSpan.MarshalToNative(value, valueBuffer);
                break;

            default:
                throw ADP.TypeNotSupported(ociType);
            }

            Debug.Assert(dataSize <= _bufferLengthInBytes, String.Format("Internal Error: Exceeded Internal Buffer.  DataSize={0} BufferLength={1}", dataSize, _bufferLengthInBytes));
            return(dataSize);
        }
 public static OracleBoolean LessThan(OracleTimeSpan x, OracleTimeSpan y)
 {
     return (x < y);
 }
        public int CompareTo(object obj)
        {
            int num2;
            int num3;
            int num4;
            int num5;
            int num6;
            int num7;
            int num8;
            int num9;
            int num10;
            int num11;

            if (!(obj.GetType() == typeof(OracleTimeSpan)))
            {
                throw System.Data.Common.ADP.WrongType(obj.GetType(), typeof(OracleTimeSpan));
            }
            OracleTimeSpan span = (OracleTimeSpan)obj;

            if (this.IsNull)
            {
                if (!span.IsNull)
                {
                    return(-1);
                }
                return(0);
            }
            if (span.IsNull)
            {
                return(1);
            }
            Unpack(this._value, out num11, out num10, out num9, out num8, out num7);
            Unpack(span._value, out num6, out num5, out num4, out num3, out num2);
            int num = num11 - num6;

            if (num != 0)
            {
                return(num);
            }
            num = num10 - num5;
            if (num != 0)
            {
                return(num);
            }
            num = num9 - num4;
            if (num != 0)
            {
                return(num);
            }
            num = num8 - num3;
            if (num != 0)
            {
                return(num);
            }
            num = num7 - num2;
            if (num != 0)
            {
                return(num);
            }
            return(0);
        }
        internal object GetOutputValue(
            NativeBuffer parameterBuffer,
            OracleConnection connection,                // connection, so we can create LOB values
            bool needCLSType
            )
        {
            object result;

            //  Returns an object that contains the value of the column in the
            //  specified row buffer.  This method returns Oracle-typed objects.

            if (Marshal.ReadInt16((IntPtr)parameterBuffer.Ptr, _indicatorOffset) == (Int16)OCI.INDICATOR.ISNULL)
            {
                return(DBNull.Value);
            }

            switch (_bindingMetaType.OciType)
            {
            case OCI.DATATYPE.FLOAT:
            case OCI.DATATYPE.INTEGER:
            case OCI.DATATYPE.UNSIGNEDINT:
                result = Marshal.PtrToStructure((IntPtr)parameterBuffer.PtrOffset(_valueOffset), _bindingMetaType.BaseType);
                return(result);

            case OCI.DATATYPE.BFILE:
                result = new OracleBFile(_locator);
                return(result);

            case OCI.DATATYPE.RAW:
            case OCI.DATATYPE.LONGRAW:
            case OCI.DATATYPE.LONGVARRAW:
                result = new OracleBinary(parameterBuffer, _valueOffset, _lengthOffset, _bindingMetaType);
                if (needCLSType)
                {
                    object newresult = ((OracleBinary)result).Value;
                    result = newresult;
                }
                return(result);

            case OCI.DATATYPE.RSET:
                result = new OracleDataReader(connection, _descriptor);
                return(result);

            case OCI.DATATYPE.DATE:
            case OCI.DATATYPE.INT_TIMESTAMP:
            case OCI.DATATYPE.INT_TIMESTAMP_TZ:
            case OCI.DATATYPE.INT_TIMESTAMP_LTZ:
                result = new OracleDateTime(parameterBuffer, _valueOffset, _bindingMetaType, connection);
                if (needCLSType)
                {
                    object newresult = ((OracleDateTime)result).Value;
                    result = newresult;
                }
                return(result);

            case OCI.DATATYPE.BLOB:
            case OCI.DATATYPE.CLOB:
                result = new OracleLob(_locator);
                return(result);

            case OCI.DATATYPE.INT_INTERVAL_YM:
                result = new OracleMonthSpan(parameterBuffer, _valueOffset);
                if (needCLSType)
                {
                    object newresult = ((OracleMonthSpan)result).Value;
                    result = newresult;
                }
                return(result);

            case OCI.DATATYPE.VARNUM:
                result = new OracleNumber(parameterBuffer, _valueOffset);
                if (needCLSType)
                {
                    object newresult = ((OracleNumber)result).Value;
                    result = newresult;
                }
                return(result);

            case OCI.DATATYPE.CHAR:
            case OCI.DATATYPE.VARCHAR2:
            case OCI.DATATYPE.LONG:
            case OCI.DATATYPE.LONGVARCHAR:
                result = new OracleString(parameterBuffer,
                                          _valueOffset,
                                          _lengthOffset,
                                          _bindingMetaType,
                                          connection,
                                          _bindAsUCS2,
                                          true
                                          );
                int size = _parameter.Size;
                if (0 != size && size < ((OracleString)result).Length)
                {
                    string truncatedResult = ((OracleString)result).Value.Substring(0, size);
                    if (needCLSType)
                    {
                        result = truncatedResult;
                    }
                    else
                    {
                        result = new OracleString(truncatedResult);
                    }
                }
                else if (needCLSType)
                {
                    object newresult = ((OracleString)result).Value;
                    result = newresult;
                }
                return(result);

            case OCI.DATATYPE.INT_INTERVAL_DS:
                result = new OracleTimeSpan(parameterBuffer, _valueOffset);
                if (needCLSType)
                {
                    object newresult = ((OracleTimeSpan)result).Value;
                    result = newresult;
                }
                return(result);
            }
            throw ADP.TypeNotSupported(_bindingMetaType.OciType);
        }
 public static OracleBoolean NotEquals(OracleTimeSpan x, OracleTimeSpan y)
 {
     return (x != y);
 }
 public static OracleBoolean LessThanOrEqual(OracleTimeSpan x, OracleTimeSpan y)
 {
     return (x <= y);
 }
Exemplo n.º 20
0
		public OracleTimeSpan (OracleTimeSpan from)
			: this (from.Value)
		{
		}
 public static OracleBoolean GreaterThanOrEqual(OracleTimeSpan x, OracleTimeSpan y)
 {
     return (x >= y);
 }
 public OracleTimeSpan(OracleTimeSpan from)
 {
     this._value = new byte[from._value.Length];
     from._value.CopyTo(this._value, 0);
 }
 public static OracleBoolean GreaterThan(OracleTimeSpan x, OracleTimeSpan y)
 {
     return(x > y);
 }
 public static OracleBoolean GreaterThanOrEqual(OracleTimeSpan x, OracleTimeSpan y)
 {
     return(x >= y);
 }
 public static OracleBoolean LessThanOrEqual(OracleTimeSpan x, OracleTimeSpan y)
 {
     return(x <= y);
 }
 public static OracleBoolean LessThan(OracleTimeSpan x, OracleTimeSpan y)
 {
     return(x < y);
 }
 public static OracleBoolean NotEquals(OracleTimeSpan x, OracleTimeSpan y)
 {
     return(x != y);
 }
 static OracleTimeSpan()
 {
     MaxValue = new OracleTimeSpan(TimeSpan.MaxValue);
     MinValue = new OracleTimeSpan(TimeSpan.MinValue);
     Null = new OracleTimeSpan(true);
 }
 static OracleTimeSpan()
 {
     MaxValue = new OracleTimeSpan(TimeSpan.MaxValue);
     MinValue = new OracleTimeSpan(TimeSpan.MinValue);
     Null     = new OracleTimeSpan(true);
 }
 public OracleTimeSpan(OracleTimeSpan from)
 {
     this._value = new byte[from._value.Length];
     from._value.CopyTo(this._value, 0);
 }
Exemplo n.º 31
0
		public static OracleBoolean GreaterThan (OracleTimeSpan x, OracleTimeSpan y)
		{
			if (x.IsNull || y.IsNull)
				return OracleBoolean.Null;
			return (x.Value > y.Value);
		}
        internal object GetOutputValue(NativeBuffer parameterBuffer, OracleConnection connection, bool needCLSType)
        {
            object obj2;

            if (parameterBuffer.ReadInt16(this._indicatorOffset) == -1)
            {
                return(DBNull.Value);
            }
            switch (this._bindingMetaType.OciType)
            {
            case OCI.DATATYPE.VARCHAR2:
            case OCI.DATATYPE.LONG:
            case OCI.DATATYPE.LONGVARCHAR:
            case OCI.DATATYPE.CHAR:
            {
                obj2 = new OracleString(parameterBuffer, this._valueOffset, this._lengthOffset, this._bindingMetaType, connection, this._bindAsUCS2, true);
                int size = this._parameter.Size;
                if (size != 0)
                {
                    OracleString str4 = (OracleString)obj2;
                    if (size < str4.Length)
                    {
                        OracleString str3 = (OracleString)obj2;
                        string       s    = str3.Value.Substring(0, size);
                        if (needCLSType)
                        {
                            return(s);
                        }
                        return(new OracleString(s));
                    }
                }
                if (needCLSType)
                {
                    OracleString str2 = (OracleString)obj2;
                    obj2 = str2.Value;
                }
                return(obj2);
            }

            case OCI.DATATYPE.INTEGER:
            case OCI.DATATYPE.FLOAT:
            case OCI.DATATYPE.UNSIGNEDINT:
                return(parameterBuffer.PtrToStructure(this._valueOffset, this._bindingMetaType.BaseType));

            case OCI.DATATYPE.VARNUM:
                obj2 = new OracleNumber(parameterBuffer, this._valueOffset);
                if (needCLSType)
                {
                    OracleNumber number = (OracleNumber)obj2;
                    obj2 = number.Value;
                }
                return(obj2);

            case OCI.DATATYPE.DATE:
                obj2 = new OracleDateTime(parameterBuffer, this._valueOffset, this._lengthOffset, this._bindingMetaType, connection);
                if (needCLSType)
                {
                    OracleDateTime time2 = (OracleDateTime)obj2;
                    obj2 = time2.Value;
                }
                return(obj2);

            case OCI.DATATYPE.RAW:
            case OCI.DATATYPE.LONGRAW:
            case OCI.DATATYPE.LONGVARRAW:
                obj2 = new OracleBinary(parameterBuffer, this._valueOffset, this._lengthOffset, this._bindingMetaType);
                if (needCLSType)
                {
                    OracleBinary binary = (OracleBinary)obj2;
                    obj2 = binary.Value;
                }
                return(obj2);

            case OCI.DATATYPE.CLOB:
            case OCI.DATATYPE.BLOB:
                return(new OracleLob(this._locator));

            case OCI.DATATYPE.BFILE:
                return(new OracleBFile(this._locator));

            case OCI.DATATYPE.RSET:
                return(new OracleDataReader(connection, this._descriptor));

            case OCI.DATATYPE.INT_TIMESTAMP:
            case OCI.DATATYPE.INT_TIMESTAMP_TZ:
            case OCI.DATATYPE.INT_TIMESTAMP_LTZ:
                obj2 = new OracleDateTime(this._dateTimeDescriptor, this._bindingMetaType, connection);
                if (needCLSType)
                {
                    OracleDateTime time = (OracleDateTime)obj2;
                    obj2 = time.Value;
                }
                return(obj2);

            case OCI.DATATYPE.INT_INTERVAL_YM:
                obj2 = new OracleMonthSpan(parameterBuffer, this._valueOffset);
                if (needCLSType)
                {
                    OracleMonthSpan span2 = (OracleMonthSpan)obj2;
                    obj2 = span2.Value;
                }
                return(obj2);

            case OCI.DATATYPE.INT_INTERVAL_DS:
                obj2 = new OracleTimeSpan(parameterBuffer, this._valueOffset);
                if (needCLSType)
                {
                    OracleTimeSpan span = (OracleTimeSpan)obj2;
                    obj2 = span.Value;
                }
                return(obj2);
            }
            throw System.Data.Common.ADP.TypeNotSupported(this._bindingMetaType.OciType);
        }
Exemplo n.º 33
0
		public static OracleBoolean NotEquals (OracleTimeSpan x, OracleTimeSpan y)
		{
			if (x.IsNull || y.IsNull)
				return OracleBoolean.Null;
			return (x.Value != y.Value);
		}
        internal int PutOracleValue(object value, NativeBuffer buffer, int bufferOffset, MetaType metaType, OracleConnection connection, ref SafeHandle handleToBind)
        {
            handleToBind = null;
            OCI.DATATYPE    ociType   = metaType.OciType;
            OracleParameter parameter = this.Parameter;

            switch (ociType)
            {
            case OCI.DATATYPE.VARCHAR2:
            case OCI.DATATYPE.LONG:
            case OCI.DATATYPE.LONGVARCHAR:
            case OCI.DATATYPE.CHAR:
                return(OracleString.MarshalToNative(value, parameter.Offset, parameter.GetActualSize(), buffer, bufferOffset, ociType, this._bindAsUCS2));

            case OCI.DATATYPE.INTEGER:
            case OCI.DATATYPE.FLOAT:
            case OCI.DATATYPE.UNSIGNEDINT:
                buffer.StructureToPtr(bufferOffset, value);
                return(metaType.BindSize);

            case OCI.DATATYPE.VARNUM:
                return(OracleNumber.MarshalToNative(value, buffer, bufferOffset, connection));

            case OCI.DATATYPE.DATE:
                return(OracleDateTime.MarshalDateToNative(value, buffer, bufferOffset, ociType, connection));

            case OCI.DATATYPE.RAW:
            case OCI.DATATYPE.LONGRAW:
            case OCI.DATATYPE.LONGVARRAW:
            {
                int    num;
                byte[] buffer2;
                if (this._coercedValue is OracleBinary)
                {
                    OracleBinary binary = (OracleBinary)this._coercedValue;
                    buffer2 = binary.Value;
                }
                else
                {
                    buffer2 = (byte[])this._coercedValue;
                }
                int num2       = buffer2.Length - parameter.Offset;
                int actualSize = parameter.GetActualSize();
                if (actualSize != 0)
                {
                    num2 = Math.Min(num2, actualSize);
                }
                if (OCI.DATATYPE.LONGVARRAW == ociType)
                {
                    buffer.WriteInt32(bufferOffset, num2);
                    bufferOffset += 4;
                    num           = num2 + 4;
                }
                else
                {
                    num = num2;
                }
                buffer.WriteBytes(bufferOffset, buffer2, parameter.Offset, num2);
                return(num);
            }

            case OCI.DATATYPE.CLOB:
            case OCI.DATATYPE.BLOB:
                if (!(value is OracleLob))
                {
                    throw System.Data.Common.ADP.BadBindValueType(value.GetType(), metaType.OracleType);
                }
                handleToBind = ((OracleLob)value).Descriptor;
                return(IntPtr.Size);

            case OCI.DATATYPE.BFILE:
                if (!(value is OracleBFile))
                {
                    throw System.Data.Common.ADP.BadBindValueType(value.GetType(), metaType.OracleType);
                }
                handleToBind = ((OracleBFile)value).Descriptor;
                return(IntPtr.Size);

            case OCI.DATATYPE.INT_TIMESTAMP:
            case OCI.DATATYPE.INT_TIMESTAMP_LTZ:
                if (value is OracleDateTime)
                {
                    OracleDateTime time = (OracleDateTime)value;
                    if (!time.HasTimeInfo)
                    {
                        throw System.Data.Common.ADP.UnsupportedOracleDateTimeBinding(metaType.OracleType);
                    }
                }
                this._dateTimeDescriptor = OracleDateTime.CreateDescriptor(ociType, connection, value);
                handleToBind             = this._dateTimeDescriptor;
                return(IntPtr.Size);

            case OCI.DATATYPE.INT_TIMESTAMP_TZ:
                if (value is OracleDateTime)
                {
                    OracleDateTime time2 = (OracleDateTime)value;
                    if (!time2.HasTimeZoneInfo)
                    {
                        throw System.Data.Common.ADP.UnsupportedOracleDateTimeBinding(OracleType.TimestampWithTZ);
                    }
                }
                this._dateTimeDescriptor = OracleDateTime.CreateDescriptor(ociType, connection, value);
                handleToBind             = this._dateTimeDescriptor;
                return(IntPtr.Size);

            case OCI.DATATYPE.INT_INTERVAL_YM:
                return(OracleMonthSpan.MarshalToNative(value, buffer, bufferOffset));

            case OCI.DATATYPE.INT_INTERVAL_DS:
                return(OracleTimeSpan.MarshalToNative(value, buffer, bufferOffset));
            }
            throw System.Data.Common.ADP.TypeNotSupported(ociType);
        }
        internal object GetOutputValue(NativeBuffer parameterBuffer, OracleConnection connection, bool needCLSType)
        {
            object obj2;
            if (parameterBuffer.ReadInt16(this._indicatorOffset) == -1)
            {
                return DBNull.Value;
            }
            switch (this._bindingMetaType.OciType)
            {
                case OCI.DATATYPE.VARCHAR2:
                case OCI.DATATYPE.LONG:
                case OCI.DATATYPE.LONGVARCHAR:
                case OCI.DATATYPE.CHAR:
                {
                    obj2 = new OracleString(parameterBuffer, this._valueOffset, this._lengthOffset, this._bindingMetaType, connection, this._bindAsUCS2, true);
                    int size = this._parameter.Size;
                    if (size != 0)
                    {
                        OracleString str4 = (OracleString) obj2;
                        if (size < str4.Length)
                        {
                            OracleString str3 = (OracleString) obj2;
                            string s = str3.Value.Substring(0, size);
                            if (needCLSType)
                            {
                                return s;
                            }
                            return new OracleString(s);
                        }
                    }
                    if (needCLSType)
                    {
                        OracleString str2 = (OracleString) obj2;
                        obj2 = str2.Value;
                    }
                    return obj2;
                }
                case OCI.DATATYPE.INTEGER:
                case OCI.DATATYPE.FLOAT:
                case OCI.DATATYPE.UNSIGNEDINT:
                    return parameterBuffer.PtrToStructure(this._valueOffset, this._bindingMetaType.BaseType);

                case OCI.DATATYPE.VARNUM:
                    obj2 = new OracleNumber(parameterBuffer, this._valueOffset);
                    if (needCLSType)
                    {
                        OracleNumber number = (OracleNumber) obj2;
                        obj2 = number.Value;
                    }
                    return obj2;

                case OCI.DATATYPE.DATE:
                    obj2 = new OracleDateTime(parameterBuffer, this._valueOffset, this._lengthOffset, this._bindingMetaType, connection);
                    if (needCLSType)
                    {
                        OracleDateTime time2 = (OracleDateTime) obj2;
                        obj2 = time2.Value;
                    }
                    return obj2;

                case OCI.DATATYPE.RAW:
                case OCI.DATATYPE.LONGRAW:
                case OCI.DATATYPE.LONGVARRAW:
                    obj2 = new OracleBinary(parameterBuffer, this._valueOffset, this._lengthOffset, this._bindingMetaType);
                    if (needCLSType)
                    {
                        OracleBinary binary = (OracleBinary) obj2;
                        obj2 = binary.Value;
                    }
                    return obj2;

                case OCI.DATATYPE.CLOB:
                case OCI.DATATYPE.BLOB:
                    return new OracleLob(this._locator);

                case OCI.DATATYPE.BFILE:
                    return new OracleBFile(this._locator);

                case OCI.DATATYPE.RSET:
                    return new OracleDataReader(connection, this._descriptor);

                case OCI.DATATYPE.INT_TIMESTAMP:
                case OCI.DATATYPE.INT_TIMESTAMP_TZ:
                case OCI.DATATYPE.INT_TIMESTAMP_LTZ:
                    obj2 = new OracleDateTime(this._dateTimeDescriptor, this._bindingMetaType, connection);
                    if (needCLSType)
                    {
                        OracleDateTime time = (OracleDateTime) obj2;
                        obj2 = time.Value;
                    }
                    return obj2;

                case OCI.DATATYPE.INT_INTERVAL_YM:
                    obj2 = new OracleMonthSpan(parameterBuffer, this._valueOffset);
                    if (needCLSType)
                    {
                        OracleMonthSpan span2 = (OracleMonthSpan) obj2;
                        obj2 = span2.Value;
                    }
                    return obj2;

                case OCI.DATATYPE.INT_INTERVAL_DS:
                    obj2 = new OracleTimeSpan(parameterBuffer, this._valueOffset);
                    if (needCLSType)
                    {
                        OracleTimeSpan span = (OracleTimeSpan) obj2;
                        obj2 = span.Value;
                    }
                    return obj2;
            }
            throw System.Data.Common.ADP.TypeNotSupported(this._bindingMetaType.OciType);
        }
 public static OracleBoolean GreaterThan(OracleTimeSpan x, OracleTimeSpan y)
 {
     return (x > y);
 }