Welcome to mirror list, hosted at ThFree Co, Russian Federation.

OleDbErrorCollection.cs « OleDb « Data « System « System.Data « referencesource « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a7410a8e317cfdf18af425ad161f5afef5593ab8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//------------------------------------------------------------------------------
// <copyright file="OleDbErrorCollection.cs" company="Microsoft">
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
// <owner current="true" primary="true">Microsoft</owner>
// <owner current="true" primary="false">Microsoft</owner>
//------------------------------------------------------------------------------

namespace System.Data.OleDb {

    using System;
    using System.ComponentModel;
    using System.Collections;
    using System.Data.Common;

    [Serializable, ListBindable(false)]
    public sealed class OleDbErrorCollection : System.Collections.ICollection {
        readonly private ArrayList items; // WebData 106655

        internal OleDbErrorCollection(UnsafeNativeMethods.IErrorInfo errorInfo) {
            ArrayList items = new ArrayList();

            Bid.Trace("<oledb.IUnknown.QueryInterface|API|OS> IErrorRecords\n");
            UnsafeNativeMethods.IErrorRecords errorRecords = (errorInfo as UnsafeNativeMethods.IErrorRecords);
            if (null != errorRecords) {

                int recordCount = errorRecords.GetRecordCount();
                Bid.Trace("<oledb.IErrorRecords.GetRecordCount|API|OS|RET> RecordCount=%d\n", recordCount);

                for (int i = 0; i < recordCount; ++i) {
                    OleDbError error = new OleDbError(errorRecords, i);
                    items.Add(error);
                }
            }
            this.items = items;
        }

        bool System.Collections.ICollection.IsSynchronized {
            get { return false;}
        }

        object System.Collections.ICollection.SyncRoot {
            get { return this;}
        }

        public int Count {
            get {
                ArrayList items = this.items;
                return ((null != items) ? items.Count : 0);
            }
        }

        public OleDbError this[int index] {
            get {
                return (this.items[index] as OleDbError);
            }
        }

        internal void AddRange(ICollection c) {
            items.AddRange(c);
        }

        public void CopyTo(Array array, int index) {
            this.items.CopyTo(array, index);
        }

        public void CopyTo (OleDbError[] array, int index) {
            this.items.CopyTo(array, index);
        }

        public IEnumerator GetEnumerator() {
            return this.items.GetEnumerator();
        }
    }
}