0a679426210dff88089fd7e4224db5d3cb0db201
[mono.git] / mcs / class / Mono.Data.MySql / Mono.Data.MySql / MySqlParameter.cs
1 //
2 // Mono.Data.MySql.MySqlParameter.cs
3 //
4 // Author:
5 //   Rodrigo Moya (rodrigo@ximian.com)
6 //   Daniel Morgan (danmorg@sc.rr.com)
7 //
8 // (C) Ximian, Inc. 2002
9 //
10 using System;
11 using System.ComponentModel;
12 using System.Data;
13 using System.Data.Common;
14 using System.Runtime.InteropServices;
15
16 namespace Mono.Data.MySql
17 {
18         /// <summary>
19         /// Represents a parameter to a Command object, and optionally, 
20         /// its mapping to DataSet columns; and is implemented by .NET 
21         /// data providers that access data sources.
22         /// </summary>
23         //public sealed class MySqlParameter : MarshalByRefObject,
24         //      IDbDataParameter, IDataParameter, ICloneable
25         public sealed class MySqlParameter : IDbDataParameter, IDataParameter
26         {
27                 private string parmName;
28                 private DbType dbtype;
29                 private object objValue;
30                 private int size;
31                 private string sourceColumn;
32                 private ParameterDirection direction;
33                 private bool isNullable;
34                 private byte precision;
35                 private byte scale;
36                 private DataRowVersion sourceVersion;
37                 private int offset;
38
39                 [MonoTODO]
40                 public MySqlParameter () {
41                 
42                 }
43
44                 [MonoTODO]
45                 public MySqlParameter (string parameterName, object value) {
46                         this.parmName = parameterName;
47                         this.objValue = value;
48                 }
49                 
50                 [MonoTODO]
51                 public MySqlParameter(string parameterName, DbType dbType) {
52                         this.parmName = parameterName;
53                         this.dbtype = dbType;
54                 }
55
56                 [MonoTODO]
57                 public MySqlParameter(string parameterName, DbType dbType,
58                         int size) {
59
60                         this.parmName = parameterName;
61                         this.dbtype = dbType;
62                         this.size = size;
63                 }
64                 
65                 [MonoTODO]
66                 public MySqlParameter(string parameterName, DbType dbType,
67                         int size, string sourceColumn) {
68
69                         this.parmName = parameterName;
70                         this.dbtype = dbType;
71                         this.size = size;
72                         this.sourceColumn = sourceColumn;
73                 }
74                          
75                 [MonoTODO]
76                 public MySqlParameter(string parameterName, DbType dbType,
77                         int size, ParameterDirection direction, 
78                         bool isNullable, byte precision,
79                         byte scale, string sourceColumn,
80                         DataRowVersion sourceVersion, object value) {
81                         
82                         this.parmName = parameterName;
83                         this.dbtype = dbType;
84                         this.size = size;
85                         this.sourceColumn = sourceColumn;
86                         this.direction = direction;
87                         this.isNullable = isNullable;
88                         this.precision = precision;
89                         this.scale = scale;
90                         this.sourceVersion = sourceVersion;
91                         this.objValue = value;
92                 }
93
94                 [MonoTODO]
95                 public DbType DbType {
96                         get { 
97                                 return dbtype;
98                         }
99                         set { 
100                                 dbtype = value;
101                         }
102                 }
103
104                 [MonoTODO]
105                 public ParameterDirection Direction {
106                         get { 
107                                 return direction;
108                         }
109                         set { 
110                                 direction = value;
111                         }
112                 }
113
114                 [MonoTODO]
115                 public bool IsNullable  {
116                         get { 
117                                 return isNullable;
118                         }
119                 }
120
121                 [MonoTODO]
122                 public int Offset {
123                         get {
124                                 return offset;
125                         }
126                         
127                         set {
128                                 offset = value;
129                         }
130                 }
131
132                 
133                 string IDataParameter.ParameterName {
134                         get { 
135                                 return parmName;
136                         }
137
138                         set { 
139                                 parmName = value;
140                         }
141                 }
142                 
143                 public string ParameterName {
144                         get { 
145                                 return parmName;
146                         }
147
148                         set { 
149                                 parmName = value;
150                         }
151                 }
152
153                 [MonoTODO]
154                 public string SourceColumn {
155                         get { 
156                                 return sourceColumn;
157                         }
158
159                         set { 
160                                 sourceColumn = value;
161                         }
162                 }
163
164                 [MonoTODO]
165                 public DataRowVersion SourceVersion {
166                         get { 
167                                 return sourceVersion;
168                         }
169
170                         set { 
171                                 sourceVersion = value;
172                         }
173                 }
174
175                 [MonoTODO]
176                 public object Value {
177                         get { 
178                                 return objValue;
179                         }
180
181                         set { 
182                                 objValue = value;
183                         }
184                 }
185
186                 [MonoTODO]
187                 public byte Precision {
188                         get { 
189                                 return precision;
190                         }
191
192                         set { 
193                                 precision = value;
194                         }
195                 }
196
197                 [MonoTODO]
198                 public byte Scale {
199                         get { 
200                                 return scale;
201                         }
202
203                         set { 
204                                 scale = value;
205                         }
206                 }
207
208                 [MonoTODO]
209                 public int Size
210                 {
211                         get { 
212                                 return size;
213                         }
214
215                         set { 
216                                 size = value;
217                         }
218                 }
219
220                 [MonoTODO]
221                 public override string ToString() {
222                         return parmName;
223                 }
224         }
225 }