implemented AuthenticationService, ProxyGenerator
[mono.git] / mcs / class / Mono.Data.Sqlite / Mono.Data.Sqlite / SqliteParameter.cs
1 //
2 // Mono.Data.Sqlite.SqliteParameter.cs
3 //
4 // Represents a parameter to a SqliteCommand, and optionally, its mapping to 
5 // DataSet columns.
6 //
7 // Author(s): Vladimir Vukicevic  <vladimir@pobox.com>
8 //            Everaldo Canuto  <everaldo_canuto@yahoo.com.br>
9 //
10 // Copyright (C) 2002  Vladimir Vukicevic
11 //
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.
30 //
31 #if !NET_2_0
32 using System;
33 using System.Data;
34
35 namespace Mono.Data.Sqlite
36 {
37         public class SqliteParameter : IDbDataParameter
38         {
39
40                 #region Fields
41                 
42                 private string name;
43                 private DbType type;
44                 private DbType originalType;
45                 private bool typeSet;
46                 private string source_column;
47                 private ParameterDirection direction;
48                 private DataRowVersion row_version;
49                 private object param_value;
50                 private byte precision;
51                 private byte scale;
52                 private int size;
53                 private bool isNullable;
54                 private bool sourceColumnNullMapping;
55                 
56                 #endregion
57
58                 #region Constructors and destructors
59                 
60                 public SqliteParameter ()
61                 {
62                         type = DbType.String;
63                         direction = ParameterDirection.Input;
64                         isNullable = true;
65                 }
66                 
67                 public SqliteParameter (string name, DbType type)
68                 {
69                         this.name = name;
70                         this.type = type;
71                         isNullable = true;
72                 }
73                 
74                 public SqliteParameter (string name, object value)
75                 {
76                         this.name = name;
77                         type = DbType.String;
78                         param_value = value;
79                         direction = ParameterDirection.Input;
80                         isNullable = true;
81                 }
82                 
83                 public SqliteParameter (string name, DbType type, int size) : this (name, type)
84                 {
85                         this.size = size;
86                 }
87                 
88                 public SqliteParameter (string name, DbType type, int size, string src_column) : this (name ,type, size)
89                 {
90                         source_column = src_column;
91                 }
92                 
93                 #endregion
94
95                 #region Properties
96                 
97                 public DbType DbType {
98                         get { return type; }
99                         set {
100                                 if (!typeSet) {
101                                         originalType = type;
102                                         typeSet = true;
103                                 }
104                                 type = value;
105                                 if (!typeSet)
106                                         originalType = type;
107                         }
108                 }
109         
110                 public ParameterDirection Direction {
111                         get { return direction; }
112                         set { direction = value; }
113                 }
114         
115                 public bool IsNullable {
116                         get { return isNullable; }
117                 }
118
119                 public string ParameterName {
120                         get { return name; }
121                         set { name = value; }
122                 }
123         
124                 public byte Precision {
125                         get { return precision; }
126                         set { precision = value; }
127                 }
128                 
129                 public byte Scale {
130                         get { return scale; }
131                         set { scale = value; }
132                 }
133
134                 public int Size {
135                         get { return size; }
136                         set { size = value; }
137                 }
138                 
139                 public string SourceColumn {
140                         get { return source_column; }
141                         set { source_column = value; }
142                 }
143
144                 public DataRowVersion SourceVersion {
145                         get { return row_version; }
146                         set { row_version = value; }
147                 }
148                 
149                 public object Value {
150                         get { return param_value; }
151                         set { param_value = value; }
152                 }
153                 
154                 #endregion
155         }
156 }
157 #endif