2 // Mono.Data.PostgreSqlClient.PgSqlParameter.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
.PostgreSqlClient
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 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
;
53 private string sourceColumn
;
54 private ParameterDirection direction
;
55 private bool isNullable
;
56 private byte precision
;
58 private DataRowVersion sourceVersion
;
62 public PgSqlParameter () {
67 public PgSqlParameter (string parameterName
, object value) {
68 this.parmName
= parameterName
;
69 this.objValue
= value;
73 public PgSqlParameter(string parameterName
, SqlDbType dbType
) {
74 this.parmName
= parameterName
;
79 public PgSqlParameter(string parameterName
, SqlDbType dbType
,
82 this.parmName
= parameterName
;
88 public PgSqlParameter(string parameterName
, SqlDbType dbType
,
89 int size
, string sourceColumn
) {
91 this.parmName
= parameterName
;
94 this.sourceColumn
= sourceColumn
;
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
;
107 this.sourceColumn
= sourceColumn
;
108 this.direction
= direction
;
109 this.isNullable
= isNullable
;
110 this.precision
= precision
;
112 this.sourceVersion
= sourceVersion
;
113 this.objValue
= value;
117 public DbType DbType
{
127 public ParameterDirection Direction
{
137 public bool IsNullable
{
155 string IDataParameter
.ParameterName
{
165 public string ParameterName
{
176 public string SourceColumn
{
182 sourceColumn
= value;
187 public DataRowVersion SourceVersion
{
189 return sourceVersion
;
193 sourceVersion
= value;
198 public SqlDbType SqlDbType
{
209 public object Value
{
220 public byte Precision
{
254 public override string ToString() {