wasCSharpSQLite – Blame information for rev

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 //
2 // System.Data.Common.DbDataReader.cs
3 //
4 // Author:
5 // Tim Coleman (tim@timcoleman.com)
6 //
7 // Copyright (C) Tim Coleman, 2003
8 //
9  
10 //
11 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining
14 // a copy of this software and associated documentation files (the
15 // "Software"), to deal in the Software without restriction, including
16 // without limitation the rights to use, copy, modify, merge, publish,
17 // distribute, sublicense, and/or sell copies of the Software, and to
18 // permit persons to whom the Software is furnished to do so, subject to
19 // the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 //
32  
33  
34  
35 using System.Collections;
36 using System.ComponentModel;
37 using System.Data;
38  
39 namespace System.Data.Common {
40 public abstract class DbDataReader : IDataReader, IDataRecord, IDisposable, IEnumerable
41 {
42 #region Constructors
43  
44 protected DbDataReader ()
45 {
46 }
47  
48 #endregion // Constructors
49  
50 #region Properties
51  
52 public abstract int Depth { get; }
53 public abstract int FieldCount { get; }
54 public abstract bool HasRows { get; }
55 public abstract bool IsClosed { get; }
56 public abstract object this [int index] { get; }
57 public abstract object this [string name] { get; }
58 public abstract int RecordsAffected { get; }
59  
60  
61 public virtual int VisibleFieldCount {
62 get { return FieldCount; }
63 }
64  
65 #endregion // Properties
66  
67 #region Methods
68  
69 public abstract void Close ();
70 public abstract bool GetBoolean (int i);
71 public abstract byte GetByte (int i);
72 public abstract long GetBytes (int i, long fieldOffset, byte[] buffer, int bufferOffset, int length);
73 public abstract char GetChar (int i);
74 public abstract long GetChars (int i, long dataIndex, char[] buffer, int bufferIndex, int length);
75  
76 [EditorBrowsable (EditorBrowsableState.Never)]
77 public void Dispose ()
78 {
79 Dispose (true);
80 }
81  
82 protected virtual void Dispose (bool disposing)
83 {
84 if (disposing)
85 Close ();
86 }
87  
88 [EditorBrowsable (EditorBrowsableState.Never)]
89 public DbDataReader GetData (int i)
90 {
91 return ((DbDataReader) this [i]);
92 }
93  
94  
95 public abstract string GetDataTypeName (int i);
96 public abstract DateTime GetDateTime (int i);
97 public abstract decimal GetDecimal (int i);
98 public abstract double GetDouble (int i);
99  
100 [EditorBrowsable (EditorBrowsableState.Never)]
101 public abstract IEnumerator GetEnumerator ();
102  
103 public abstract Type GetFieldType (int i);
104 public abstract float GetFloat (int i);
105 public abstract Guid GetGuid (int i);
106 public abstract short GetInt16 (int i);
107 public abstract int GetInt32 (int i);
108 public abstract long GetInt64 (int i);
109 public abstract string GetName (int i);
110 public abstract int GetOrdinal (string name);
111  
112  
113 [EditorBrowsable (EditorBrowsableState.Never)]
114 public virtual Type GetProviderSpecificFieldType (int i)
115 {
116 return GetFieldType (i);
117 }
118  
119 [EditorBrowsable (EditorBrowsableState.Never)]
120 public virtual object GetProviderSpecificValue (int i)
121 {
122 return GetValue (i);
123 }
124  
125 [EditorBrowsable (EditorBrowsableState.Never)]
126 public virtual int GetProviderSpecificValues (object[] values)
127 {
128 return GetValues (values);
129 }
130  
131 protected virtual DbDataReader GetDbDataReader (int ordinal)
132 {
133 return ((DbDataReader) this [ordinal]);
134 }
135  
136  
137 //public abstract DataTable GetSchemaTable ();
138 public abstract string GetString (int i);
139 public abstract object GetValue (int i);
140 public abstract int GetValues (object[] values);
141  
142 IDataReader IDataRecord.GetData (int i)
143 {
144 return ((IDataReader) this).GetData (i);
145 }
146  
147 public abstract bool IsDBNull (int i);
148 public abstract bool NextResult ();
149 public abstract bool Read ();
150  
151 // internal static DataTable GetSchemaTableTemplate ()
152 //{
153 // Type booleanType = typeof (bool);
154 // Type stringType = typeof (string);
155 // Type intType = typeof (int);
156 // Type typeType = typeof (Type);
157 // Type shortType = typeof (short);
158  
159 // DataTable schemaTable = new DataTable ("SchemaTable");
160 // schemaTable.Columns.Add ("ColumnName", stringType);
161 // schemaTable.Columns.Add ("ColumnOrdinal", intType);
162 // schemaTable.Columns.Add ("ColumnSize", intType);
163 // schemaTable.Columns.Add ("NumericPrecision", shortType);
164 // schemaTable.Columns.Add ("NumericScale", shortType);
165 // schemaTable.Columns.Add ("IsUnique", booleanType);
166 // schemaTable.Columns.Add ("IsKey", booleanType);
167 // schemaTable.Columns.Add ("BaseServerName", stringType);
168 // schemaTable.Columns.Add ("BaseCatalogName", stringType);
169 // schemaTable.Columns.Add ("BaseColumnName", stringType);
170 // schemaTable.Columns.Add ("BaseSchemaName", stringType);
171 // schemaTable.Columns.Add ("BaseTableName", stringType);
172 // schemaTable.Columns.Add ("DataType", typeType);
173 // schemaTable.Columns.Add ("AllowDBNull", booleanType);
174 // schemaTable.Columns.Add ("ProviderType", intType);
175 // schemaTable.Columns.Add ("IsAliased", booleanType);
176 // schemaTable.Columns.Add ("IsExpression", booleanType);
177 // schemaTable.Columns.Add ("IsIdentity", booleanType);
178 // schemaTable.Columns.Add ("IsAutoIncrement", booleanType);
179 // schemaTable.Columns.Add ("IsRowVersion", booleanType);
180 // schemaTable.Columns.Add ("IsHidden", booleanType);
181 // schemaTable.Columns.Add ("IsLong", booleanType);
182 // schemaTable.Columns.Add ("IsReadOnly", booleanType);
183  
184 // return schemaTable;
185 //}
186  
187 #endregion // Methods
188 }
189 }
190  
191