Merge pull request #819 from brendanzagaeski/patch-1
[mono.git] / mcs / class / Mono.Data.Tds / Mono.Data.Tds.Protocol / TdsDataColumn.cs
1 //
2 // System.Data.Common.TdsDataColumn.cs
3 //
4 // Author:
5 //   Tim Coleman (tim@timcoleman.com)
6 //
7 // Copyright (C) Tim Coleman, 2002
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 using System.Collections;
32 using System.Text;
33
34 namespace Mono.Data.Tds.Protocol {
35         public class TdsDataColumn
36         {
37                 Hashtable properties;
38
39                 public TdsDataColumn ()
40                 {
41 #if NET_2_0
42                         IsAutoIncrement = false;
43                         IsIdentity = false;
44                         IsRowVersion = false;
45                         IsUnique = false;
46                         IsHidden = false;
47 #else
48                         object bool_false = false;
49                         
50                         this ["IsAutoIncrement"] = bool_false;
51                         this ["IsIdentity"] = bool_false;
52                         this ["IsRowVersion"] = bool_false;
53                         this ["IsUnique"] = bool_false;
54                         this ["IsHidden"] = bool_false;
55 #endif
56                 }
57
58
59 #if NET_2_0
60                 public TdsColumnType? ColumnType {
61                         get;
62                         set;
63                 }
64                 
65                 public string ColumnName {
66                         get;
67                         set;
68                 }
69
70                 public int? ColumnSize {
71                         get;
72                         set;
73                 }
74                 
75                 public int? ColumnOrdinal {
76                         get;
77                         set;
78                 }
79
80                 public bool? IsAutoIncrement {
81                         get;
82                         set;
83                 }
84
85                 public bool? IsIdentity {
86                         get;
87                         set;
88                 }
89
90                 public bool? IsRowVersion {
91                         get;
92                         set;
93                 }
94
95                 public bool? IsUnique {
96                         get;
97                         set;
98                 }
99
100                 public bool? IsHidden {
101                         get;
102                         set;
103                 }
104
105                 public bool? IsKey {
106                         get;
107                         set;
108                 }
109
110                 public bool? IsAliased {
111                         get;
112                         set;
113                 }
114
115                 public bool? IsExpression {
116                         get;
117                         set;
118                 }
119
120                 public bool? IsReadOnly {
121                         get;
122                         set;
123                 }
124                 
125                 public short? NumericPrecision {
126                         get;
127                         set;
128                 }
129
130                 public short? NumericScale {
131                         get;
132                         set;
133                 }
134
135                 public string BaseServerName {
136                         get;
137                         set;
138                 }
139
140                 public string BaseCatalogName {
141                         get;
142                         set;
143                 }
144
145                 public string BaseColumnName {
146                         get;
147                         set;
148                 }
149
150                 public string BaseSchemaName {
151                         get;
152                         set;
153                 }
154
155                 public string BaseTableName {
156                         get;
157                         set;
158                 }
159
160                 public bool? AllowDBNull {
161                         get;
162                         set;
163                 }
164                 
165                 public int? LCID {
166                         get;
167                         set;
168                 }
169                 
170                 public int? SortOrder {
171                         get;
172                         set;
173                 }
174                 
175                 public string DataTypeName {
176                         get;
177                         set;
178                 }
179 #endif
180                 
181                 // This allows the storage of arbitrary properties in addition to the predefined ones
182                 public object this [string key] {
183                         get {
184                                 if (properties == null)
185                                         return null;
186                                 return properties [key];
187                         }
188                         set {
189                                 if (properties == null)
190                                         properties = new Hashtable ();
191                                 properties [key] = value;
192                         }
193                 }
194         }
195 }