**** Merged from MCS ****
[mono-project.git] / mcs / class / Mono.Data.PostgreSqlClient / Mono.Data.PostgreSqlClient / PgSqlParameter.cs
blob39e6e7c5e233b0f845ae3c450fe9ca8c2cbe04d3
1 //
2 // Mono.Data.PostgreSqlClient.PgSqlParameter.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.PostgreSqlClient
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 PgSqlParameter : MarshalByRefObject,
45 // IDbDataParameter, IDataParameter, ICloneable
46 public sealed class PgSqlParameter : IDbDataParameter, IDataParameter
48 private string parmName;
49 private SqlDbType dbtype;
50 private DbType theDbType;
51 private object objValue;
52 private int size;
53 private string sourceColumn;
54 private ParameterDirection direction;
55 private bool isNullable;
56 private byte precision;
57 private byte scale;
58 private DataRowVersion sourceVersion;
59 private int offset;
61 [MonoTODO]
62 public PgSqlParameter () {
66 [MonoTODO]
67 public PgSqlParameter (string parameterName, object value) {
68 this.parmName = parameterName;
69 this.objValue = value;
72 [MonoTODO]
73 public PgSqlParameter(string parameterName, SqlDbType dbType) {
74 this.parmName = parameterName;
75 this.dbtype = dbType;
78 [MonoTODO]
79 public PgSqlParameter(string parameterName, SqlDbType dbType,
80 int size) {
82 this.parmName = parameterName;
83 this.dbtype = dbType;
84 this.size = size;
87 [MonoTODO]
88 public PgSqlParameter(string parameterName, SqlDbType dbType,
89 int size, string sourceColumn) {
91 this.parmName = parameterName;
92 this.dbtype = dbType;
93 this.size = size;
94 this.sourceColumn = sourceColumn;
97 [MonoTODO]
98 public PgSqlParameter(string parameterName, SqlDbType dbType,
99 int size, ParameterDirection direction,
100 bool isNullable, byte precision,
101 byte scale, string sourceColumn,
102 DataRowVersion sourceVersion, object value) {
104 this.parmName = parameterName;
105 this.dbtype = dbType;
106 this.size = size;
107 this.sourceColumn = sourceColumn;
108 this.direction = direction;
109 this.isNullable = isNullable;
110 this.precision = precision;
111 this.scale = scale;
112 this.sourceVersion = sourceVersion;
113 this.objValue = value;
116 [MonoTODO]
117 public DbType DbType {
118 get {
119 return theDbType;
121 set {
122 theDbType = value;
126 [MonoTODO]
127 public ParameterDirection Direction {
128 get {
129 return direction;
131 set {
132 direction = value;
136 [MonoTODO]
137 public bool IsNullable {
138 get {
139 return isNullable;
143 [MonoTODO]
144 public int Offset {
145 get {
146 return offset;
149 set {
150 offset = value;
155 string IDataParameter.ParameterName {
156 get {
157 return parmName;
160 set {
161 parmName = value;
165 public string ParameterName {
166 get {
167 return parmName;
170 set {
171 parmName = value;
175 [MonoTODO]
176 public string SourceColumn {
177 get {
178 return sourceColumn;
181 set {
182 sourceColumn = value;
186 [MonoTODO]
187 public DataRowVersion SourceVersion {
188 get {
189 return sourceVersion;
192 set {
193 sourceVersion = value;
197 [MonoTODO]
198 public SqlDbType SqlDbType {
199 get {
200 return dbtype;
203 set {
204 dbtype = value;
208 [MonoTODO]
209 public object Value {
210 get {
211 return objValue;
214 set {
215 objValue = value;
219 [MonoTODO]
220 public byte Precision {
221 get {
222 return precision;
225 set {
226 precision = value;
230 [MonoTODO]
231 public byte Scale {
232 get {
233 return scale;
236 set {
237 scale = value;
241 [MonoTODO]
242 public int Size
244 get {
245 return size;
248 set {
249 size = value;
253 [MonoTODO]
254 public override string ToString() {
255 return parmName;