2 // System.Data.Common.DbDataRecord.cs
5 // Tim Coleman (tim@timcoleman.com)
7 // Copyright (C) Tim Coleman, 2002
10 using System.Collections;
11 using System.ComponentModel;
14 namespace System.Data.Common {
15 public class DbDataRecord : IDataRecord, ICustomTypeDescriptor
22 FieldNameLookup lookup;
28 internal DbDataRecord (SchemaInfo[] schema, object[] values, FieldNameLookup lookup)
33 this.fieldCount = values.Length;
40 public int FieldCount {
41 get { return fieldCount; }
44 public object this [string name] {
45 get { return this [GetOrdinal (name)]; }
48 public object this [int index] {
49 get { return GetValue (index); }
56 public bool GetBoolean (int i)
58 return (bool) GetValue (i);
61 public byte GetByte (int i)
63 return (byte) GetValue (i);
67 public long GetBytes (int i, long dataIndex, byte[] buffer, int bufferIndex, int length)
69 throw new NotImplementedException ();
72 public char GetChar (int i)
74 return (char) GetValue (i);
78 public long GetChars (int i, long dataIndex, char[] buffer, int bufferIndex, int length)
80 throw new NotImplementedException ();
84 public IDataReader GetData (int i)
86 throw new NotImplementedException ();
89 public string GetDataTypeName (int i)
91 return schema[i].DataTypeName;
94 public DateTime GetDateTime (int i)
96 return (DateTime) GetValue (i);
99 public decimal GetDecimal (int i)
101 return (decimal) GetValue (i);
104 public double GetDouble (int i)
106 return (double) GetValue (i);
109 public Type GetFieldType (int i)
111 return GetValue (i).GetType ();
114 public float GetFloat (int i)
116 return (float) GetValue (i);
119 public Guid GetGuid (int i)
121 return (Guid) GetValue (i);
124 public short GetInt16 (int i)
126 return (short) GetValue (i);
129 public int GetInt32 (int i)
131 return (int) GetValue (i);
134 public long GetInt64 (int i)
136 return (long) GetValue (i);
139 public string GetName (int i)
141 return (string) lookup [i];
144 public int GetOrdinal (string name)
146 return lookup.IndexOf (name);
149 public string GetString (int i)
151 return (string) GetValue (i);
154 public object GetValue (int i)
160 public int GetValues (object[] values)
162 throw new NotImplementedException ();
166 AttributeCollection ICustomTypeDescriptor.GetAttributes ()
168 throw new NotImplementedException ();
172 string ICustomTypeDescriptor.GetClassName ()
174 throw new NotImplementedException ();
178 string ICustomTypeDescriptor.GetComponentName ()
180 throw new NotImplementedException ();
184 TypeConverter ICustomTypeDescriptor.GetConverter ()
186 throw new NotImplementedException ();
190 EventDescriptor ICustomTypeDescriptor.GetDefaultEvent ()
192 throw new NotImplementedException ();
196 PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty ()
198 throw new NotImplementedException ();
202 object ICustomTypeDescriptor.GetEditor (Type editorBaseType)
204 throw new NotImplementedException ();
208 EventDescriptorCollection ICustomTypeDescriptor.GetEvents ()
210 throw new NotImplementedException ();
214 EventDescriptorCollection ICustomTypeDescriptor.GetEvents (Attribute[] attributes)
216 throw new NotImplementedException ();
220 PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties ()
222 throw new NotImplementedException ();
226 PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties (Attribute[] attributes)
228 throw new NotImplementedException ();
232 object ICustomTypeDescriptor.GetPropertyOwner (PropertyDescriptor pd)
234 throw new NotImplementedException ();
237 public bool IsDBNull (int i)
239 return GetValue (i) == null;
242 #endregion // Methods