**** Merged from MCS ****
[mono-project.git] / mcs / class / Mono.Data.MySql / Mono.Data.MySql / MySqlParameter.cs
blob8ff53561ca7ba732b4c37c4a4e892bc4f2506eb8
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 //
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System;
32 using System.ComponentModel;
33 using System.Data;
34 using System.Data.Common;
35 using System.Runtime.InteropServices;
37 namespace Mono.Data.MySql
39 /// <summary>
40 /// Represents a parameter to a Command object, and optionally,
41 /// its mapping to DataSet columns; and is implemented by .NET
42 /// data providers that access data sources.
43 /// </summary>
44 //public sealed class MySqlParameter : MarshalByRefObject,
45 // IDbDataParameter, IDataParameter, ICloneable
46 public sealed class MySqlParameter : IDbDataParameter, IDataParameter
48 private string parmName;
49 private DbType dbtype;
50 private object objValue;
51 private int size;
52 private string sourceColumn;
53 private ParameterDirection direction;
54 private bool isNullable;
55 private byte precision;
56 private byte scale;
57 private DataRowVersion sourceVersion;
58 private int offset;
60 [MonoTODO]
61 public MySqlParameter () {
65 [MonoTODO]
66 public MySqlParameter (string parameterName, object value) {
67 this.parmName = parameterName;
68 this.objValue = value;
71 [MonoTODO]
72 public MySqlParameter(string parameterName, DbType dbType) {
73 this.parmName = parameterName;
74 this.dbtype = dbType;
77 [MonoTODO]
78 public MySqlParameter(string parameterName, DbType dbType,
79 int size) {
81 this.parmName = parameterName;
82 this.dbtype = dbType;
83 this.size = size;
86 [MonoTODO]
87 public MySqlParameter(string parameterName, DbType dbType,
88 int size, string sourceColumn) {
90 this.parmName = parameterName;
91 this.dbtype = dbType;
92 this.size = size;
93 this.sourceColumn = sourceColumn;
96 [MonoTODO]
97 public MySqlParameter(string parameterName, DbType dbType,
98 int size, ParameterDirection direction,
99 bool isNullable, byte precision,
100 byte scale, string sourceColumn,
101 DataRowVersion sourceVersion, object value) {
103 this.parmName = parameterName;
104 this.dbtype = dbType;
105 this.size = size;
106 this.sourceColumn = sourceColumn;
107 this.direction = direction;
108 this.isNullable = isNullable;
109 this.precision = precision;
110 this.scale = scale;
111 this.sourceVersion = sourceVersion;
112 this.objValue = value;
115 [MonoTODO]
116 public DbType DbType {
117 get {
118 return dbtype;
120 set {
121 dbtype = value;
125 [MonoTODO]
126 public ParameterDirection Direction {
127 get {
128 return direction;
130 set {
131 direction = value;
135 [MonoTODO]
136 public bool IsNullable {
137 get {
138 return isNullable;
142 [MonoTODO]
143 public int Offset {
144 get {
145 return offset;
148 set {
149 offset = value;
154 string IDataParameter.ParameterName {
155 get {
156 return parmName;
159 set {
160 parmName = value;
164 public string ParameterName {
165 get {
166 return parmName;
169 set {
170 parmName = value;
174 [MonoTODO]
175 public string SourceColumn {
176 get {
177 return sourceColumn;
180 set {
181 sourceColumn = value;
185 [MonoTODO]
186 public DataRowVersion SourceVersion {
187 get {
188 return sourceVersion;
191 set {
192 sourceVersion = value;
196 [MonoTODO]
197 public object Value {
198 get {
199 return objValue;
202 set {
203 objValue = value;
207 [MonoTODO]
208 public byte Precision {
209 get {
210 return precision;
213 set {
214 precision = value;
218 [MonoTODO]
219 public byte Scale {
220 get {
221 return scale;
224 set {
225 scale = value;
229 [MonoTODO]
230 public int Size
232 get {
233 return size;
236 set {
237 size = value;
241 [MonoTODO]
242 public override string ToString() {
243 return parmName;