Inheritance: IDataReader, IEnumerable, ICollection
コード例 #1
0
 void IDataReader.Close()
 {
     rows        = null;
     nextResult  = null;
     fields      = null;
     ordinals    = null;
     recordIndex = -1;
 }
コード例 #2
0
 void IDisposable.Dispose()
 {
     rows        = null;
     nextResult  = null;
     fields      = null;
     ordinals    = null;
     recordIndex = -1;
 }
コード例 #3
0
        /// <summary>
        /// Caches a data reader to enable disconnected data access via the IDataReader interface.
        /// </summary>
        /// <param name="reader">The IDataReader to cache.</param>
        public DisconnectedReader(IDataReader reader)
        {
            // Cache field information
            this.fields   = new FieldInfo[reader.FieldCount];
            this.ordinals = new Hashtable(StringComparer.OrdinalIgnoreCase);
            for (int index = 0; index < fields.Length; index++)
            {
                FieldInfo field = new FieldInfo();
                field.Name         = reader.GetName(index);
                field.Type         = reader.GetFieldType(index);
                field.DataTypeName = reader.GetDataTypeName(index);
                fields[index]      = field;
                if (!ordinals.Contains(field.Name))
                {
                    ordinals.Add(field.Name, index);
                }
            }

            // Cache schema info
            schema = reader.GetSchemaTable();

            // Cache row data
            rows = new ArrayList();
            while (reader.Read())
            {
                object[] values = new object[fields.Length];
                reader.GetValues(values);
                rows.Add(values);
            }

            // Cache additional results
            if (reader.NextResult())
            {
                nextResult = new DisconnectedReader(reader);
            }

            // Close the reader once all data has been cached
            else
            {
                reader.Dispose();
            }

            // Set the record index before the first record;
            this.recordIndex = -1;

            this.lastIndex = rows.Count - 1;
        }
コード例 #4
0
        bool IDataReader.NextResult()
        {
            if (nextResult == null)
            {
                return(false);
            }

            this.fields      = nextResult.fields;
            this.ordinals    = nextResult.ordinals;
            this.rows        = nextResult.rows;
            this.schema      = nextResult.schema;
            this.recordIndex = -1;
            this.nextResult  = nextResult.nextResult;
            this.lastIndex   = rows.Count - 1;

            return(true);
        }
コード例 #5
0
ファイル: DisconnectedReader.cs プロジェクト: vc3/Amnesia
        /// <summary>
        /// Caches a data reader to enable disconnected data access via the IDataReader interface.
        /// </summary>
        /// <param name="reader">The IDataReader to cache.</param>
        public DisconnectedReader(IDataReader reader)
        {
            // Cache field information
            this.fields = new FieldInfo[reader.FieldCount];
            this.ordinals = new Hashtable(StringComparer.OrdinalIgnoreCase);
            for (int index = 0; index < fields.Length; index++)
            {
                FieldInfo field = new FieldInfo();
                field.Name = reader.GetName(index);
                field.Type = reader.GetFieldType(index);
                field.DataTypeName = reader.GetDataTypeName(index);
                fields[index] = field;
                if (!ordinals.Contains(field.Name))
                    ordinals.Add(field.Name, index);
            }

            // Cache schema info
            schema = reader.GetSchemaTable();

            // Cache row data
            rows = new ArrayList();
            while (reader.Read())
            {
                object[] values = new object[fields.Length];
                reader.GetValues(values);
                rows.Add(values);
            }

            // Cache additional results
            if (reader.NextResult())
                nextResult = new DisconnectedReader(reader);

            // Close the reader once all data has been cached
            else
                reader.Dispose();

            // Set the record index before the first record;
            this.recordIndex = -1;

            this.lastIndex = rows.Count - 1;
        }
コード例 #6
0
ファイル: DisconnectedReader.cs プロジェクト: vc3/Amnesia
 void IDisposable.Dispose()
 {
     rows = null;
     nextResult = null;
     fields = null;
     ordinals = null;
     recordIndex = -1;
 }
コード例 #7
0
ファイル: DisconnectedReader.cs プロジェクト: vc3/Amnesia
        bool IDataReader.NextResult()
        {
            if (nextResult == null)
                return false;

            this.fields = nextResult.fields;
            this.ordinals = nextResult.ordinals;
            this.rows = nextResult.rows;
            this.schema = nextResult.schema;
            this.recordIndex = -1;
            this.nextResult = nextResult.nextResult;
            this.lastIndex = rows.Count - 1;

            return true;
        }
コード例 #8
0
ファイル: DisconnectedReader.cs プロジェクト: vc3/Amnesia
 void IDataReader.Close()
 {
     rows = null;
     nextResult = null;
     fields = null;
     ordinals = null;
     recordIndex = -1;
 }