Exemplo n.º 1
0
 override public object GetValue(int ordinal)
 {
     ValidateState("GetValue");
     ValidateReader();
     try {
         return(currentDataRow[ordinal]);
     }
     catch (IndexOutOfRangeException e) { // thrown by DataColumnCollection
         ExceptionBuilder.TraceExceptionWithoutRethrow(e);
         throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
     }
 }
Exemplo n.º 2
0
 override public bool IsDBNull(int ordinal)
 {
     ValidateState("IsDBNull");
     ValidateReader();
     try {
         return(currentDataRow.IsNull(ordinal));
     }
     catch (IndexOutOfRangeException e) { // thrown by DataColumnCollection
         ExceptionBuilder.TraceExceptionWithoutRethrow(e);
         throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
     }
 }
Exemplo n.º 3
0
 override public String GetName(int ordinal)
 {
     ValidateOpen("GetName");
     ValidateReader();
     try {
         return(currentDataTable.Columns[ordinal].ColumnName);
     }
     catch (IndexOutOfRangeException e) { // thrown by DataColumnCollection
         ExceptionBuilder.TraceExceptionWithoutRethrow(e);
         throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
     }
 }
Exemplo n.º 4
0
 public override double GetDouble(int ordinal)
 {
     ValidateState(nameof(GetDouble));
     ValidateReader();
     try
     {
         return((double)_currentDataRow[ordinal]);
     }
     catch (IndexOutOfRangeException e)
     { // thrown by DataColumnCollection
         ExceptionBuilder.TraceExceptionWithoutRethrow(e);
         throw ExceptionBuilder.ArgumentOutOfRange(nameof(ordinal));
     }
 }
Exemplo n.º 5
0
 public override Type GetFieldType(int ordinal)
 {
     ValidateOpen(nameof(GetFieldType));
     ValidateReader();
     try
     {
         return(_currentDataTable.Columns[ordinal].DataType);
     }
     catch (IndexOutOfRangeException e)
     { // thrown by DataColumnCollection
         ExceptionBuilder.TraceExceptionWithoutRethrow(e);
         throw ExceptionBuilder.ArgumentOutOfRange(nameof(ordinal));
     }
 }
Exemplo n.º 6
0
        public override long GetChars(int ordinal, long dataIndex, char[] buffer, int bufferIndex, int length)
        {
            ValidateState(nameof(GetChars));
            ValidateReader();
            char[] tempBuffer;
            try
            {
                tempBuffer = (char[])_currentDataRow[ordinal];
            }
            catch (IndexOutOfRangeException e)
            {
                // thrown by DataColumnCollection
                ExceptionBuilder.TraceExceptionWithoutRethrow(e);
                throw ExceptionBuilder.ArgumentOutOfRange(nameof(ordinal));
            }

            if (buffer == null)
            {
                return(tempBuffer.Length);
            }

            int srcIndex  = (int)dataIndex;
            int charCount = Math.Min(tempBuffer.Length - srcIndex, length);

            if (srcIndex < 0)
            {
                throw ADP.InvalidSourceBufferIndex(tempBuffer.Length, srcIndex, nameof(dataIndex));
            }
            else if ((bufferIndex < 0) || (bufferIndex > 0 && bufferIndex >= buffer.Length))
            {
                throw ADP.InvalidDestinationBufferIndex(buffer.Length, bufferIndex, nameof(bufferIndex));
            }

            if (0 < charCount)
            {
                Array.Copy(tempBuffer, dataIndex, buffer, bufferIndex, charCount);
            }
            else if (length < 0)
            {
                throw ADP.InvalidDataLength(length);
            }
            else
            {
                charCount = 0;
            }
            return(charCount);
        }
        public override char GetChar(int ordinal)
        {
            char ch;

            this.ValidateState("GetChar");
            this.ValidateReader();
            try
            {
                ch = (char)this.currentDataRow[ordinal];
            }
            catch (IndexOutOfRangeException exception)
            {
                ExceptionBuilder.TraceExceptionWithoutRethrow(exception);
                throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
            }
            return(ch);
        }
        public override bool IsDBNull(int ordinal)
        {
            bool flag;

            this.ValidateState("IsDBNull");
            this.ValidateReader();
            try
            {
                flag = this.currentDataRow.IsNull(ordinal);
            }
            catch (IndexOutOfRangeException exception)
            {
                ExceptionBuilder.TraceExceptionWithoutRethrow(exception);
                throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
            }
            return(flag);
        }
        public override object GetValue(int ordinal)
        {
            object obj2;

            this.ValidateState("GetValue");
            this.ValidateReader();
            try
            {
                obj2 = this.currentDataRow[ordinal];
            }
            catch (IndexOutOfRangeException exception)
            {
                ExceptionBuilder.TraceExceptionWithoutRethrow(exception);
                throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
            }
            return(obj2);
        }
        public override string GetString(int ordinal)
        {
            string str;

            this.ValidateState("GetString");
            this.ValidateReader();
            try
            {
                str = (string)this.currentDataRow[ordinal];
            }
            catch (IndexOutOfRangeException exception)
            {
                ExceptionBuilder.TraceExceptionWithoutRethrow(exception);
                throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
            }
            return(str);
        }
        public override string GetName(int ordinal)
        {
            string columnName;

            this.ValidateOpen("GetName");
            this.ValidateReader();
            try
            {
                columnName = this.currentDataTable.Columns[ordinal].ColumnName;
            }
            catch (IndexOutOfRangeException exception)
            {
                ExceptionBuilder.TraceExceptionWithoutRethrow(exception);
                throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
            }
            return(columnName);
        }
        public override long GetInt64(int ordinal)
        {
            long num;

            this.ValidateState("GetInt64");
            this.ValidateReader();
            try
            {
                num = (long)this.currentDataRow[ordinal];
            }
            catch (IndexOutOfRangeException exception)
            {
                ExceptionBuilder.TraceExceptionWithoutRethrow(exception);
                throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
            }
            return(num);
        }
        public override Guid GetGuid(int ordinal)
        {
            Guid guid;

            this.ValidateState("GetGuid");
            this.ValidateReader();
            try
            {
                guid = (Guid)this.currentDataRow[ordinal];
            }
            catch (IndexOutOfRangeException exception)
            {
                ExceptionBuilder.TraceExceptionWithoutRethrow(exception);
                throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
            }
            return(guid);
        }
        public override Type GetFieldType(int ordinal)
        {
            Type dataType;

            this.ValidateOpen("GetFieldType");
            this.ValidateReader();
            try
            {
                dataType = this.currentDataTable.Columns[ordinal].DataType;
            }
            catch (IndexOutOfRangeException exception)
            {
                ExceptionBuilder.TraceExceptionWithoutRethrow(exception);
                throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
            }
            return(dataType);
        }
        public override DateTime GetDateTime(int ordinal)
        {
            DateTime time;

            this.ValidateState("GetDateTime");
            this.ValidateReader();
            try
            {
                time = (DateTime)this.currentDataRow[ordinal];
            }
            catch (IndexOutOfRangeException exception)
            {
                ExceptionBuilder.TraceExceptionWithoutRethrow(exception);
                throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
            }
            return(time);
        }
        public override bool GetBoolean(int ordinal)
        {
            bool flag;

            this.ValidateState("GetBoolean");
            this.ValidateReader();
            try
            {
                flag = (bool)this.currentDataRow[ordinal];
            }
            catch (IndexOutOfRangeException exception)
            {
                ExceptionBuilder.TraceExceptionWithoutRethrow(exception);
                throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
            }
            return(flag);
        }
Exemplo n.º 17
0
 override public object this[int ordinal] {
     get {
         ValidateOpen("Item");
         ValidateReader();
         if ((currentDataRow == null) || (currentDataRow.RowState == DataRowState.Deleted))
         {
             ReaderIsInvalid = true;
             throw  ExceptionBuilder.InvalidDataTableReader(currentDataTable.TableName);
         }
         try {
             return(currentDataRow[ordinal]);
         }
         catch (IndexOutOfRangeException e) { // thrown by DataColumnCollection
             ExceptionBuilder.TraceExceptionWithoutRethrow(e);
             throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
         }
     }
 }
        public override long GetChars(int ordinal, long dataIndex, char[] buffer, int bufferIndex, int length)
        {
            char[] chArray;
            this.ValidateState("GetChars");
            this.ValidateReader();
            try
            {
                chArray = (char[])this.currentDataRow[ordinal];
            }
            catch (IndexOutOfRangeException exception)
            {
                ExceptionBuilder.TraceExceptionWithoutRethrow(exception);
                throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
            }
            if (buffer == null)
            {
                return((long)chArray.Length);
            }
            int num2 = (int)dataIndex;
            int num  = Math.Min(chArray.Length - num2, length);

            if (num2 < 0)
            {
                throw ADP.InvalidSourceBufferIndex(chArray.Length, (long)num2, "dataIndex");
            }
            if ((bufferIndex < 0) || ((bufferIndex > 0) && (bufferIndex >= buffer.Length)))
            {
                throw ADP.InvalidDestinationBufferIndex(buffer.Length, bufferIndex, "bufferIndex");
            }
            if (0 < num)
            {
                Array.Copy(chArray, dataIndex, buffer, (long)bufferIndex, (long)num);
            }
            else
            {
                if (length < 0)
                {
                    throw ADP.InvalidDataLength((long)length);
                }
                num = 0;
            }
            return((long)num);
        }
Exemplo n.º 19
0
 public void CopyTo(DataTable[] array, int index)
 {
     if (array == null)
     {
         throw ExceptionBuilder.ArgumentNull(nameof(array));
     }
     if (index < 0)
     {
         throw ExceptionBuilder.ArgumentOutOfRange(nameof(index));
     }
     if (array.Length - index < _list.Count)
     {
         throw ExceptionBuilder.InvalidOffsetLength();
     }
     for (int i = 0; i < _list.Count; ++i)
     {
         array[index + i] = (DataTable)_list[i];
     }
 }
Exemplo n.º 20
0
 public void CopyTo(Constraint[] array, int index)
 {
     if (array == null)
     {
         throw ExceptionBuilder.ArgumentNull("array");
     }
     if (index < 0)
     {
         throw ExceptionBuilder.ArgumentOutOfRange("index");
     }
     if ((array.Length - index) < this.list.Count)
     {
         throw ExceptionBuilder.InvalidOffsetLength();
     }
     for (int i = 0; i < this.list.Count; i++)
     {
         array[index + i] = (Constraint)this.list[i];
     }
 }
Exemplo n.º 21
0
        override public long GetBytes(int ordinal, long dataIndex, byte[] buffer, int bufferIndex, int length)
        {
            ValidateState("GetBytes");
            ValidateReader();
            byte[] tempBuffer;
            try {
                tempBuffer = (byte[])currentDataRow[ordinal];
            }
            catch (IndexOutOfRangeException e) { // thrown by DataColumnCollection
                ExceptionBuilder.TraceExceptionWithoutRethrow(e);
                throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
            }
            if (buffer == null)
            {
                return(tempBuffer.Length);
            }
            int srcIndex  = (int)dataIndex;
            int byteCount = Math.Min(tempBuffer.Length - srcIndex, length);

            if (srcIndex < 0)
            {
                throw ADP.InvalidSourceBufferIndex(tempBuffer.Length, srcIndex, "dataIndex");
            }
            else if ((bufferIndex < 0) || (bufferIndex > 0 && bufferIndex >= buffer.Length))
            {
                throw ADP.InvalidDestinationBufferIndex(buffer.Length, bufferIndex, "bufferIndex");
            }

            if (0 < byteCount)
            {
                Array.Copy(tempBuffer, dataIndex, buffer, bufferIndex, byteCount);
            }
            else if (length < 0)
            {
                throw ADP.InvalidDataLength(length);
            }
            else
            {
                byteCount = 0;
            }
            return(byteCount);
        }
        public void CopyTo(DataRelation[] array, int index)
        {
            if (array == null)
            {
                throw ExceptionBuilder.ArgumentNull("array");
            }
            if (index < 0)
            {
                throw ExceptionBuilder.ArgumentOutOfRange("index");
            }
            ArrayList list = this.List;

            if ((array.Length - index) < list.Count)
            {
                throw ExceptionBuilder.InvalidOffsetLength();
            }
            for (int i = 0; i < list.Count; i++)
            {
                array[index + i] = (DataRelation)list[i];
            }
        }
 public override object this[int ordinal]
 {
     get
     {
         object obj2;
         this.ValidateOpen("Item");
         this.ValidateReader();
         if ((this.currentDataRow == null) || (this.currentDataRow.RowState == DataRowState.Deleted))
         {
             this.ReaderIsInvalid = true;
             throw ExceptionBuilder.InvalidDataTableReader(this.currentDataTable.TableName);
         }
         try
         {
             obj2 = this.currentDataRow[ordinal];
         }
         catch (IndexOutOfRangeException exception)
         {
             ExceptionBuilder.TraceExceptionWithoutRethrow(exception);
             throw ExceptionBuilder.ArgumentOutOfRange("ordinal");
         }
         return(obj2);
     }
 }
Exemplo n.º 24
0
        public void CopyTo(DataRelation[] array, int index)
        {
            if (array == null)
            {
                throw ExceptionBuilder.ArgumentNull(nameof(array));
            }

            if (index < 0)
            {
                throw ExceptionBuilder.ArgumentOutOfRange(nameof(index));
            }

            ArrayList alist = List;

            if (array.Length - index < alist.Count)
            {
                throw ExceptionBuilder.InvalidOffsetLength();
            }

            for (int i = 0; i < alist.Count; ++i)
            {
                array[index + i] = (DataRelation)alist[i] !;
            }
        }