2 // Mono.Data.MySql.MySqlParameter.cs
5 // Rodrigo Moya (rodrigo@ximian.com)
6 // Daniel Morgan (danmorg@sc.rr.com)
8 // (C) Ximian, Inc. 2002
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:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
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.
32 using System
.ComponentModel
;
34 using System
.Data
.Common
;
35 using System
.Runtime
.InteropServices
;
37 namespace Mono
.Data
.MySql
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.
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
;
52 private string sourceColumn
;
53 private ParameterDirection direction
;
54 private bool isNullable
;
55 private byte precision
;
57 private DataRowVersion sourceVersion
;
61 public MySqlParameter () {
66 public MySqlParameter (string parameterName
, object value) {
67 this.parmName
= parameterName
;
68 this.objValue
= value;
72 public MySqlParameter(string parameterName
, DbType dbType
) {
73 this.parmName
= parameterName
;
78 public MySqlParameter(string parameterName
, DbType dbType
,
81 this.parmName
= parameterName
;
87 public MySqlParameter(string parameterName
, DbType dbType
,
88 int size
, string sourceColumn
) {
90 this.parmName
= parameterName
;
93 this.sourceColumn
= sourceColumn
;
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
;
106 this.sourceColumn
= sourceColumn
;
107 this.direction
= direction
;
108 this.isNullable
= isNullable
;
109 this.precision
= precision
;
111 this.sourceVersion
= sourceVersion
;
112 this.objValue
= value;
116 public DbType DbType
{
126 public ParameterDirection Direction
{
136 public bool IsNullable
{
154 string IDataParameter
.ParameterName
{
164 public string ParameterName
{
175 public string SourceColumn
{
181 sourceColumn
= value;
186 public DataRowVersion SourceVersion
{
188 return sourceVersion
;
192 sourceVersion
= value;
197 public object Value
{
208 public byte Precision
{
242 public override string ToString() {